Problem with GA function

1 次查看(过去 30 天)
Lalit Mohan Kandpal
回答: Khalid 2022-11-15
Hello,
I am trying to apply genetric algorithm to select the features. I follow the code as suggested in this link: https://ch.mathworks.com/help/bioinfo/ug/genetic-algorithm-search-for-features-in-mass-spectrometry-data.html. However when I used my data the feat = ga(FitnessFcn,nVars,options) showng below error:
Error using rankfeatures (line 206)
Number of output
indices must be a
scalar between 1 and
number of features.
Error in biogacreate (line 17)
ranked_features = rankfeatures(Y,id,'NumberOfIndices',npop,'NWeighting',.5);
Error in makeState (line 34)
state.Population = feval(options.CreationFcn,GenomeLength,FitnessFcn,options,options.CreationFcnArgs{:});
Error in gaunc (line 47)
state = makeState(GenomeLength,FitnessFcn,Iterate,output.problemtype,options);
Error in ga (line 411)
[x,fval,exitFlag,output,population,scores] = gaunc(FitnessFcn,nvars, ...
Please help regarding this error. thanks !

回答(1 个)

Khalid
Khalid 2022-11-15
Hi,
I understand that you are facing the error in ga function when you are trying to run code from https://ch.mathworks.com/help/bioinfo/ug/genetic-algorithm-search-for-features-in-mass-spectrometry-data.html.
When I tried to reproduce the error on my end, I didn't face any errors.
One possible reason for the error could be because of some issue in preprocessing step. Make sure that the data is preprocessed as mentioned and that the variables MZ, Y and grp are of same dimensions as shown in the article.
Hope it helps.
Regards,
Khalid

类别

Help CenterFile Exchange 中查找有关 Genetic Algorithm 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by