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 CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by