Problem with GA function

1 回表示 (過去 30 日間)
Lalit Mohan Kandpal
Lalit Mohan Kandpal 2022 年 11 月 3 日
回答済み: 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 Center および File ExchangeGenetic Algorithm についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by