Unable to give custom input to RandomForest ML model

  Kiến thức lập trình

I am currently working with RandomForestClassifier on a classification model, I learned the algorithms on my own from YouTube so I am kind of having hard time working on the project, so I designed the model and also tested it on the test set that I separated from the original dataset, and I also got an accuracy of 96%. The thing is when I try to give a custom input I am encountering an error saying the array you gave is 1D and the model needs a 2D array as input.

I tried using “custom_input_2d = custom_input.reshape(1, -1)” to convert the input to a 2D array, but then a new error popped up saying: “Found input variables with inconsistent numbers of samples: [528, 1]”. What do I do, the input I gave is: [[ 21.008297 0. 1.723587 131.92972 2. 1.
3. 3. 0. 0. 1.683448 1.
1. 2. 3. ]]. The model takes input of 15 features, please help me out, in which format do I need to give the model an input, if possible please give a custom input as an example.

New contributor

user24693584 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT