属性约简(MATLAB 算法)有实例有讲解(7 页)Good is good, but better carries it.精益求精,善益求善。粗糙集 属性约简题目: SARS 诊断注:这是我学粗糙集时老师给的作业 U干咳呼吸困难 血液检测高烧38度 X射线浓痰血细胞多寒战肌肉酸痛乏力胸膜痛头痛非典1 1 1 1 1 0 0 0 0 1 1 0 1 12 0 0 0 0 0 0 0 0 0 0 0 0 03 1 0 1 0 0 0 0 0 0 1 0 0 04 0 0 0 1 1 1 1 0 1 0 1 1 05 1 0 0 1 1 1 1 1 0 1 1 0 06 0 1 0 1 1 1 1 1 1 0 0 1 07 1 0 0 0 1 1 1 0 0 1 1 1 08 1 1 1 1 0 0 0 0 1 1 0 1 19 1 0 1 1 1 0 0 0 1 1 0 1 1101 1 1 1 0 0 0 0 1 1 0 1 1111 0 1 1 1 0 0 0 1 1 0 1 1121 0 1 1 1 0 0 0 1 1 0 1 1属性约简的顺序如下:求正域、生成未经处理的区分矩阵、对区分矩阵进行化简、求核、对已经处理过的区分矩阵进行属性约简。约简后的决策表有 26 行,所有 12 个属性都是正域中的属性,核为空 程序:% main.mtic;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% 生成未经处理的区分矩阵 dismatfunction 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; endendif p<=m*(m-1)/2 if index==0 dismat=[]; return; end if dis(p,...