Skip to content

Commit 6f7e351

Browse files
committed
residual sum of squares should be computed by summing the squared differences instead of taking the mean.
1 parent f63ac6e commit 6f7e351

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/linear_model/plot_ols.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
print('Coefficients: \n', regr.coef_)
5353
# The mean square error
5454
print("Residual sum of squares: %.2f"
55-
% np.mean((regr.predict(diabetes_X_test) - diabetes_y_test) ** 2))
55+
% np.sum((regr.predict(diabetes_X_test) - diabetes_y_test) ** 2))
5656
# Explained variance score: 1 is perfect prediction
5757
print('Variance score: %.2f' % regr.score(diabetes_X_test, diabetes_y_test))
5858

0 commit comments

Comments
 (0)