Search code examples
pythonscikit-learnlinear-regressionpipeline

Scoring method of make_pipeline scikit-learn function


What is the scoring method used by the make_pipeline function in scikit learn? If it's linear regression, is it simply R2?

I seem to be getting the same score when i do pipe.score(X_test, y_test) and r2_score(y_test, y_pred)


Solution

  • make_pipeline returns a Pipeline instance. Pipeline.score delegates to the final step's score method. That then is up to the final estimator, but generally speaking in sklearn, classifiers use accuracy_score and regressors use r2_score.