2
$\begingroup$

I selected features using ANOVA (because I have Numerical data as input and Categorical data as target):

anova = SelectKBest(score_func=f_classif, k='all')
anova.fit(X_train, y_train.values.argmax(1)) # y_train.values.argmax(1) because I already one-hot-encoded the target.

When I plot the score, it show me the figure in image :

plt.xlabel("Number of features selected")
plt.ylabel("Score (nb of correct classifications)")
plt.plot(range(len(anova.scores_)), anova1.scores_)
plt.show()

enter image description here

What does the interpretation of this figure ? why there is some interruption in the plot ?

$\endgroup$
4
  • 1
    $\begingroup$ What do you mean that you’ve selected features using ANOVA? $\endgroup$ – Dave Jun 19 at 13:20
  • $\begingroup$ ANOVA is a Feature Selection method, right ? $\endgroup$ – Mimi Jun 19 at 13:27
  • 1
    $\begingroup$ ANOVA is a way of testing of multiple groups have the same mean. How do you apply that to feature selection? (I have my ideas, but all that matters is what you did.) $\endgroup$ – Dave Jun 19 at 13:29
  • $\begingroup$ Dear @Dave Thank you for this information, you could see what I mean by using this method in this link: machinelearningmastery.com/… $\endgroup$ – Mimi Jun 19 at 13:45
2
$\begingroup$

You have misunderstood what the anova returns. It returns a list of importance for each feature.

So, it is not number of features selected but should be index of each feature in the plot. Thus the confusion clears up.

The plot shows that, for example, 45th feature and 65th feature are more important.

Reference:

  1. SelectKBest
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.