粗糙集 属性约简 题目: SARS 诊断 注:这是我学粗糙集时老师给的作业 U 干咳 呼吸困难 血液检测 高烧38度 X射线 浓痰 血细胞多 寒战 肌肉酸痛 乏力 胸膜痛 头痛 非典 1 1 1 1 1 0 0 0 0 1 1 0 1 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 3 1 0 1 0 0 0 0 0 0 1 0 0 0 4 0 0 0 1 1 1 1 0 1 0 1 1 0 5 1 0 0 1 1 1 1 1 0 1 1 0 0 6 0 1 0 1 1 1 1 1 1 0 0 1 0 7 1 0 0 0 1 1 1 0 0 1 1 1 0 8 1 1 1 1 0 0 0 0 1 1 0 1 1 9 1 0 1 1 1 0 0 0 1 1 0 1 1 10 1 1 1 1 0 0 0 0 1 1 0 1 1 11 1 0 1 1 1 0 0 0 1 1 0 1 1 12 1 0 1 1 1 0 0 0 1 1 0 1 1 属性约简的顺序如下:求正域、生成未经处理的区分矩阵、对区分矩阵进行化简、求核、对已经处理过的区分矩阵进行属性约简。约简后的决策表有 26 行,所有 12 个属性都是正域中的属性,核为空 程序: % main.m tic; a=[ 1,1,1,1,0,0,0,0,1,1,0,1; 0,0,0,0,0,0,0,0,0,0,0,0; 1,0,1,0,0,0,0,0,0,1,0,0; 0,0,0,1,1,1,1,0,1,0,1,1; 1,0,0,1,1,1,1,1,0,1,1,0; 0,1,0,1,1,1,1,1,1,0,0,1; 1,0,0,0,1,1,1,0,0,1,1,1; 1,1,1,1,0,0,0,0,1,1,0,1; 1,0,1,1,1,0,0,0,1,1,0,1; 1,1,1,1,0,0,0,0,1,1,0,1; 1,0,1,1,1,0,0,0,1,1,0,1; 1,0,1,1,1,0,0,0,1,1,0,1 ]; d=[1;0;0;0;0;0;0;1;1;1;1;1]; pos=posCD(a,d); dismat=dismatrix(a,d,pos); dism=disbe(dismat); core=cor(dism); [red,row]=redu(dism); time=toc % dismatrix.m % 生成未经处理的区分矩阵 dismat function dismat=dismatrix(a,d,pos) [m,n]=size(a); p=1; index1=0;index2=0;index=0; dis=-1*ones(m*(m-1)/2,n); for i=1:m for j=i+1:m if (isxbelongtopos(i,pos)&~isxbelongtopos(j,pos))... |(~isxbelongtopos(i,pos)&isxbelongtopos(j,pos))... |(isxbelongtopos(i,pos)&isxbelongtopos(j,pos)&~isxybelongtoindD(i,j,d)) index2=1; end if index2==0 continue; end for k=1:n if a(i,k)~=a(j,k) dis(p,k)=1; index1=1; else dis(p,k)=0; end end if index1==1 p=p+1;index=1; end index1=0; index2=0; end end if p<=m*(m-1)/2 if index==0 dismat=[]; return; end if dis(p,1)==-...