def cross_val_score(estimator,X,y,scoring,cv):
scores=cross_val_score
scores_rmse=np.sqrt(-scores)
print('Scores: ',scores_rmse)
print("Mean:", scores_rmse.mean())
print("Standard deviation:", scores_rmse.std())
This is the def I created and passed to below
cross_val_score(SGDRegressor,X_train,y_train,scoring='neg_mean_squared_error',cv=5)
I am getting below error...
ValueError Traceback (most recent call last)
<ipython-input-181-275d240df219> in <module>()
----> 1 plot_validation_curve(lin_reg_SGD,X_train,y_train,'alpha', [0.001,0.01],scoring='neg_mean_squared_error',cv=5)
3 frames
/usr/local/lib/python3.6/dist-packages/sklearn/utils/validation.py in check_consistent_length(*arrays)
203 if len(uniques) > 1:
204 raise ValueError("Found input variables with inconsistent numbers of"
--> 205 " samples: %r" % [int(l) for l in lengths])
206
207
ValueError: Found input variables with inconsistent numbers of samples: [13903, 13903, 22]
SEARCH STACK OVERFLOW