% 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
没有合适的资源?快使用搜索试试~ 我知道了~
mrmr-ftest.zip_feature selection_image registration_mrmr_mrmr ma
共4个文件
m:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 5 浏览量
2022-07-15
15:55:41
上传
评论
收藏 2KB ZIP 举报
温馨提示
This is a code for feature selection. Which combines minimum redundency and max relevance and Ftest. Originally it is written for gene selection but can be used for any kind of feature selection.
资源推荐
资源详情
资源评论
收起资源包目录
mrmr-ftest.zip (4个子文件)
mrmr-ftest
PearsonCorrD.m 522B
EuclideanD.m 309B
mRMRC.m 3KB
Ftest.m 862B
共 4 条
- 1
资源评论
小波思基
- 粉丝: 85
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功