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

1 visualización (últimos 30 días)
Elias Unk
Elias Unk el 24 de Jul. de 2018
Comentada: Elias Unk el 24 de Jul. de 2018
[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'};

Respuestas (1)

Walter Roberson
Walter Roberson el 24 de Jul. de 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.
  1 comentario
Elias Unk
Elias Unk el 24 de Jul. de 2018
I see can you also check the second part of my question which is plotting the weight and name.

Iniciar sesión para comentar.

Categorías

Más información sobre Data Distribution Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by