FitFailedWarning: Не удалось подобрать оценщик. ValueError: не удалось передать входной массив из формы (85,3) в форму (85,0) - PullRequest
0 голосов
/ 17 июня 2020

Я пытаюсь научиться работать с GridSearchCV. Однако я получаю сообщение об ошибке, как показано ниже. Может ли кто-нибудь помочь объяснить, почему я получаю ошибку и как ее решить? Спасибо !!!

rng = np.random.RandomState(1)
X = 10*rng.rand(100,3)
y = 0.5+ np.dot(X,[1.5,-2,1])

$GridSearchCV
poly_reg = make_pipeline(PolynomialFeatures(),LinearRegression())
param = {"polynomialfeatures__degree":np.arange(5),
         "polynomialfeatures__include_bias": [True,False],
         "linearregression__fit_intercept":[True,False],
        "linearregression__normalize": [True, False]}
grid_result = GridSearchCV(poly_reg,param_grid = param, cv = 7,error_score = np.nan)
grid_result.fit(X,y)
grid_result.best_params_

Ошибка

C:\Users\Petelindan\Anaconda3\lib\site-packages\sklearn\model_selection\_validation.py:536: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: 
ValueError: could not broadcast input array from shape (85,3) into shape (85,0)

  FitFailedWarning)
C:\Users\Petelindan\Anaconda3\lib\site-packages\sklearn\model_selection\_validation.py:536: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: 
ValueError: could not broadcast input array from shape (85,3) into shape (85,0)

  FitFailedWarning)
C:\Users\Petelindan\Anaconda3\lib\site-packages\sklearn\model_selection\_validation.py:536: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: 
ValueError: could not broadcast input array from shape (86,3) into shape (86,0)
...