Python ValueError:error_score必须是字符串';提高';或一个数值。(提示:如果使用';raise';,请确保拼写正确。)

Python ValueError:error_score必须是字符串';提高';或一个数值。(提示:如果使用';raise';,请确保拼写正确。),python,scikit-learn,decision-tree,Python,Scikit Learn,Decision Tree,我正在用Python进行决策树回归 出现了一个奇怪的错误: ValueError: error_score must be the string 'raise' or a numeric value. (Hint: if using 'raise', please make sure that it has been spelled correctly.) 我的数据框大约有330000*91列 我的代码如下所示: # Read data y = my_train2.iloc[:,0] x =

我正在用Python进行决策树回归

出现了一个奇怪的错误:

ValueError: error_score must be the string 'raise' or a numeric value. (Hint: if using 'raise', please make sure that it has been spelled correctly.)
我的数据框大约有330000*91列

我的代码如下所示:

# Read data
y = my_train2.iloc[:,0]
x = my_train2.iloc[:, 1:93]

(x_train, x_test, y_train, y_test) = cv.train_test_split(x, y, test_size=.20)
# Instantiate dt
dt = DecisionTreeRegressor(# max_depth = 8,
                       min_samples_leaf = 1,
                       random_state = 1)

# Fit dt to the training set
dt.fit(x_train, y_train)
下面的块给出了一个错误

from sklearn.model_selection import cross_val_score
# Compute the array containing the 10-folds CV MSEs
MSE_CV_scores = - cross_val_score(dt, x_train, y_train, cv=10, 
                              scoring='neg_mean_squared_error', 
                              n_jobs=-1) 

# Compute the 10-folds CV RMSE
RMSE_CV = (MSE_CV_scores.mean())**(1/2)

# Print RMSE_CV
print('CV RMSE: {:.2f}'.format(RMSE_CV))
如果需要,我可以在这里打印每列的类


谢谢

可能与您的scikit learn版本有关。我猜这个错误出现在0.22。大概将其降级至0.21并重试

可能与您的scikit learn版本有关。我猜这个错误出现在0.22。大概将其降级为0.21,然后重试