Why don't the rank match the weight for a given index?!

3 次查看(过去 30 天)
[ranks,weights] = relieff(features_mat',Y,10);
figure
bar(weights(ranks))
disp(weights)
disp(ranks)
xlabel('Predictor rank')
ylabel('Predictor importance weight')
ranks is
[7,6,5,8,4,1,3,2]
weights is
[0.0074, -0.0098, -0.0079, 0.0206, 0.1037, 0.1869, 0.339, 0.0970]
my question here is how is it possible that the weights aren't in contrast with rank like
0.339 is ranked fisrt but the matching value is
3 ?!
another question how can i plot the weight with the name of the features assuming the features name is
{'A', 'B','C','D','E','F','G','H'};

回答(1 个)

Walter Roberson
Walter Roberson 2018-7-24
Observe that
[maxweight, maxidx] = max(weights);
ranks(maxidx)
would give 3. That is, the largest weight is in offset 7 of weights, and in offset 7 of your ranks matrix you have stored 3.
To phrase this a different way: the weights are returned in the same order as the columns, and ranks tells you which order is the most important. You will probably find that
[~, sortorder] = sort(weights);
that sortorder and ranks is the same.
When I look at the code, I see that this is not exactly the case. The code checks to see if all of the values in a column are essentially the same, and if so then it rejects the column. The rejected columns will be listed in the ranks output after all of the accepted columns, in numeric column order.
  1 个评论
Elias Unk
Elias Unk 2018-7-24
I see can you also check the second part of my question which is plotting the weight and name.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by