artificial intelligence - classification with four classes by matlab -


i have classification problem 4 classes of input vector.the 4 classes are

a = [1 , 1; 1 ,2]; b = [2,2; -1,0]; c = [-1,-2;2,1]; d = [-1,-2; -1,-2]; 

i wan implement problem matlab, use code :

 c = [-1,-2;2,1];  = [1 , 1; 1 ,2];  b = [2,2; -1,0];  d = [-1,-2; -1,-2];   hold on  grid on   plot(a(1,:),a(2,:),'bs')  plot(b(1,:),b(2,:),'r+')  plot(c(1,:),c(2,:),'go')  plot(d(1,:),d(2,:),'m*')  = [0 1]';  b = [1 1]';  c = [1 0]';  d = [0 0]';  p = [a b c d];   t = [repmat(a,1,length(a)) repmat(b,1,length(b)) repmat(c,1,length(c))    repmat(d,1,length(d)) ];  net = perceptron;  e = 1;  net.adaptparam.passes = 1;  linehandle = plotpc(net.iw{1},net.b{1});  n = 0;  while (sse(e))  n = n+1;  [net,y,e] = adapt(net,p,t);  linehandle = plotpc(net.iw{1},net.b{1},linehandle);  drawnow; end 

but code does'nt work have no idea why, please me....

as has been suggested thewaywewalk, trouble while-loop , fact not provide adequate check statement wish evaluate.
replace while-statement these 2 lines:

acceptable_error = 3.0; while (sse(e)>acceptable_error) 

and should see script terminate after 3 iterations. can play acceptable_error variable check solution works best you. if set small, while loop not exit, because statement not false.


an explanation original while-statement:
ever evaluated if sse(e) returned results - did in each case. that's why never stopped.


to question of sse requires more 1 input argument:
depends on input arguments provide.
the documentation says:

perf = sse(net,t,y,ew) takes these input arguments , optional function parameters,

net: neural network
t: matrix or cell array of target vectors
y: matrix or cell array of output vectors
ew: error weights (default = {1})

and returns sum squared error.

however, not necessary, provide error weights, ew, source code reveals:

only first 3 arguments required. default error weight {1}, weights importance of targets equally.

in case should, based on documentation, call sse this:

sse(net,t,y)   

without being mentioned in documentation (or haven't found it), equivalent have done, providing network errors, e provided adapt:

sse(e) 

both give same results.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -