粗糙集属性约简matlab程序.doc

粗糙集属性约简matlab程序.doc

ID:57214921

大小:20.00 KB

页数:4页

时间:2020-08-06

粗糙集属性约简matlab程序.doc_第1页
粗糙集属性约简matlab程序.doc_第2页
粗糙集属性约简matlab程序.doc_第3页
粗糙集属性约简matlab程序.doc_第4页
资源描述:

《粗糙集属性约简matlab程序.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、粗糙集-属性约简-matlab程序Data2为条件属性,decision2为决策属性%%%my_test函数实现clc;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%读取信息系统文件file=textread('data2.txt','%s','delimiter','','whitespace','');%读取文件信息,每一行为一个胞元[m,n]=size(file);%胞元的大小fori=1:mwords=strread(file{i},'%s','delimiter','');%读取每个胞元中字符,即分解胞元为新的胞元words=words

2、';%转置X{i}=words;endX=X';%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%[B,num,AT]=my_reduct(X);%信息系统的约简ind_AT=ind(X);%信息系统的不可等价关系%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%显示约简信息系统disp('约简后的条件系统为:');[m,n]=size(B);fori=1:mdisp(B{i});end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%读取决策系统文件file=tex

3、tread('decision2.txt','%s','delimiter','','whitespace','');[m,n]=size(file);fori=1:mwords=strread(file{i},'%s','delimiter','');words=words';D{i}=words;endD=D';%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%决策系统的正域约简X_D=X;[l,k]=size(X_D{1});pos_d=pos(X_D,D);%正域fori=1:m%%%%%%%%%%%%%%正域有

4、问题%%%%%%%%%%%%%%%%%%%%%%%%%%%if(~ismember(num(i),pos_d))B{i}='';%若约简后的信息系统B{i}不在正域中则删除该行end%因为相同的条件得到的决策不一样,end%将在正域规则下约简过的信息系统B连接决策系统D[m,n]=size(B);fori=1:mif(~isequal(B{i},''))B{i}{1,k+1}=D{i}{1};endend%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%显示约简决策系统disp('约简后的决策系统为:');[m,n]=siz

5、e(B);fori=1:mdisp(B{i});end--------------------------------------------------------------------------------%%%%%my_reduct函数实现function[C,num,reduct_attr]=my_reduct(X)%%%%%y为约简后的cell数组,reduct_attr为可约去的属性%X为行向量(元素为胞元)clc;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%约简[m,n]=size(X);[p,k]=size(X{1}

6、);ind_AT=ind(X);%寻找不可等价关系reduct_attr=[];%可约去的的属性num=zeros(m,1);%约简后的信息对应的个体fori=1:kB=delete_AT(X,i);if(isequal(ind_AT,ind(B)))%若IND(AT-{a}=IND(AT)reduct_attr=union(reduct_attr,i);%则寻找到可约去的属性X=B;endend%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%剔除重复的行k=1;fori=1:mif(~isequal(ind_AT{i},[]))C_i=ind_AT{i,1

7、}(1);num(k)=i;C{k,1}=X{C_i};%返回约简后的信息系统k=k+1;endend--------------------------------------------------------------------------------%%%%%ind函数实现functionyy=ind(X)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%寻找不可分辨关系[m,n]=size(X);k=1;ind_AT=cell(m,1);fori=1:mforj=(i+1):m%潜在问题,如i=m是终止

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。