I am trying to run the scikit-learn
tool GridSearchCV
, but the following code
from sklearn.ensemble import AdaBoostRegressor
from sklearn.datasets import make_regression
from sklearn.model_selection import GridSearchCV
X, y = make_regression(
n_features=5, n_informative=3, n_samples=200)
params = {'n_estimators': range(1, 100),
'learning_rate': [.01, .1, .2, .5, .7, .9, .99, 1]}
optRegressor = GridSearchCV(
AdaBoostRegressor(), params,
scoring = 'accuracy', cv = 5, n_jobs = -1, verbose=3)
optRegressor.fit(X, y)
returns
ValueError: continuous is not supported
This question has a similar problem, but the answer is to convert pandas dataframes to numpy arrays. I am already using numpy arrays, so this does not apply.
The problem in this other question is linked to the score used. But the documentation states, regarding the scoring
parameter that
If None, the estimator’s score method is used.
So the scoring method used should be, by default in this case, the AdaBoostRegressor.score
. This scoring method is obviously a regression score, so that solution doesn't work either.
How can I run the GridSearchCV on this example?