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
1c92e75d
Commit
1c92e75d
authored
Jul 28, 2017
by
Guolin Ke
Committed by
GitHub
Jul 28, 2017
Browse files
Fatal if set is_unbalance and scale_pos_weight at the same time
parent
eb52262b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
src/objective/binary_objective.hpp
src/objective/binary_objective.hpp
+4
-1
No files found.
src/objective/binary_objective.hpp
View file @
1c92e75d
...
...
@@ -13,12 +13,15 @@ namespace LightGBM {
class
BinaryLogloss
:
public
ObjectiveFunction
{
public:
explicit
BinaryLogloss
(
const
ObjectiveConfig
&
config
,
std
::
function
<
bool
(
float
)
>
is_pos
=
nullptr
)
{
is_unbalance_
=
config
.
is_unbalance
;
sigmoid_
=
static_cast
<
double
>
(
config
.
sigmoid
);
if
(
sigmoid_
<=
0.0
)
{
Log
::
Fatal
(
"Sigmoid parameter %f should be greater than zero"
,
sigmoid_
);
}
is_unbalance_
=
config
.
is_unbalance
;
scale_pos_weight_
=
static_cast
<
double
>
(
config
.
scale_pos_weight
);
if
(
is_unbalance_
&&
std
::
fabs
(
scale_pos_weight_
-
1.0
f
)
>
1e-6
)
{
Log
::
Fatal
(
"Cannot set is_unbalance and scale_pos_weight at the same time."
);
}
is_pos_
=
is_pos
;
if
(
is_pos_
==
nullptr
)
{
is_pos_
=
[](
float
label
)
{
return
label
>
0
;
};
...
...
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