Skip to content

Commit

Permalink
renamed tmp_num_sample_values to non_na_cnt (#5521)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhuyi Xue authored Oct 11, 2022
1 parent 45dd49e commit c5391c9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/io/bin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,25 +327,25 @@ namespace LightGBM {
bool use_missing, bool zero_as_missing,
const std::vector<double>& forced_upper_bounds) {
int na_cnt = 0;
int tmp_num_sample_values = 0;
int non_na_cnt = 0;
for (int i = 0; i < num_sample_values; ++i) {
if (!std::isnan(values[i])) {
values[tmp_num_sample_values++] = values[i];
values[non_na_cnt++] = values[i];
}
}
if (!use_missing) {
missing_type_ = MissingType::None;
} else if (zero_as_missing) {
missing_type_ = MissingType::Zero;
} else {
if (tmp_num_sample_values == num_sample_values) {
if (non_na_cnt == num_sample_values) {
missing_type_ = MissingType::None;
} else {
missing_type_ = MissingType::NaN;
na_cnt = num_sample_values - tmp_num_sample_values;
na_cnt = num_sample_values - non_na_cnt;
}
}
num_sample_values = tmp_num_sample_values;
num_sample_values = non_na_cnt;

bin_type_ = bin_type;
default_bin_ = 0;
Expand Down

0 comments on commit c5391c9

Please sign in to comment.