%Rough Set Attribute's Reduction algorithm
%Version 1.0 16-July-2008
%Department of Business Management
%NorthChina Electric Power University,Beijing,China
%MicroArmy
%Inputs:
% AttriValues -Attributes' Value matrix
% DecisionTypeValue -DecisionTypeValue matrix
%Outputs:
%The Core of the attribute
%0 express can be deleted
%1 express not
%function RSAttributeReduction(AttributeValues,DecisionValues)
function RSAR=RSAttributeReduction(AttributeValues,DecisionValues)
%The Idea of algorithm
%for every attributes,
%deleted one by one, and check the attributevalues
%if(AttributeValues are all different)
% the deleted attributes can be deleted
%else
% if(the same AttributeValues' DecisionValues is also same)
% the deleted attributes can be deleted
% else
% the deleted attribute can't be deleted
[m,n]=size(AttributeValues);
record=zeros(n,1); %Record the attributes weather can be reduced, 0 express can reduced, otherwise is 1;
reducerecord=ones(n,1); %Record the reduce attribute traces
for j=1:n
tempAttriV=AttributeValues;
tempAttriV(:,j)=[];
if (min(reducerecord)~=1)
g=0;
for k=1:j-1
if (reducerecord(k)==0)
tempAttriV(:,k-g)=[];
g=g+1; %Record the reduce cols
end
end
end
for i=1:m
%tempDValues=DecisionValues;
%tempDValues(i)=[];
compareResult=Compare(tempAttriV(i,:),tempAttriV,DecisionValues(i),DecisionValues);
if (compareResult==0)
record(j)=0;
reducerecord(j)=0;
else
record(j)=1;
reducerecord(j)=1;
break
end
end
end
%display the result
if(min(reducerecord==0))
disp('the last column left!')
else
RSAR=record;
end
function [compareResult]=Compare(RowArray,Matrix,DValue,DArray)
%Input:
% RowArray:compared array
% Matrix:the Matrix
% DValue: the respectivly decision value of the RowArray
% DArray: the Decision Array
[m1,n1]=size(Matrix);
record1=zeros(m1,n1); %Record every rows' result of comparing the rowarray with the matrix
samerow=ones(1,n1); %if attribute row is same ,then produce a onesrow;
compareResult=0;
tempcompareResult=0;
for i1=1:m1
record1(i1,:)=(RowArray==Matrix(i1,:));
end
for i3=1:m1
if ((record1(i3,:)==samerow) & (DArray(i3)==DValue))
compareResult=compareResult | 0;
elseif ((record1(i3,:)==samerow) & (DArray(i3)~=DValue))
compareResult=1;
break
end
end
属性约简 matlab程序
4星 · 超过85%的资源 需积分: 50 50 浏览量
2009-12-31
17:11:27
上传
评论 5
收藏 2KB RAR 举报
zhlei1006
- 粉丝: 0
- 资源: 3
最新资源
- 道理都懂-刘德华.mp3
- 电脑文件按照类别自动整理
- 上述资源是python入门第三章的if语句的示例
- lvgl v9.1版本使用lvglFontTool V0.4生成的外部bin字库
- Typora 完美安装(鸡火)教程
- Screenshot_2024-05-07-20-14-54-883_com.tencent.mobileqq.jpg
- 全网最好用的Source Insight4支持Verilog和SystemVerilog语法高亮和跳转的配置文件 超越官方品质
- Numpy随堂练习1.ipynb
- 176542687225117Facebook Lite_405.0.0.8.113_apkcombo.com.arm64-v8a.apk
- 41532698775097Facebook Lite_405.0.0.8.113_apkcombo.com.armeabi-v7a.apk
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
前往页