Skip to content

Commit

Permalink
use dy_true mean in denominator for r2_score (#4151)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoralez authored Apr 1, 2021
1 parent 1ce4b22 commit 46a20ab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/python_package_test/test_dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def _create_data(objective, n_samples=1_000, output='array', chunk_size=500, **k

def _r2_score(dy_true, dy_pred):
numerator = ((dy_true - dy_pred) ** 2).sum(axis=0, dtype=np.float64)
denominator = ((dy_true - dy_pred.mean(axis=0)) ** 2).sum(axis=0, dtype=np.float64)
denominator = ((dy_true - dy_true.mean(axis=0)) ** 2).sum(axis=0, dtype=np.float64)
return (1 - numerator / denominator).compute()


Expand Down

0 comments on commit 46a20ab

Please sign in to comment.