0
$\begingroup$

I try to classify texts which I have converted to term-document matrices before. I would like to perform feature selection to reduce the number of predictors. In Python, you can do this by means of the SelectKBest function, for example like so:

selector = SelectKBest(f_classif, k = 2000)

The caret package from R also enables you to employ univariate feature selection; the tutorial section "Feature Selection using Univariate Filters" details the general approach here (https://topepo.github.io/caret/feature-selection-using-univariate-filters.html).

However, I do not understand this sufficiently to be able to build a Chi2 / f_classif feature selection on my own - how can this be achieved?

$\endgroup$

Your Answer

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

Browse other questions tagged or ask your own question.