Reputation: 19
I am running a Ridge regression in a Jupyter notebook, which I attach here.
ridge = Ridge(alpha=optimal_ridge.alpha_)
ridge_scores = cross_val_score(ridge, Xs, y, cv=10)
print(ridge_scores)
print(np.mean(ridge_scores))`
When applying the funcion cross_val_score to my estimator, what metric does it give me? I obtain 10 values lower than 1 (that come from the cross validation), which are:
[0.90397003 0.88391849 0.77181566 0.85037008 0.85705655 0.88257961
0.9114154 0.91447498 0.93543431 0.93167352]
Thank you!
Upvotes: 1
Views: 1591
Reputation: 4602
According to the docs, it uses "the estimator’s default scorer (if available)". In your case, the estimator is Ridge and its score
function returns "the coefficient of determination R^2 of the prediction" as stated in its docs.
Also, you can define your own scoring function and pass it to cross_val_score
as a parameter (docs):
def your_scorer(estimator, X, y):
...
cross_val_score(ridge, Xs, y, cv=10, scoring=your_scorer)
Upvotes: 1