For a classification problem with numerical predictors and a categorical multi-class response I am trying to use Recursive Feature Elimination with Random Forests to identfy relevant features out of a data set.

I am using scikit-learn for this purpose, which usually required target variables to be either integer for ordinal categories or one hot encoded for non-ordinal categorical classes. The fit() method for both RFE and RFECV in scikit-learn however accepts only integer target variables.

Encoding my classes with integers is not a problem but I am unsure if this is correct. Can I use a integer encoded target for a non-ordinal classification problem? Or could this cause problems because the model is using the order of classes that is artificially created?


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.