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
3586673a
Commit
3586673a
authored
Nov 14, 2016
by
Guolin Ke
Browse files
clean code
parent
2a5d7abe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
6 deletions
+3
-6
src/io/bin.cpp
src/io/bin.cpp
+3
-6
No files found.
src/io/bin.cpp
View file @
3586673a
...
@@ -96,10 +96,7 @@ void BinMapper::FindBin(std::vector<double>* values, size_t total_sample_cnt, in
...
@@ -96,10 +96,7 @@ void BinMapper::FindBin(std::vector<double>* values, size_t total_sample_cnt, in
}
else
{
}
else
{
// mean size for one bin
// mean size for one bin
double
mean_bin_size
=
sample_size
/
static_cast
<
double
>
(
max_bin
);
double
mean_bin_size
=
sample_size
/
static_cast
<
double
>
(
max_bin
);
std
::
vector
<
bool
>
is_big_count_value
(
num_values
,
false
);
double
static_mean_bin_size
=
mean_bin_size
;
for
(
int
i
=
0
;
i
<
num_values
;
++
i
)
{
if
(
counts
[
i
]
>=
mean_bin_size
)
{
is_big_count_value
[
i
]
=
true
;
}
}
std
::
vector
<
double
>
upper_bounds
(
max_bin
,
std
::
numeric_limits
<
double
>::
infinity
());
std
::
vector
<
double
>
upper_bounds
(
max_bin
,
std
::
numeric_limits
<
double
>::
infinity
());
std
::
vector
<
double
>
lower_bounds
(
max_bin
,
std
::
numeric_limits
<
double
>::
infinity
());
std
::
vector
<
double
>
lower_bounds
(
max_bin
,
std
::
numeric_limits
<
double
>::
infinity
());
...
@@ -111,8 +108,8 @@ void BinMapper::FindBin(std::vector<double>* values, size_t total_sample_cnt, in
...
@@ -111,8 +108,8 @@ void BinMapper::FindBin(std::vector<double>* values, size_t total_sample_cnt, in
rest_sample_cnt
-=
counts
[
i
];
rest_sample_cnt
-=
counts
[
i
];
cur_cnt_inbin
+=
counts
[
i
];
cur_cnt_inbin
+=
counts
[
i
];
// need a new bin
// need a new bin
if
(
is_big_count_value
[
i
]
||
cur_cnt_inbin
>=
mean_bin_size
||
if
(
counts
[
i
]
>=
static_mean_bin_size
||
cur_cnt_inbin
>=
mean_bin_size
||
(
is_big_count_value
[
i
+
1
]
&&
cur_cnt_inbin
>=
std
::
max
(
1.0
,
mean_bin_size
*
0.5
f
)))
{
(
counts
[
i
+
1
]
>=
static_mean_bin_size
&&
cur_cnt_inbin
>=
std
::
max
(
1.0
,
mean_bin_size
*
0.5
f
)))
{
upper_bounds
[
bin_cnt
]
=
distinct_values
[
i
];
upper_bounds
[
bin_cnt
]
=
distinct_values
[
i
];
if
(
bin_cnt
==
0
)
{
if
(
bin_cnt
==
0
)
{
cnt_in_bin0
=
cur_cnt_inbin
;
cnt_in_bin0
=
cur_cnt_inbin
;
...
...
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