Optimization using GA tool from ANN output
이전 댓글 표시
Hi all, I am aiming at optimizing a problems which has 4 inputs and one output. I did ANN with 3input neurons, 9 hidden and one ouput neurons. The transfer functions are tansig for hidden and purelin for output layers respectively. I got the weights and biases as follows from ANN: w1 = [-3.8 -3.16 -3.88 -3.31;0.93 -2.24 -0.904 0.086;7.64 2.06 -10 4.845; -3.9 2.483 2.823 2.461;-6 -3.84 -6.821 0.497;-6.7 8.261 4.412 -7.66;-0.1 -2.93 0.48 -5.81;-1.7 -5.62 -4.59 5.304;9.18 -0.14 -3.943 -4.597] w2 = [-5.27;-3.93;-0.62;-0.65;2.056;0.671;-1.56;0.252;1.353] b1 = [-0.5;-2.15;-0.045;3.132;3.137;-5.93;-1.97;-4.24;2.036]' b2 = 16
and the follwoing equation is the one which I have to optimize by ga tool: z = (w2*((2/(1+(exp(-2*(((w1*x')+b1))))))-1))+b2;
lower bounds: [-1 -1 -1 -1] and upper bounds [1 1 1 1]
when I run the ga tool I get the output like this: Optimization running. Error running optimization. Your fitness function must return a scalar value.
can anyone help?
채택된 답변
추가 답변 (1개)
Alan Weiss
2013년 7월 26일
I don't know anything about neural networks, but I think I can tell you how to diagnose this problem: give an input, say x0 = rand(4,1), and see what your fitness function returns
fun(x0)
If I am correct, it will return a vector or matrix, not a scalar.
Optimization functions generally require scalar output from the fitness function.
Alan Weiss
MATLAB mathematical toolbox documentation
댓글 수: 1
Terry Chen
2020년 11월 8일
Hi,
From above Raja's question and other discuss , can we optimize by ga tool: z = (w2*((2/(1+(exp(-2*(((w1*x')+b1))))))-1))+b2;lower bounds: [-1 -1 -1 -1] and upper bounds [1 1 1 1] ?
If possible , How to optimize it?Have anyone explain more ,Thanks
Terry
카테고리
도움말 센터 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!