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

1 回表示 (過去 30 日間)
Elias Unk
Elias Unk 2018 年 7 月 24 日
コメント済み: Elias Unk 2018 年 7 月 24 日
[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 Center および File ExchangeData Distribution Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by