Extract some value from genetic algorithm tool addition to fitness function value
Afficher commentaires plus anciens
Hi,
I use the genetic algorithm-ANN codes for classification. I share you part of my codes.
h= @(x)mse_test(x,net, P, Output);
ga_opt = gaoptimset('display','iter', 'TolFun', 1e-8, 'CrossoverFraction', cr, ...);
[x_ga_opt, final_err_ga, exfl, ouput] = ga(h,10*n+1,ga_opt);
I only can get the final_err_ga value. Bu also confusion matrix(conf) is calculated in ga tool but I cant see it in result screen end of the run. How can I extract the conf variable?
function cal = mse_test(x,net, P, Output)
....
cal=(1/Accuracy);
conf = confusionmat (Output, z);
end
I can share screenshot if necessary. Thank you very much.
Réponses (2)
Alan Weiss
le 21 Nov 2018
0 votes
Alan Weiss
MATLAB mathematical toolbox documentation
2 commentaires
Ebru PEKEL
le 21 Nov 2018
Alan Weiss
le 26 Nov 2018
The nested function allows access to all variable values that you want. Simply pull the values into the main function from the nested functions. See Nested Functions.
Alan Weiss
MATLAB mathematical toolbox documentation
Ebru PEKEL
le 4 Déc 2018
0 votes
Catégories
En savoir plus sur Genetic Algorithm dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!