Parameter optimization with genetic algorithms

Asked by Daniel on 29 Jun 2013 at 20:02
Latest activity Answered by Daniel about 10 hours ago

Hey there,

I have a question concerning GA. I want to optimize several parameter at once by using a function handle. One example is the optimization for a set-up of 2 variables. Each vector consists of 10 possible values so an exhaustive search would comprise 100 trials. Instead of the exhaustive search I want to use GA which for example only needs 20 trials to find the optimal set-up. The optimization function has to be a classification function whose error value should be minimized. How can I implement the 2 variables into the function?

Thanks a lot in advance

Danyo

5 Comments

Matt Eicholtz on 29 Jun 2013 at 22:17

I'm not sure I understand the question. Are you asking how to do a GA on two variables?

Daniel on 29 Jun 2013 at 22:44

I just want to implement the GA to optimize the fitness function (classification task) which needs to optimize two variables, C and Sigma for the RBF-SVM.

Matt J on 30 Jun 2013 at 12:44

Your question isn't specific enough for us to know what to advise you other than "do what the GA documentation says". Have you done

 >> doc ga

What are you looking for beyond what's written there?

Daniel

Products

2 Answers

Answer by Matt J on 30 Jun 2013 at 12:42
Edited by Matt J on 30 Jun 2013 at 14:06

This page gives an example of ga optimization over integer variables

http://www.mathworks.com/help/gads/mixed-integer-optimization.html

The example with Rastrigin's Function is a 2 variable problem and shows you how to make one of the variables integer-variable, though of course you could make them both integers if you wished.

18 Comments

Daniel about 11 hours ago

It is a binary target variable with the same length as the input features of Merkmale_MA... Without GA it works, so there should not be an error..

Matt J about 11 hours ago

svmtrain isn't receiving the input that you think it is receiving. Use DBSTOP to trap the error and to investigate what values are being fed to svmtrain when the error occurs.

Daniel about 11 hours ago

I trapped it, it was because of the "global". I have fixed it but now Matlab complains that Merkmale_MA and KLASSE_1 are unkown in the fitness function cause there are not input variables to the function...

??? Error using ==> makeState at 50 GA cannot continue because user supplied fitness function failed with the following error: Input argument "Merkmale_MA" is undefined.

Matt J
Answer by Daniel about 10 hours ago

I figured it out. And I have changed the set-up to: options=gaoptimset('Vectorized', 'off') ; [x fval] = ga(@fitness, 2,[],[],[],[],lb,ub,[],options);

Bur Matt, this take forever, and the range for C and Sigma is not even large yet. Is there a way to speed it up? like discrete values as input for C and Sigma so that GA does only have to combine to find the best solution for the SVM?

Many thanks, I know it must sound really stupid, but I am really new to GA especially in MATLAB

0 Comments

Daniel

Contact us