scikit-learn 1 · Evaluation and tuning

Evaluate a regression model

Report error in the target's own units and the share of variance explained.

from sklearn.metrics import mean_squared_error, r2_score

rmse = mean_squared_error(y_test, reg.predict(X_test)) ** 0.5
print(rmse, r2_score(y_test, reg.predict(X_test)))

Official scikit-learn 1 documentation

More evaluation and tuning commands

All evaluation and tuning commands · scikit-learn 1 cheatsheet

Was this page helpful?