最大信息系数 maximal information coefficient (MIC),又称最大互信息系数。
之前写了一个MIC的介绍,里面包含了MIC的原理,链接:http://www.omegaxyz.com/2018/01/18/mic/
利用到的MATLAB包安装请参见:http://www.omegaxyz.com/2018/02/21/minepy/
特征选择步骤
①计算不同维度(特征)之间的MIC值,MIC值越大,说明这两个维度越接近。
②寻找那些与其他维度MIC值较小的维度,根据阈值选出这些特征。
③利用SVM训练
④训练结果在测试集上判断错误率
minepy的安装请参照:http://www.omegaxyz.com/2018/02/21/minepy/
MATLAB代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
clc load train_F.mat; load train_L.mat; load test_F.mat; load test_L.mat; Dim = 22; MIC_matrix = zeros(Dim, Dim); for i = 1:Dim for j = 1:Dim X_v = reshape(train_F(:,i),1,size(train_F(:,i),1)); Y_v = reshape(train_F(:,j),1,size(train_F(:,j),1)); [A, ~] = mine(X_v, Y_v); MIC_matrix(i, j) = A.mic; end end MIC_matrix(MIC_matrix>0.4) = 0; MIC_matrix(MIC_matrix~=0) = 1; inmodel = sum(MIC_matrix); threshold = sum(inmodel)/Dim; inmodel(inmodel <= threshold) = 0; inmodel(inmodel > threshold) = 1; model = libsvmtrain(train_L,train_F(:,inmodel)); [predict_label, ~, ~] = libsvmpredict(test_L,test_F(:,inmodel),model); error=0; for j=1:length(test_L) if(predict_label(j,1) ~= test_L(j,1)) error = error+1; end end error = error/length(test_L); |