NN optimization using GA - Fitness Function

  • Follow


Hello all,

I have a NN built using the MATLAB toolbox to predict a yield stress of a metal given its composition and conditions. I predicted the outputs. Now I have to employ Genetic Algorithm (GA) to optimise my inputs to reach my desired output. I understand there is a toolbox to do so and uses a function [x , fval] = ga(@fitnessfcn,no.ofvars).

My thinking now is to put in my output into the GA so it can determine the best input to obtain the output.

However, I have trouble determining my fitness function. They should be derived from my outputs and its derivations. Should it be just:

function f = fitnessfcn(DesiredTargets,PredictedTargets)

f = Desired Targets - Predicted i.e. the residuals since I want to minimize the residuals

I believe my no.ofvars should be 2 since I have Desired and Predicted targets in my function. And my desired targets have a dimension of 1x100.

Is my approach i.e. minimizing the residuals correct in order to optimize my inputs? I am a bit doubtful because I want to optimize the process not the NN model. 

Any advice would be helpful.

Thanks.
0
Reply Yeo 3/21/2010 3:21:02 AM

Your optimization function (say objective.m or any name) should create output using the inputs x(1), x(2). I am assuming two variables

function [out] = objective (x)

Now use this function in GA (@objective) as objective function. I frequently use the GA Tool (GUI) and due to GUI it is more comforatble to use. type gatool in the command line of matlab....

I hope it helps you....




"Yeo " <yeocr88@gmail.com> wrote in message <ho43au$mu7$1@fred.mathworks.com>...
> Hello all,
> 
> I have a NN built using the MATLAB toolbox to predict a yield stress of a metal given its composition and conditions. I predicted the outputs. Now I have to employ Genetic Algorithm (GA) to optimise my inputs to reach my desired output. I understand there is a toolbox to do so and uses a function [x , fval] = ga(@fitnessfcn,no.ofvars).
> 
> My thinking now is to put in my output into the GA so it can determine the best input to obtain the output.
> 
> However, I have trouble determining my fitness function. They should be derived from my outputs and its derivations. Should it be just:
> 
> function f = fitnessfcn(DesiredTargets,PredictedTargets)
> 
> f = Desired Targets - Predicted i.e. the residuals since I want to minimize the residuals
> 
> I believe my no.ofvars should be 2 since I have Desired and Predicted targets in my function. And my desired targets have a dimension of 1x100.
> 
> Is my approach i.e. minimizing the residuals correct in order to optimize my inputs? I am a bit doubtful because I want to optimize the process not the NN model. 
> 
> Any advice would be helpful.
> 
> Thanks.
0
Reply Ajay 3/22/2010 12:36:04 PM


Thanks for your reply,

I am having trouble determining how to obtain the optimized input set from the GA. The fitness function wont work unless it returns a scalar i.e.  I can minimize the variance and RMS errors. But, I'm still unsure how to get the optimized output set from my GA i.e. 1x100 in size. Is it because my fitness function is incorrect? Or it cannot be done in such a way using the toolbox?

Regards.

"Ajay " <ajaydashora@gmail.com> wrote in message <ho7o7k$642$1@fred.mathworks.com>...
> Your optimization function (say objective.m or any name) should create output using the inputs x(1), x(2). I am assuming two variables
> 
> function [out] = objective (x)
> 
> Now use this function in GA (@objective) as objective function. I frequently use the GA Tool (GUI) and due to GUI it is more comforatble to use. type gatool in the command line of matlab....
> 
> I hope it helps you....
> 
> 
> 
> 
> "Yeo " <yeocr88@gmail.com> wrote in message <ho43au$mu7$1@fred.mathworks.com>...
> > Hello all,
> > 
> > I have a NN built using the MATLAB toolbox to predict a yield stress of a metal given its composition and conditions. I predicted the outputs. Now I have to employ Genetic Algorithm (GA) to optimise my inputs to reach my desired output. I understand there is a toolbox to do so and uses a function [x , fval] = ga(@fitnessfcn,no.ofvars).
> > 
> > My thinking now is to put in my output into the GA so it can determine the best input to obtain the output.
> > 
> > However, I have trouble determining my fitness function. They should be derived from my outputs and its derivations. Should it be just:
> > 
> > function f = fitnessfcn(DesiredTargets,PredictedTargets)
> > 
> > f = Desired Targets - Predicted i.e. the residuals since I want to minimize the residuals
> > 
> > I believe my no.ofvars should be 2 since I have Desired and Predicted targets in my function. And my desired targets have a dimension of 1x100.
> > 
> > Is my approach i.e. minimizing the residuals correct in order to optimize my inputs? I am a bit doubtful because I want to optimize the process not the NN model. 
> > 
> > Any advice would be helpful.
> > 
> > Thanks.
0
Reply Yeo 3/22/2010 3:07:04 PM

Hi Yeo, 
Did you find a solution to your problem. I am  looking at solving a similar issue, and will be happy if you can share the solution to this problem with me.
Thanks
"Yeo " <yeocr88@gmail.com> wrote in message <ho43au$mu7$1@fred.mathworks.com>...
> Hello all,
> 
> I have a NN built using the MATLAB toolbox to predict a yield stress of a metal given its composition and conditions. I predicted the outputs. Now I have to employ Genetic Algorithm (GA) to optimise my inputs to reach my desired output. I understand there is a toolbox to do so and uses a function [x , fval] = ga(@fitnessfcn,no.ofvars).
> 
> My thinking now is to put in my output into the GA so it can determine the best input to obtain the output.
> 
> However, I have trouble determining my fitness function. They should be derived from my outputs and its derivations. Should it be just:
> 
> function f = fitnessfcn(DesiredTargets,PredictedTargets)
> 
> f = Desired Targets - Predicted i.e. the residuals since I want to minimize the residuals
> 
> I believe my no.ofvars should be 2 since I have Desired and Predicted targets in my function. And my desired targets have a dimension of 1x100.
> 
> Is my approach i.e. minimizing the residuals correct in order to optimize my inputs? I am a bit doubtful because I want to optimize the process not the NN model. 
> 
> Any advice would be helpful.
> 
> Thanks.
0
Reply Givemore 7/13/2010 10:49:05 PM

