1
$\begingroup$

ValueError: Number of features of the model must match the input. Model n_features is 2 and input n_features is 7.

I have the following error: I have not used any type of encoding(like one-hot etc.) I just trained the model with 7 given features. Now when I want to do prediction like classifier.predict([[1,2,3,4,5,6,7]]) I have an error that 2 inputs are expected. But how do I know which exactly features Random Forest expects as inputs?

$\endgroup$
1
  • 1
    $\begingroup$ please post your code.. $\endgroup$ – Nikos M. Jun 1 at 18:16
0
$\begingroup$

Please post your code and take a look before in the documentation of random forests, https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html.

$\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.