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
- Measure accuracy
- Get precision, recall and F1
- See where the model is wrong
- Cross-validate
- Tune hyperparameters
- See which features matter
All evaluation and tuning commands · scikit-learn 1 cheatsheet