Hello Mr Givemore,

I did find a solution to the problem. The things you want to take note of are:

(i) What you are trying to optimise? There is a big difference between optimising your model and optimising the inputs. 

(ii) What defines your fitness function?

(iii) Are you doing single or multiple objective optimisation?

I would recommend you to read on GA to understand its operation parameters and how they affect the optimisation process. 

Please come back with more specific questions. 



"Givemore " <givesak@gmail.com> wrote in message <i1iqh1$bj5$1@fred.mathworks.com>...
> Hi Yeo, 
> Did you find a solution to your problem. I am  looking at solving a similar issue, and will be happy if you can share the solution to this problem with me.
> Thanks
> "Yeo " <yeocr88@gmail.com> wrote in message <ho43au$mu7$1@fred.mathworks.com>...
> > Hello all,
> > 
> > I have a NN built using the MATLAB toolbox to predict a yield stress of a metal given its composition and conditions. I predicted the outputs. Now I have to employ Genetic Algorithm (GA) to optimise my inputs to reach my desired output. I understand there is a toolbox to do so and uses a function [x , fval] = ga(@fitnessfcn,no.ofvars).
> > 
> > My thinking now is to put in my output into the GA so it can determine the best input to obtain the output.
> > 
> > However, I have trouble determining my fitness function. They should be derived from my outputs and its derivations. Should it be just:
> > 
> > function f = fitnessfcn(DesiredTargets,PredictedTargets)
> > 
> > f = Desired Targets - Predicted i.e. the residuals since I want to minimize the residuals
> > 
> > I believe my no.ofvars should be 2 since I have Desired and Predicted targets in my function. And my desired targets have a dimension of 1x100.
> > 
> > Is my approach i.e. minimizing the residuals correct in order to optimize my inputs? I am a bit doubtful because I want to optimize the process not the NN model. 
> > 
> > Any advice would be helpful.
> > 
> > Thanks.
0
Reply Yeo 7/14/2010 9:34:03 PM

Hello Yeo, 

You said you have found the solution on the GA output which you can used it again to your NN. 

I have run my m-files using the mlp fitness function, but, I am not really sure how to get the new optimized input from the GA which I have simulate. Basically, I use mean square error as my output of my fitness function, is it correct?
Then, my problem is how can I take back the optimized input which I generate from the GA for me to use or predict using the NN?

Hope to get your help. I am a bit confuse in doing the m-files with the GA.

Best regards,
-Zaman-

"Yeo" wrote in message <ho812o$hvj$1@fred.mathworks.com>...
> Thanks for your reply,
> 
> I am having trouble determining how to obtain the optimized input set from the GA. The fitness function wont work unless it returns a scalar i.e.  I can minimize the variance and RMS errors. But, I'm still unsure how to get the optimized output set from my GA i.e. 1x100 in size. Is it because my fitness function is incorrect? Or it cannot be done in such a way using the toolbox?
> 
> Regards.
> 
> "Ajay " <ajaydashora@gmail.com> wrote in message <ho7o7k$642$1@fred.mathworks.com>...
> > Your optimization function (say objective.m or any name) should create output using the inputs x(1), x(2). I am assuming two variables
> > 
> > function [out] = objective (x)
> > 
> > Now use this function in GA (@objective) as objective function. I frequently use the GA Tool (GUI) and due to GUI it is more comforatble to use. type gatool in the command line of matlab....
> > 
> > I hope it helps you....
> > 
> > 
> > 
> > 
> > "Yeo " <yeocr88@gmail.com> wrote in message <ho43au$mu7$1@fred.mathworks.com>...
> > > Hello all,
> > > 
> > > I have a NN built using the MATLAB toolbox to predict a yield stress of a metal given its composition and conditions. I predicted the outputs. Now I have to employ Genetic Algorithm (GA) to optimise my inputs to reach my desired output. I understand there is a toolbox to do so and uses a function [x , fval] = ga(@fitnessfcn,no.ofvars).
> > > 
> > > My thinking now is to put in my output into the GA so it can determine the best input to obtain the output.
> > > 
> > > However, I have trouble determining my fitness function. They should be derived from my outputs and its derivations. Should it be just:
> > > 
> > > function f = fitnessfcn(DesiredTargets,PredictedTargets)
> > > 
> > > f = Desired Targets - Predicted i.e. the residuals since I want to minimize the residuals
> > > 
> > > I believe my no.ofvars should be 2 since I have Desired and Predicted targets in my function. And my desired targets have a dimension of 1x100.
> > > 
> > > Is my approach i.e. minimizing the residuals correct in order to optimize my inputs? I am a bit doubtful because I want to optimize the process not the NN model. 
> > > 
> > > Any advice would be helpful.
> > > 
> > > Thanks.
0
Reply m.k.abdul-kadir (1) 9/28/2011 9:11:10 PM

5 Replies
584 Views

(page loaded in 0.083 seconds)

Similiar Articles:













7/23/2012 9:03:14 PM


Reply: