"...git@developer.sourcefind.cn:tianlh/lightgbm-dcu.git" did not exist on "3089f0bb86a8d84e3731aed8b9fe429762af2afb"
Unverified Commit 46a20ab0 authored by jmoralez's avatar jmoralez Committed by GitHub
Browse files

use dy_true mean in denominator for r2_score (#4151)

parent 1ce4b22b
...@@ -198,7 +198,7 @@ def _create_data(objective, n_samples=1_000, output='array', chunk_size=500, **k ...@@ -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): def _r2_score(dy_true, dy_pred):
numerator = ((dy_true - dy_pred) ** 2).sum(axis=0, dtype=np.float64) 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() return (1 - numerator / denominator).compute()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment