I need to fit RandomForestRegressor
from sklearn.ensemble
.
forest = ensemble.RandomForestRegressor(**RF_tuned_parameters)
model = fo
I had the same problem. The problem was that the labels were in a column format while it expected it in a row.
use np.ravel()
knn.score(training_set, np.ravel(training_labels))
Hope this solves it.
Change this line:
model = forest.fit(train_fold, train_y)
to:
model = forest.fit(train_fold, train_y.values.ravel())
Edit:
.values
will give the values in an array. (shape: (n,1)
.ravel
will convert that array shape to (n, )