Commit da59fd22 authored by Guolin Ke's avatar Guolin Ke
Browse files

fix warning

parent 68bc8a61
...@@ -129,13 +129,12 @@ public: ...@@ -129,13 +129,12 @@ public:
} }
/*! /*!
* \brief Construct feature value to bin mapper according feature values * \brief Construct feature value to bin mapper according feature values
* \param column_name name of this column
* \param values (Sampled) values of this feature, Note: not include zero. * \param values (Sampled) values of this feature, Note: not include zero.
* \param total_sample_cnt number of total sample count, equal with values.size() + num_zeros * \param total_sample_cnt number of total sample count, equal with values.size() + num_zeros
* \param max_bin The maximal number of bin * \param max_bin The maximal number of bin
* \param bin_type Type of this bin * \param bin_type Type of this bin
*/ */
void FindBin(const std::string& column_name, std::vector<double>* values, size_t total_sample_cnt, int max_bin, BinType bin_type); void FindBin(std::vector<double>* values, size_t total_sample_cnt, int max_bin, BinType bin_type);
/*! /*!
* \brief Use specific number of bin to calculate the size of this class * \brief Use specific number of bin to calculate the size of this class
......
...@@ -43,7 +43,7 @@ BinMapper::~BinMapper() { ...@@ -43,7 +43,7 @@ BinMapper::~BinMapper() {
} }
void BinMapper::FindBin(const std::string& column_name, std::vector<double>* values, size_t total_sample_cnt, int max_bin, BinType bin_type) { void BinMapper::FindBin(std::vector<double>* values, size_t total_sample_cnt, int max_bin, BinType bin_type) {
bin_type_ = bin_type; bin_type_ = bin_type;
std::vector<double>& ref_values = (*values); std::vector<double>& ref_values = (*values);
size_t sample_size = total_sample_cnt; size_t sample_size = total_sample_cnt;
...@@ -89,7 +89,6 @@ void BinMapper::FindBin(const std::string& column_name, std::vector<double>* val ...@@ -89,7 +89,6 @@ void BinMapper::FindBin(const std::string& column_name, std::vector<double>* val
max_val_ = distinct_values.back(); max_val_ = distinct_values.back();
std::vector<int> cnt_in_bin; std::vector<int> cnt_in_bin;
int num_values = static_cast<int>(distinct_values.size()); int num_values = static_cast<int>(distinct_values.size());
int cnt_in_bin0 = 0;
if (bin_type_ == BinType::NumericalBin) { if (bin_type_ == BinType::NumericalBin) {
if (num_values <= max_bin) { if (num_values <= max_bin) {
std::sort(distinct_values.begin(), distinct_values.end()); std::sort(distinct_values.begin(), distinct_values.end());
...@@ -142,7 +141,6 @@ void BinMapper::FindBin(const std::string& column_name, std::vector<double>* val ...@@ -142,7 +141,6 @@ void BinMapper::FindBin(const std::string& column_name, std::vector<double>* val
} }
} }
} }
//
++bin_cnt; ++bin_cnt;
// update bin upper bound // update bin upper bound
bin_upper_bound_ = std::vector<double>(bin_cnt); bin_upper_bound_ = std::vector<double>(bin_cnt);
......
...@@ -448,7 +448,7 @@ Dataset* DatasetLoader::CostructFromSampleData(std::vector<std::vector<double>>& ...@@ -448,7 +448,7 @@ Dataset* DatasetLoader::CostructFromSampleData(std::vector<std::vector<double>>&
if (categorical_features_.count(i)) { if (categorical_features_.count(i)) {
bin_type = BinType::CategoricalBin; bin_type = BinType::CategoricalBin;
} }
bin_mappers[i]->FindBin(feature_names_[i], &sample_values[i], total_sample_size, io_config_.max_bin, bin_type); bin_mappers[i]->FindBin(&sample_values[i], total_sample_size, io_config_.max_bin, bin_type);
} }
auto dataset = std::unique_ptr<Dataset>(new Dataset()); auto dataset = std::unique_ptr<Dataset>(new Dataset());
...@@ -668,7 +668,7 @@ void DatasetLoader::ConstructBinMappersFromTextData(int rank, int num_machines, ...@@ -668,7 +668,7 @@ void DatasetLoader::ConstructBinMappersFromTextData(int rank, int num_machines,
if (categorical_features_.count(i)) { if (categorical_features_.count(i)) {
bin_type = BinType::CategoricalBin; bin_type = BinType::CategoricalBin;
} }
bin_mappers[i]->FindBin(feature_names_[i], &sample_values[i], sample_data.size(), io_config_.max_bin, bin_type); bin_mappers[i]->FindBin(&sample_values[i], sample_data.size(), io_config_.max_bin, bin_type);
} }
for (size_t i = 0; i < sample_values.size(); ++i) { for (size_t i = 0; i < sample_values.size(); ++i) {
...@@ -722,7 +722,7 @@ void DatasetLoader::ConstructBinMappersFromTextData(int rank, int num_machines, ...@@ -722,7 +722,7 @@ void DatasetLoader::ConstructBinMappersFromTextData(int rank, int num_machines,
if (categorical_features_.count(start[rank] + i)) { if (categorical_features_.count(start[rank] + i)) {
bin_type = BinType::CategoricalBin; bin_type = BinType::CategoricalBin;
} }
bin_mapper.FindBin(feature_names_[start[rank] + i], &sample_values[start[rank] + i], sample_data.size(), io_config_.max_bin, bin_type); bin_mapper.FindBin(&sample_values[start[rank] + i], sample_data.size(), io_config_.max_bin, bin_type);
bin_mapper.CopyTo(input_buffer.data() + i * type_size); bin_mapper.CopyTo(input_buffer.data() + i * type_size);
} }
// convert to binary size // convert to binary size
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment