Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
46a20ab0
Unverified
Commit
46a20ab0
authored
Apr 01, 2021
by
jmoralez
Committed by
GitHub
Apr 01, 2021
Browse files
use dy_true mean in denominator for r2_score (#4151)
parent
1ce4b22b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
tests/python_package_test/test_dask.py
tests/python_package_test/test_dask.py
+1
-1
No files found.
tests/python_package_test/test_dask.py
View file @
46a20ab0
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment