How can I use a trained neural network as an objective function in GA optimisation

6 views (last 30 days)
I have trained neural networks from experimental data and I want to use the neural networks simulation as feed to the genetic algorithm, is there a way of doing that in Matlab? I guess I will still need a parametric fitness function for optimization using the GA. The only way I can think of for generating a parametric objective function is by regression, is there a way I can use the trained neural network to generate a parametric equation?

Accepted Answer

Greg Heath
Greg Heath on 4 Dec 2013
Use the trained network to calculate the MSE on non-training data.
Normalized MSE NMSE = MSE/mean(var(target',1)) and "Fraction of target variance explained (Wikipedia/R-squared) R^2 = 1-NMSE are the most convenient optimization objectives.
  8 Comments
Anurag Trivedi
Anurag Trivedi on 3 Oct 2016
Edited: Greg Heath on 9 Oct 2016
Following code uses Neural Network as Objective Function for SA:
for i=1:5;
ObjectiveFunction = @(x) sim(net{22,3}, x);
p1 = [30.00;20.30;737;1000;0.20;];
% // (starting point for the algo)
% ERROR: // is not used in MATLAB for comments. Use %
lb = [0 16.80 713 884 0.1];
ub = [100 22.90 762 1100 0.7];
[x,fval,exitFlag,output] = simulannealbnd(ObjectiveFunction,p1,lb,ub);
XX(1:5,i)=x;
FVALL(1,i)=fval;
end;

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!