About matlab genetic algorithm example

4 views (last 30 days)
Kaia
Kaia on 8 Aug 2014
Answered: Aurele Turnes on 8 Aug 2014
Hy!
To begin with, i have 208x34 data set. Dataset consists of relative power values in 208 different frequency band for 34 subjects (17 of them are depressive and 17 are control subjects). I am trying to use genetic algorithm to find these frequency bands which are more important than others (differentiate depressive from control subjects the best)
I used this example as a guide http://www.mathworks.se/help/bioinfo/examples/genetic-algorithm-search-for-features-in-mass-spectrometry-data.html. It seems to be exactly what I need but unfortunately I cant quite well understand it, maybe because of the language barrier and I got a lot of errors :(. Could not find any better example in the internet so maybe anyone here is so kind to help me out?
Did I understood it right that thePoulation variable is equal to number of different frequency bands (in my case 208)?
I get error at biogacreate function. Is it correct to use variables options.PopulationSize = 208 and GenomeLength = 34 in my case? May this be the problem?
The error is like this
Index exceeds matrix dimensions.
Error in biogacreate (line 18) pop(:) = randsample(ranked_features(1:numel(pop)),numel(pop))
Can someone pleas help me, I have tried everything that I could think of (not very much sadly). Would so much appreciate the help!
(Just for additional information. I have also used LDA (through crossvalidation), ranksum and linear separability to evaluate the best frequency bands and I am now trying to use other methods. :) )

Answers (1)

Aurele Turnes
Aurele Turnes on 8 Aug 2014
Since the number of patients in your case is 34, the population size is at most 34 for you. Typically, you would choose a number for options.PopulationSize that is smaller than the total population (for example in your case, you can try 10 or experiment with different values). This number corresponds to the size of the starting population for the genetic algorithm.
The GenomeLength variable in the example corresponds to the nVars variable. It is the number of desired features to be used for classification. Again, typically, this number is less than the total number of features (in your case 208). So in your case, you would want this number to be less than 208. You can try several things: 10, 20, 50 etc., ans see what results you get.

Community Treasure Hunt

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

Start Hunting!