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
32fec820
Unverified
Commit
32fec820
authored
May 18, 2021
by
Christian Lorentzen
Committed by
GitHub
May 18, 2021
Browse files
Replace division of exponential in Gamma loss (#4289)
parent
08c38efc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
src/objective/regression_objective.hpp
src/objective/regression_objective.hpp
+4
-4
No files found.
src/objective/regression_objective.hpp
View file @
32fec820
...
@@ -689,14 +689,14 @@ class RegressionGammaLoss : public RegressionPoissonLoss {
...
@@ -689,14 +689,14 @@ class RegressionGammaLoss : public RegressionPoissonLoss {
if
(
weights_
==
nullptr
)
{
if
(
weights_
==
nullptr
)
{
#pragma omp parallel for schedule(static)
#pragma omp parallel for schedule(static)
for
(
data_size_t
i
=
0
;
i
<
num_data_
;
++
i
)
{
for
(
data_size_t
i
=
0
;
i
<
num_data_
;
++
i
)
{
gradients
[
i
]
=
static_cast
<
score_t
>
(
1.0
-
label_
[
i
]
/
std
::
exp
(
score
[
i
]));
gradients
[
i
]
=
static_cast
<
score_t
>
(
1.0
-
label_
[
i
]
*
std
::
exp
(
-
score
[
i
]));
hessians
[
i
]
=
static_cast
<
score_t
>
(
label_
[
i
]
/
std
::
exp
(
score
[
i
]));
hessians
[
i
]
=
static_cast
<
score_t
>
(
label_
[
i
]
*
std
::
exp
(
-
score
[
i
]));
}
}
}
else
{
}
else
{
#pragma omp parallel for schedule(static)
#pragma omp parallel for schedule(static)
for
(
data_size_t
i
=
0
;
i
<
num_data_
;
++
i
)
{
for
(
data_size_t
i
=
0
;
i
<
num_data_
;
++
i
)
{
gradients
[
i
]
=
static_cast
<
score_t
>
(
1.0
-
label_
[
i
]
/
std
::
exp
(
score
[
i
])
*
weights_
[
i
]);
gradients
[
i
]
=
static_cast
<
score_t
>
(
1.0
-
label_
[
i
]
*
std
::
exp
(
-
score
[
i
])
*
weights_
[
i
]);
hessians
[
i
]
=
static_cast
<
score_t
>
(
label_
[
i
]
/
std
::
exp
(
score
[
i
])
*
weights_
[
i
]);
hessians
[
i
]
=
static_cast
<
score_t
>
(
label_
[
i
]
*
std
::
exp
(
-
score
[
i
])
*
weights_
[
i
]);
}
}
}
}
}
}
...
...
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