Optimization using GA tool from ANN output

조회 수: 3 (최근 30일)
Raja
Raja 2013년 7월 26일
댓글: Terry Chen 2020년 11월 8일
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?

채택된 답변

Greg Heath
Greg Heath 2013년 8월 1일
편집: Greg Heath 2013년 8월 1일
1. Although the hidden and output layers contain neurons (tansig & purelin), the input layer nodes are fan-in units, NOT neurons.
2. You said 3 inputs instead of 4
3. Cutting and pasting your assignment statements yields
whos
Name Size Bytes Class
b1 1x9 72 double
b2 1x1 8 double
w1 9x4 288 double
w2 9x1 72 double
if size(x) = [ 4 N ] and size(t) = [ 1 N ], the correct dimensions should be
[ 9 1 ] = size(b1)
[ 1 9 ] = size(w2)
4. Then the output and error 1XN vectors are
z = b + w2 * tansig( repmat( b1, 1, N ) + w1 * x) ;
e = t - z;
5. The optimization function is the scalar mean-squared-error
MSE = mse(t-z) = mean( (t-z).^2 )
Hope this help
Thank you for formally accepting my answer
Greg

추가 답변 (1개)

Alan Weiss
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
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by