Why don't the rank match the weight for a given index?!
1 view (last 30 days)
Show older comments
[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'};
0 Comments
Answers (1)
Walter Roberson
on 24 Jul 2018
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.
See Also
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!