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
b5e211ba
Commit
b5e211ba
authored
Aug 30, 2017
by
Guolin Ke
Browse files
check edge case for bin finder.
parent
f98b8310
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
src/io/bin.cpp
src/io/bin.cpp
+3
-0
No files found.
src/io/bin.cpp
View file @
b5e211ba
...
...
@@ -72,6 +72,7 @@ namespace LightGBM {
std
::
vector
<
double
>
GreedyFindBin
(
const
double
*
distinct_values
,
const
int
*
counts
,
int
num_distinct_values
,
int
max_bin
,
size_t
total_cnt
,
int
min_data_in_bin
)
{
std
::
vector
<
double
>
bin_upper_bound
;
CHECK
(
max_bin
>
0
);
if
(
num_distinct_values
<=
max_bin
)
{
bin_upper_bound
.
clear
();
int
cur_cnt_inbin
=
0
;
...
...
@@ -170,6 +171,7 @@ namespace LightGBM {
if
(
left_cnt
>
0
)
{
int
left_max_bin
=
static_cast
<
int
>
(
static_cast
<
double
>
(
left_cnt_data
)
/
(
total_sample_cnt
-
cnt_zero
)
*
(
max_bin
-
1
));
left_max_bin
=
std
::
max
(
1
,
left_max_bin
);
bin_upper_bound
=
GreedyFindBin
(
distinct_values
,
counts
,
left_cnt
,
left_max_bin
,
left_cnt_data
,
min_data_in_bin
);
bin_upper_bound
.
back
()
=
-
kZeroAsMissingValueRange
;
}
...
...
@@ -184,6 +186,7 @@ namespace LightGBM {
if
(
right_start
>=
0
)
{
int
right_max_bin
=
max_bin
-
1
-
static_cast
<
int
>
(
bin_upper_bound
.
size
());
CHECK
(
right_max_bin
>
0
);
auto
right_bounds
=
GreedyFindBin
(
distinct_values
+
right_start
,
counts
+
right_start
,
num_distinct_values
-
right_start
,
right_max_bin
,
right_cnt_data
,
min_data_in_bin
);
bin_upper_bound
.
push_back
(
kZeroAsMissingValueRange
);
...
...
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