I once saw the following code segment of using lasso model based on scikit-learn

lasso = LassoCV(normalize = True, max_iter=2000)
lasso.fit(X_train, y_train);
lasso.score(X_test, y_test)

y_pred = lasso.predict(X_test)

I can understand lasso.fit and lasso_predict, but what does lasso.score generally offer? According to the scikit-learn, it Returns the coefficient of determination R^2 of the prediction. I am not quite clear how to use this kind of information?


1 Answer 1


R^2 is a statistical measure of how close the data are to the fitted regression line. It does this by seeing percentage of the variance of dependent varible that's explained by independent variable.

To know more about R^2 score refer this video.

So, basically it is a metric to see how well model fits the data but it is not adequate.

Refer this discussion on why R^2 score is not good for Lasso.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.