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
46d4eecf
Commit
46d4eecf
authored
Jan 20, 2017
by
Guolin Ke
Committed by
GitHub
Jan 20, 2017
Browse files
change default sigmoid to 1.0f, slight improve binary accuracy
parent
d57118ba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
src/objective/binary_objective.hpp
src/objective/binary_objective.hpp
+4
-4
No files found.
src/objective/binary_objective.hpp
View file @
46d4eecf
...
@@ -67,10 +67,10 @@ public:
...
@@ -67,10 +67,10 @@ public:
const
int
label
=
label_val_
[
static_cast
<
int
>
(
label_
[
i
])];
const
int
label
=
label_val_
[
static_cast
<
int
>
(
label_
[
i
])];
const
double
label_weight
=
label_weights_
[
static_cast
<
int
>
(
label_
[
i
])];
const
double
label_weight
=
label_weights_
[
static_cast
<
int
>
(
label_
[
i
])];
// calculate gradients and hessians
// calculate gradients and hessians
const
double
response
=
-
2.0
f
*
label
*
sigmoid_
/
(
1.0
f
+
std
::
exp
(
2.0
f
*
label
*
sigmoid_
*
score
[
i
]));
const
double
response
=
-
label
*
sigmoid_
/
(
1.0
f
+
std
::
exp
(
label
*
sigmoid_
*
score
[
i
]));
const
double
abs_response
=
fabs
(
response
);
const
double
abs_response
=
fabs
(
response
);
gradients
[
i
]
=
static_cast
<
score_t
>
(
response
*
label_weight
);
gradients
[
i
]
=
static_cast
<
score_t
>
(
response
*
label_weight
);
hessians
[
i
]
=
static_cast
<
score_t
>
(
abs_response
*
(
2.0
f
*
sigmoid_
-
abs_response
)
*
label_weight
);
hessians
[
i
]
=
static_cast
<
score_t
>
(
abs_response
*
(
sigmoid_
-
abs_response
)
*
label_weight
);
}
}
}
else
{
}
else
{
#pragma omp parallel for schedule(static)
#pragma omp parallel for schedule(static)
...
@@ -79,10 +79,10 @@ public:
...
@@ -79,10 +79,10 @@ public:
const
int
label
=
label_val_
[
static_cast
<
int
>
(
label_
[
i
])];
const
int
label
=
label_val_
[
static_cast
<
int
>
(
label_
[
i
])];
const
double
label_weight
=
label_weights_
[
static_cast
<
int
>
(
label_
[
i
])];
const
double
label_weight
=
label_weights_
[
static_cast
<
int
>
(
label_
[
i
])];
// calculate gradients and hessians
// calculate gradients and hessians
const
double
response
=
-
2.0
f
*
label
*
sigmoid_
/
(
1.0
f
+
std
::
exp
(
2.0
f
*
label
*
sigmoid_
*
score
[
i
]));
const
double
response
=
-
label
*
sigmoid_
/
(
1.0
f
+
std
::
exp
(
label
*
sigmoid_
*
score
[
i
]));
const
double
abs_response
=
fabs
(
response
);
const
double
abs_response
=
fabs
(
response
);
gradients
[
i
]
=
static_cast
<
score_t
>
(
response
*
label_weight
*
weights_
[
i
]);
gradients
[
i
]
=
static_cast
<
score_t
>
(
response
*
label_weight
*
weights_
[
i
]);
hessians
[
i
]
=
static_cast
<
score_t
>
(
abs_response
*
(
2.0
f
*
sigmoid_
-
abs_response
)
*
label_weight
*
weights_
[
i
]);
hessians
[
i
]
=
static_cast
<
score_t
>
(
abs_response
*
(
sigmoid_
-
abs_response
)
*
label_weight
*
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