Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: How to optimize with neural networks and genetic algorithms
Replies: 1   Last Post: Aug 11, 2014 1:03 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Juan

Posts: 3
Registered: 8/8/14
How to optimize with neural networks and genetic algorithms
Posted: Aug 10, 2014 11:46 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello. I am Juan.
Please help me. I want optimize with neural networks and then use genetic algorithms but I have problems.
My commands were:
> My commands were:
>>> net=fitnet;
>>> [net,tr]=train(net,pb',tb'); %for train the net
>>> objFcn=@(pb) sim(net,pb'); %answer of nn to object function
>>> [xOpt,fVal]=gamultiobj(objFcn,2) %use ge to optimize


My data:
>>> pb %inputs
> pb =
> 496.0000 0.1000 1.0000
> 496.0000 0.1000 0.7500
> 496.0000 0.1000 1.2500
> 496.0000 0.1000 1.5000
> 496.0000 0.1500 1.0000
> 496.0000 0.1500 0.7500
> 496.0000 0.1500 1.2500
> 496.0000 0.1500 1.5000
> 496.0000 0.1700 1.0000
> 496.0000 0.1700 0.7500
> 496.0000 0.1700 1.2500
> 496.0000 0.1700 1.5000
> 496.0000 0.2000 1.0000
> 496.0000 0.2000 0.7500
> 496.0000 0.2000 1.2500
> 496.0000 0.2000 1.5000
> 396.0000 0.1000 1.0000
> 396.0000 0.1000 0.7500
> 396.0000 0.1000 1.2500
> 396.0000 0.1000 1.5000
> 396.0000 0.1500 1.0000
> 396.0000 0.1500 0.7500
> 396.0000 0.1500 1.2500
> 396.0000 0.1500 1.5000
> 396.0000 0.1700 1.0000
> 396.0000 0.1700 0.7500
> 396.0000 0.1700 1.2500
> 396.0000 0.1700 1.5000
> 396.0000 0.2000 1.0000
> 396.0000 0.2000 0.7500
> 396.0000 0.2000 1.2500
> 396.0000 0.2000 1.5000
> 595.0000 0.1000 1.0000
> 595.0000 0.1000 0.7500
> 595.0000 0.1000 1.2500
> 595.0000 0.1000 1.5000
> 595.0000 0.1500 1.0000
> 595.0000 0.1500 0.7500
> 595.0000 0.1500 1.2500
> 595.0000 0.1500 1.5000
> 595.0000 0.1700 1.0000
> 595.0000 0.1700 0.7500
> 595.0000 0.1700 1.2500
> 595.0000 0.1700 1.5000
> 595.0000 0.2000 1.0000
> 595.0000 0.2000 0.7500
> 595.0000 0.2000 1.2500
> 595.0000 0.2000 1.5000
> 674.0000 0.1000 1.0000
> 674.0000 0.1000 0.7500
> 674.0000 0.1000 1.2500
> 674.0000 0.1000 1.5000
> 674.0000 0.1500 1.0000
> 674.0000 0.1500 0.7500
> 674.0000 0.1500 1.2500
> 674.0000 0.1500 1.5000
> 674.0000 0.1700 1.0000
> 674.0000 0.1700 0.7500
> 674.0000 0.1700 1.2500
> 674.0000 0.1700 1.5000
> 674.0000 0.2000 1.0000
> 674.0000 0.2000 0.7500
> 674.0000 0.2000 1.2500
> 674.0000 0.2000 1.5000

>>> tb %outputs
> tb =
> 1.0e+04 *
> 0.0003 2.3808
> 0.0003 1.7856
> 0.0003 2.9760
> 0.0003 0.0000
> 0.0003 0.0000
> 0.0003 2.6784
> 0.0003 4.4640
> 0.0003 5.3568
> 0.0003 4.0472
> 0.0003 3.0354
> 0.0003 5.0590
> 0.0003 6.0708
> 0.0003 4.7616
> 0.0003 0.0000
> 0.0003 8.3328
> 0.0003 0.0000
> 0.0003 1.9008
> 0.0003 1.4256
> 0.0003 2.3760
> 0.0003 2.8512
> 0.0003 2.8512
> 0.0003 2.1384
> 0.0003 3.5640
> 0.0003 4.2768
> 0.0003 3.2312
> 0.0003 2.4234
> 0.0003 4.0390
> 0.0003 4.8468
> 0.0003 3.8016
> 0.0003 2.8512
> 0.0003 4.7520
> 0.0003 5.7024
> 0.0003 2.8560
> 0.0003 2.1420
> 0.0003 0.0000
> 0.0003 4.2840
> 0.0003 4.2840
> 0.0003 3.2130
> 0.0003 5.3550
> 0.0003 6.4260
> 0.0003 4.8552
> 0.0003 3.6414
> 0.0003 6.0690
> 0.0003 7.2828
> 0.0003 5.7120
> 0.0003 4.2840
> 0.0003 0.0000
> 0.0003 8.5680
> 0.0003 3.2352
> 0.0003 2.4264
> 0.0003 4.0440
> 0.0004 4.8528
> 0.0003 4.8528
> 0.0003 3.6396
> 0.0003 6.0660
> 0.0003 7.2792
> 0.0003 5.5000
> 0.0003 4.1250
> 0.0003 6.8750
> 0.0003 8.2500
> 0.0003 6.4704
> 0.0004 4.8528
> 0.0004 8.0880
> 0.0003 9.7056


My answer:
> Error using bsxfun
> Non-singleton dimensions of the two input arrays must match each other.
> Error in nnMATLAB.pc (line 24)
> pi = bsxfun(@minus,pi,settings.xoffset);
> Error in nncalc.preCalcData (line 20)
> data.Pc = calcMode.pc(net,data.X,data.Xi,data.Q,data.TS,calcHints);
> Error in nncalc.setup1 (line 99)
> calcData =
> nncalc.preCalcData(matlabMode,matlabHints,net,data,doPc,doPd,calcHints.doFlattenTime);
>
> Error in network/sim (line 295)
> [calcMode,calcNet,calcData,calcHints,~,resourceText] =
> nncalc.setup1(calcMode,net,data);
> Error in @(pb)sim(net,pb')
>
> Error in createAnonymousFcn>@(x)fcn(x,FcnArgs{:}) (line 11)
> fcn_handle = @(x) fcn(x,FcnArgs{:});
> Error in gamultiobjMakeState (line 25)
> Score = FitnessFcn(state.Population(1,:));
> Error in gamultiobjsolve (line 11)
> state =
> gamultiobjMakeState(GenomeLength,FitnessFcn,output.problemtype,options);
> Error in gamultiobj (line 235)
> [x,fval,exitFlag,output,population,scores] =
> gamultiobjsolve(FitnessFcn,nvars, ...
> Caused by:
> Failure in initial user-supplied fitness function evaluation.
> GAMULTIOBJ cannot continue.


Someone knows about this subject ?. Please give me your opinion
Juan



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.