% Function: Minimum redundancy-Maximum relevance (T-test)
% for continuous variables\
% X should include more than 2 attributes
% Written by Yi Zhang
% 07/24/2007
function Wnum=mRMRC(X,y,Topn,TypeD,TypeM)
% Wnum is the attribute index of the top Topn
% if TypeD is 1, TypeM can be chosen as 1 or 2
% if TypeD is 2, TypeM can be chosen as 3 or 4
[m,n] = size(X);
Wnum = zeros(1,Topn);
% Calculate F-test value
F = Ftest(X,y,n);
F1 = zeros(1,n);
W = zeros(1,n);
X1 = zeros(1,n);
X2 = zeros(m,n);
% Reduce redundance between two attributes
if TypeD == 1
% WD = abs(PearsonCorrD(X))*(10^(-15));
WD = abs(PearsonCorrD(X));
else
% WD = EuclideanD(X);
% scale X into [0,1];
X1 = min(X);
X3 = max(X)-min(X);
for i = 1:n
for j = 1:m
X2(j,i) = (X(j,i)-X1(i))/X3(i);
end
end
WD = EuclideanD(X2);
end
Wnum(1) = 1;
Ft = F(1);
for i = 1:n-1
if F(i+1) >= Ft
Wnum(1) = i+1;
Ft = F(i+1);
end
end
F1(Wnum(1)) = 1;
Ftemp1 = F(Wnum(1));
Ftemp2 = 0;
for i = 2:Topn
for j = 1:n
if F1(j) == 0
if TypeM == 1
% FCD: max(F-Wd); Wd: Pearson correlation
for s = 1:i-1
W(j) = Ftemp2-WD(j,Wnum(s));
end
Ftempa = Ftemp1+F(j);
Ftempb = Ftemp2+W(j);
W(j) = Ftempa/i+Ftempb/(i^2);
elseif TypeM == 2
%FCQ: max(F/Wd); Wd: Pearson correlation
for s = 1:i-1
W(j) = Ftemp2+abs(WD(j,Wnum(s)));
end
Ftempa = Ftemp1+F(j);
Ftempb = Ftemp2+W(j);
W(j) = Ftempa/Ftempb*i;
elseif TypeM == 3
%FDM: max(F*Wd); Wd: EuclideanD
for s = 1:i-1
W(j) = Ftemp2+WD(j,Wnum(s));
end
Ftempa = Ftemp1+F(j);
Ftempb = Ftemp2+W(j);
W(j) = Ftempa/i*Ftempb/(i^2);
else
%FSQ: max(D/Wd); Wd=Wd^(-1)
for s = 1:i-1
W(j) = Ftemp2+WD(j,Wnum(s))^(-1);
end
Ftempa = Ftemp1+F(j);
Ftempb = Ftemp2+W(j);
W(j) = Ftempa/Ftempb*i;
end
end
end
Ft2 = 0;
for j = 1:n
if F1(j) == 0
Ft2 = W(j);
break
end
end
for j = 1:n
if F1(j) == 0
if W(j) >= Ft2
Wnum(i) = j;
Ft2 = W(j);
end
end
end
F1(Wnum(i)) = 1;
Ftemp1 = Ftemp1+F(Wnum(i));
if TypeM == 1
for s = 1:i-1
Ftemp2 = Ftemp2-WD(Wnum(i),Wnum(s));
end
elseif TypeM == 2
for s = 1:i-1
Ftemp2 = Ftemp2+WD(Wnum(i),Wnum(s));
end
elseif TypeM == 3
for s = 1:i-1
Ftemp2 = Ftemp2+WD(Wnum(i),Wnum(s));
end
else
for s = 1:i-1
Ftemp2 = Ftemp2+WD(Wnum(i),Wnum(s))^(-1);
end
end
end
小波思基
- 粉丝: 86
- 资源: 1万+
最新资源
- 云计算,搭建分布式,然后实现Titantic数据集训练、分类的的代码
- 同城宠物照看-JAVA-基于Spring Boot的同城宠物照看系统的设计与实现(毕业论文)
- 云计算,实现中文字频统计代码,课程设计
- weixin138社区互助养老+ssm(论文+源码)-kaic.zip
- 扶贫助农系统-JAVA-基于spring boot扶贫助农系统设计与实现(毕业论文)
- 母婴护理知识共享-JAVA-基于SpringBoot+vue 的母婴护理知识共享系统(毕业论文)
- 番茄叶片图像病害多标签分类,约5600张数据
- 影音互动科普网站-JAVA-基于SpringBoot的哈利波特书影音互动科普网站设计与实现(毕业论文)
- 航空散货调度-JAVA-基于SpringBoot的航空散货调度系统设计与实现(毕业论文)
- 基于Python Scrapy的贝壳找房爬虫程序
- zigbee CC2530无线自组网协议栈实现一个协调器+多个终端的通讯及控制.zip
- 校园二手物品交易-JAVA-基于springBoot的校园二手物品交易系统的设计与实现(毕业论文)
- 计算机视觉项目:Swin-Transformer 【tiny、small、base】模型实现的图像识别项目:番茄病害图像分类
- 功能完善的电商数据智能爬虫采集系统项目全套技术资料.zip
- 青少年心理健康教育网-JAVA-基于springboot的青少年心理健康教育网站的设计与实现(毕业论文)
- 密评流程及商密应用方案解析
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