x5;x8=load('hearttest.txt');c4=size(x8)*[1;0];%calculating size of matrix.
u1=size(x8)*[0;1];x6=x8;%==========================================================
per=80;per1=20;al=0.1;pe=per/100;v=round(pe*c3);%==========================================================%
%==================================================================
%separating the input attributes and the target from the input file
%==================================================================%Reading input in an array
for s1=1:m for i=1:c3 if(x5(i,u)==(s1-1)) for(j=1:u) temp=x5(s1,j); x5(s1,j)=x5(i,j); x5(i,j)=temp; end end endend%==================================================================%==================================================================%TARGET CLASS vectors
%
for i=1:c3 for j=1:u if((j==u)) t(i)=x5(i,j); end endend%==================================================================for i=1:c3 for j=1:u-1 x(i,j)=x5(i,j); endend%==================================================================%INPUT vectors
for i=1:c3 for j=1:u-1 if x(i,j)==0 x(i,j)=.05; end endend%==================================================================%==================================================================%Normalizing the datas.
q2=size(x)*[0;1];p2=size(x)*[1;0];y=max(x,[],1);z=min(x,[],1);for i=1:q2 if y(i)~=z(i) e(i)=y(i)-z(i); else e(i)=1; z(i)=0; endendfor i=1:p2 for j=1:q2 x(i,j)=(x5(i,j)- z(j))/(e(j)); endendx8;q5=size(x8)*[0;1];p5=size(x8)*[1;0];y=max(x8,[],1);z=min(x8,[],1);for i=1:q5 if y(i)~=z(i) e(i)=y(i)-z(i); else e(i)=1; z(i)=0; endendfor i=1:p5 for j=1:q5 x8(i,j)=(x8(i,j)- z(j))/(e(j)); endendx8;%==================================================================%==================================================================%STEP1:
%Initialising then weight matrix.
%==================================================================for i=1:u-1 for j=1:4 w(i,j)=x(j,i); endend
Best Answer