scikit learn r2 score code example Example: scikit learn r2 score from sklearn.metrics import r2_score r2_score(y_true, y_pred)