How to use a trained neural network as objective function in fminsearch?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Leonardo Anzellotti
el 19 de Sept. de 2022
Editada: Saurabh Sharma
el 16 de Dic. de 2023
I have trained a neural network, with input x that is a matrix 12x22000 and a target t 1x22000, and i have got an output y 1x22000, now i want to optimaize one element of my output with the tool fminsearch but i don't know how to write the objective function 'fun'.
What should i put as 'fun'?
x = input;
t = output;
trainFcn = ['trainlm'];
hiddenLayerSize = 50;
net = feedforwardnet(hiddenLayerSize,trainFcn);
net.divideFcn = ['divideblock'];
net.performFcn = 'mse';
[net,tr] = train(net,x,t);
y = net(x);
%now i want use fminsearch(fun,x0,options)
2 comentarios
Respuesta aceptada
Matt J
el 20 de Sept. de 2022
fminsearch.is unlikely to be able to handle 12 unknowns well. You should probably use fminunc if you have the Optimization Toolbox. Either way, the 'fun' input would be,
fun=@(x) net(x);
1 comentario
Saurabh Sharma
el 16 de Dic. de 2023
Editada: Saurabh Sharma
el 16 de Dic. de 2023
How can we get a trained Gaussian process regression machine learning model in a mathematical equation form? How to write 'fun' if we want to minimise three or four models at same time?
Thankyou
Más respuestas (0)
Ver también
Categorías
Más información sobre Define Shallow Neural Network Architectures en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!