| 
		
			| پری سیما | ۱۰-۹-۱۳۹۳ ۰۷:۰۱ بعد از ظهر |  
 استخراج قواعد
 سلا م من این کدها رو برای استخراج قواعد و حساب کردن support, confidence تا 3 مرحله نوشتم
 کسی میتونه بگه کجای کد مشکل داره؟
 
	كد: 
 a=rand(15,3)>0.5q=a(1:15,1)
 w=a(1:15,2)
 r=a(1:15,3)
 c=[0,0,0];
 for j=1:3
 b=a(1:15,j);
 for i=1:15
 if b(i,1)==1
 c(1,j)=c(1,j)+1;
 end
 end
 c(1,j)=c(1,j)/15
 end
 disp(c)
 if c(1,1)<0.3
 q(1:15)=[]
 else if c(1,2)<0.3
 w(1:15)=[]
 else if c(1,3)<0.3
 r(1:15)=[]
 end
 end
 end
 x=[0,0]
 m=[0,0]
 n=[0,0]
 if isempty(q)
 a=[w,r];
 for z=1:15
 if w(z,1)==1 & r(z,1)==1
 x(1,1)=x(1,1)+1;
 if w(z,1)==1
 n(1,1)=n(1,1)+1
 end
 end
 end
 m(1,1)=x(1,1)/15
 x(1,1)=n(1,1)/x(1,1)
 if m(1,1)<0.3
 a(:,:)=[]
 else if x(1,1)<0.4
 for v=1:15
 if w(v,1)==1 & r(v,1)==1
 disp('if w ten r')
 end
 
 end
 end
 end
 
 else if isempty(w)
 a=[q,r];
 for z=1:15
 if q(z,1)==1 & r(z,1)==1
 x(1,1)=x(1,1)+1;
 if w(z,1)==1
 n(1,1)=n(1,1)+1
 end
 end
 end
 m(1,1)=x(1,1)/15
 x(1,1)=n(1,1)/x(1,1)
 if m(1,1)<0.3
 a(:,:)=[]
 else if x(1,1)<0.4
 for v=1:15
 if w(v,1)==1 & r(v,1)==1
 disp('if q ten r')
 end
 
 end
 end
 end
 
 else if isempty(r)
 a=[q,w];
 for z=1:15
 if q(z,1)==1 & w(z,1)==1
 x(1,1)=x(1,1)+1;
 if w(z,1)==1
 n(1,1)=n(1,1)+1
 end
 end
 end
 m(1,1)=x(1,1)/15
 x(1,1)=n(1,1)/x(1,1)
 if m(1,1)<0.3
 a(:,:)=[]
 else if x(1,1)<0.4
 for v=1:15
 if w(v,1)==1 & r(v,1)==1
 disp('if w ten r')
 end
 
 end
 end
 end
 else if isempty(w)& isempty(q)
 a=[r];
 else if isempty(w) & isempty(r)
 a=[q];
 else if isempty(q) & isempty(r)
 a=[w]
 else a=[q,w,r];
 for z=1:15
 if q(z,1)==1 & w(z,1)==1 & r(z,1)==1
 x(1,1)=x(1,1)+1;
 end
 end
 
 x(1,1)=x(1,1)/15
 if x(1,1)<0.1
 a(:,:)=[]
 end
 end
 end
 end
 end
 end
 end
 disp(a)
 |