Commit 90127b52 authored by Nikita Titov's avatar Nikita Titov Committed by Guolin Ke
Browse files

cpplint whitespaces and new lines (#1986)

parent 6f548ada
...@@ -7,13 +7,13 @@ ...@@ -7,13 +7,13 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
namespace LightGBM{ namespace LightGBM {
/*! /*!
* \brief An interface for writing files from buffers * \brief An interface for writing files from buffers
*/ */
struct VirtualFileWriter { struct VirtualFileWriter {
virtual ~VirtualFileWriter() {}; virtual ~VirtualFileWriter() {}
/*! /*!
* \brief Initialize the writer * \brief Initialize the writer
* \return True when the file is available for writes * \return True when the file is available for writes
...@@ -48,7 +48,7 @@ struct VirtualFileReader { ...@@ -48,7 +48,7 @@ struct VirtualFileReader {
* \brief Constructor * \brief Constructor
* \param filename Filename of the data * \param filename Filename of the data
*/ */
virtual ~VirtualFileReader() {}; virtual ~VirtualFileReader() {}
/*! /*!
* \brief Initialize the reader * \brief Initialize the reader
* \return True when the file is available for read * \return True when the file is available for read
......
...@@ -84,7 +84,6 @@ public: ...@@ -84,7 +84,6 @@ public:
} }
private: private:
static void Write(LogLevel level, const char* level_str, const char *format, va_list val) { static void Write(LogLevel level, const char* level_str, const char *format, va_list val) {
if (level <= GetLevel()) { // omit the message with low level if (level <= GetLevel()) { // omit the message with low level
// write to STDOUT // write to STDOUT
...@@ -98,7 +97,6 @@ private: ...@@ -98,7 +97,6 @@ private:
// a trick to use static variable in header file. // a trick to use static variable in header file.
// May be not good, but avoid to use an additional cpp file // May be not good, but avoid to use an additional cpp file
static LogLevel& GetLevel() { static THREAD_LOCAL LogLevel level = LogLevel::Info; return level; } static LogLevel& GetLevel() { static THREAD_LOCAL LogLevel level = LogLevel::Info; return level; }
}; };
} // namespace LightGBM } // namespace LightGBM
......
...@@ -38,7 +38,6 @@ private: ...@@ -38,7 +38,6 @@ private:
#define OMP_INIT_EX() ThreadExceptionHelper omp_except_helper #define OMP_INIT_EX() ThreadExceptionHelper omp_except_helper
#define OMP_LOOP_EX_BEGIN() try { #define OMP_LOOP_EX_BEGIN() try {
#define OMP_LOOP_EX_END() } \ #define OMP_LOOP_EX_END() } \
catch(std::exception& ex) { Log::Warning(ex.what()); omp_except_helper.CaptureException(); } \ catch(std::exception& ex) { Log::Warning(ex.what()); omp_except_helper.CaptureException(); } \
catch(...) { omp_except_helper.CaptureException(); } catch(...) { omp_except_helper.CaptureException(); }
...@@ -47,7 +46,7 @@ catch(...) { omp_except_helper.CaptureException(); } ...@@ -47,7 +46,7 @@ catch(...) { omp_except_helper.CaptureException(); }
#else #else
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning( disable : 4068 ) // disable unknown pragma warning #pragma warning(disable: 4068) // disable unknown pragma warning
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <vector> #include <vector>
#include "file_io.h" #include "file_io.h"
namespace LightGBM{ namespace LightGBM {
/*! /*!
* \brief A pipeline file reader, use 2 threads, one read block from file, the other process the block * \brief A pipeline file reader, use 2 threads, one read block from file, the other process the block
...@@ -24,13 +24,13 @@ public: ...@@ -24,13 +24,13 @@ public:
* \param filename Filename of data * \param filename Filename of data
* \process_fun Process function * \process_fun Process function
*/ */
static size_t Read(const char* filename, int skip_bytes, const std::function<size_t (const char*, size_t)>& process_fun) { static size_t Read(const char* filename, int skip_bytes, const std::function<size_t(const char*, size_t)>& process_fun) {
auto reader = VirtualFileReader::Make(filename); auto reader = VirtualFileReader::Make(filename);
if (!reader->Init()) { if (!reader->Init()) {
return 0; return 0;
} }
size_t cnt = 0; size_t cnt = 0;
const size_t buffer_size = 16 * 1024 * 1024 ; const size_t buffer_size = 16 * 1024 * 1024;
// buffer used for the process_fun // buffer used for the process_fun
auto buffer_process = std::vector<char>(buffer_size); auto buffer_process = std::vector<char>(buffer_size);
// buffer used for the file reading // buffer used for the file reading
...@@ -49,8 +49,7 @@ public: ...@@ -49,8 +49,7 @@ public:
std::thread read_worker = std::thread( std::thread read_worker = std::thread(
[&] { [&] {
last_read_cnt = reader->Read(buffer_read.data(), buffer_size); last_read_cnt = reader->Read(buffer_read.data(), buffer_size);
} });
);
// start process // start process
cnt += process_fun(buffer_process.data(), read_cnt); cnt += process_fun(buffer_process.data(), read_cnt);
// wait for read thread // wait for read thread
...@@ -61,7 +60,6 @@ public: ...@@ -61,7 +60,6 @@ public:
} }
return cnt; return cnt;
} }
}; };
} // namespace LightGBM } // namespace LightGBM
......
...@@ -93,6 +93,7 @@ public: ...@@ -93,6 +93,7 @@ public:
} }
return ret; return ret;
} }
private: private:
inline int RandInt16() { inline int RandInt16() {
x = (214013 * x + 2531011); x = (214013 * x + 2531011);
......
...@@ -26,7 +26,7 @@ public: ...@@ -26,7 +26,7 @@ public:
* \param is_skip_first_line True if need to skip header * \param is_skip_first_line True if need to skip header
*/ */
TextReader(const char* filename, bool is_skip_first_line): TextReader(const char* filename, bool is_skip_first_line):
filename_(filename), is_skip_first_line_(is_skip_first_line){ filename_(filename), is_skip_first_line_(is_skip_first_line) {
if (is_skip_first_line_) { if (is_skip_first_line_) {
auto reader = VirtualFileReader::Make(filename); auto reader = VirtualFileReader::Make(filename);
if (!reader->Init()) { if (!reader->Init()) {
...@@ -210,7 +210,7 @@ public: ...@@ -210,7 +210,7 @@ public:
} }
else { else {
const size_t idx = static_cast<size_t>(random.NextInt(0, static_cast<int>(out_used_data_indices->size()))); const size_t idx = static_cast<size_t>(random.NextInt(0, static_cast<int>(out_used_data_indices->size())));
if (idx < static_cast<size_t>(sample_cnt) ) { if (idx < static_cast<size_t>(sample_cnt)) {
out_sampled_data->operator[](idx) = std::string(buffer, size); out_sampled_data->operator[](idx) = std::string(buffer, size);
} }
} }
...@@ -225,7 +225,7 @@ public: ...@@ -225,7 +225,7 @@ public:
}); });
} }
INDEX_T ReadAllAndProcessParallelWithFilter(const std::function<void(INDEX_T, const std::vector<std::string>&)>& process_fun, const std::function<bool(INDEX_T,INDEX_T)>& filter_fun) { INDEX_T ReadAllAndProcessParallelWithFilter(const std::function<void(INDEX_T, const std::vector<std::string>&)>& process_fun, const std::function<bool(INDEX_T, INDEX_T)>& filter_fun) {
last_line_ = ""; last_line_ = "";
INDEX_T total_cnt = 0; INDEX_T total_cnt = 0;
INDEX_T used_cnt = 0; INDEX_T used_cnt = 0;
...@@ -296,7 +296,7 @@ public: ...@@ -296,7 +296,7 @@ public:
INDEX_T ReadPartAndProcessParallel(const std::vector<INDEX_T>& used_data_indices, const std::function<void(INDEX_T, const std::vector<std::string>&)>& process_fun) { INDEX_T ReadPartAndProcessParallel(const std::vector<INDEX_T>& used_data_indices, const std::function<void(INDEX_T, const std::vector<std::string>&)>& process_fun) {
return ReadAllAndProcessParallelWithFilter(process_fun, return ReadAllAndProcessParallelWithFilter(process_fun,
[&used_data_indices](INDEX_T used_cnt ,INDEX_T total_cnt) { [&used_data_indices](INDEX_T used_cnt, INDEX_T total_cnt) {
if (static_cast<size_t>(used_cnt) < used_data_indices.size() && total_cnt == used_data_indices[used_cnt]) { if (static_cast<size_t>(used_cnt) < used_data_indices.size() && total_cnt == used_data_indices[used_cnt]) {
return true; return true;
} }
...@@ -314,7 +314,7 @@ private: ...@@ -314,7 +314,7 @@ private:
/*! \brief Buffer for last line */ /*! \brief Buffer for last line */
std::string last_line_; std::string last_line_;
/*! \brief first line */ /*! \brief first line */
std::string first_line_=""; std::string first_line_ = "";
/*! \brief is skip first line */ /*! \brief is skip first line */
bool is_skip_first_line_ = false; bool is_skip_first_line_ = false;
/*! \brief is skip first line */ /*! \brief is skip first line */
......
...@@ -10,7 +10,6 @@ namespace LightGBM { ...@@ -10,7 +10,6 @@ namespace LightGBM {
class Threading { class Threading {
public: public:
template<typename INDEX_T> template<typename INDEX_T>
static inline void For(INDEX_T start, INDEX_T end, const std::function<void(int, INDEX_T, INDEX_T)>& inner_fun) { static inline void For(INDEX_T start, INDEX_T end, const std::function<void(int, INDEX_T, INDEX_T)>& inner_fun) {
int num_threads = 1; int num_threads = 1;
...@@ -22,7 +21,7 @@ public: ...@@ -22,7 +21,7 @@ public:
INDEX_T num_inner = (end - start + num_threads - 1) / num_threads; INDEX_T num_inner = (end - start + num_threads - 1) / num_threads;
if (num_inner <= 0) { num_inner = 1; } if (num_inner <= 0) { num_inner = 1; }
OMP_INIT_EX(); OMP_INIT_EX();
#pragma omp parallel for schedule(static,1) #pragma omp parallel for schedule(static, 1)
for (int i = 0; i < num_threads; ++i) { for (int i = 0; i < num_threads; ++i) {
OMP_LOOP_EX_BEGIN(); OMP_LOOP_EX_BEGIN();
INDEX_T inner_start = start + num_inner * i; INDEX_T inner_start = start + num_inner * i;
......
...@@ -136,8 +136,7 @@ void Application::LoadData() { ...@@ -136,8 +136,7 @@ void Application::LoadData() {
dataset_loader.LoadFromFileAlignWithOtherDataset( dataset_loader.LoadFromFileAlignWithOtherDataset(
config_.valid[i].c_str(), config_.valid[i].c_str(),
config_.valid_data_initscores[i].c_str(), config_.valid_data_initscores[i].c_str(),
train_data_.get()) train_data_.get()));
);
valid_datas_.push_back(std::move(new_dataset)); valid_datas_.push_back(std::move(new_dataset));
// need save binary file // need save binary file
if (config_.save_binary) { if (config_.save_binary) {
...@@ -212,7 +211,6 @@ void Application::Train() { ...@@ -212,7 +211,6 @@ void Application::Train() {
} }
void Application::Predict() { void Application::Predict() {
if (config_.task == TaskType::KRefitTree) { if (config_.task == TaskType::KRefitTree) {
// create predictor // create predictor
Predictor predictor(boosting_.get(), -1, false, true, false, false, 1, 1); Predictor predictor(boosting_.get(), -1, false, true, false, false, 1, 1);
......
...@@ -35,7 +35,6 @@ public: ...@@ -35,7 +35,6 @@ public:
Predictor(Boosting* boosting, int num_iteration, Predictor(Boosting* boosting, int num_iteration,
bool is_raw_score, bool predict_leaf_index, bool predict_contrib, bool is_raw_score, bool predict_leaf_index, bool predict_contrib,
bool early_stop, int early_stop_freq, double early_stop_margin) { bool early_stop, int early_stop_freq, double early_stop_margin) {
early_stop_ = CreatePredictionEarlyStopInstance("none", LightGBM::PredictionEarlyStopConfig()); early_stop_ = CreatePredictionEarlyStopInstance("none", LightGBM::PredictionEarlyStopConfig());
if (early_stop && !boosting->NeedAccuratePrediction()) { if (early_stop && !boosting->NeedAccuratePrediction()) {
PredictionEarlyStopConfig pred_early_stop_config; PredictionEarlyStopConfig pred_early_stop_config;
...@@ -173,7 +172,7 @@ public: ...@@ -173,7 +172,7 @@ public:
(*feature)[i].first = feature_names_map_[(*feature)[i].first]; (*feature)[i].first = feature_names_map_[(*feature)[i].first];
++i; ++i;
} else { } else {
//move the non-used features to the end of the feature vector // move the non-used features to the end of the feature vector
std::swap((*feature)[i], (*feature)[--j]); std::swap((*feature)[i], (*feature)[--j]);
} }
} }
...@@ -209,7 +208,6 @@ public: ...@@ -209,7 +208,6 @@ public:
} }
private: private:
void CopyToPredictBuffer(double* pred_buf, const std::vector<std::pair<int, double>>& features) { void CopyToPredictBuffer(double* pred_buf, const std::vector<std::pair<int, double>>& features) {
int loop_size = static_cast<int>(features.size()); int loop_size = static_cast<int>(features.size());
for (int i = 0; i < loop_size; ++i) { for (int i = 0; i < loop_size; ++i) {
......
...@@ -30,7 +30,6 @@ num_iteration_for_pred_(0), ...@@ -30,7 +30,6 @@ num_iteration_for_pred_(0),
shrinkage_rate_(0.1f), shrinkage_rate_(0.1f),
num_init_iteration_(0), num_init_iteration_(0),
need_re_bagging_(false) { need_re_bagging_(false) {
#pragma omp parallel #pragma omp parallel
#pragma omp master #pragma omp master
{ {
...@@ -41,7 +40,6 @@ need_re_bagging_(false) { ...@@ -41,7 +40,6 @@ need_re_bagging_(false) {
} }
GBDT::~GBDT() { GBDT::~GBDT() {
} }
void GBDT::Init(const Config* config, const Dataset* train_data, const ObjectiveFunction* objective_function, void GBDT::Init(const Config* config, const Dataset* train_data, const ObjectiveFunction* objective_function,
...@@ -57,7 +55,7 @@ void GBDT::Init(const Config* config, const Dataset* train_data, const Objective ...@@ -57,7 +55,7 @@ void GBDT::Init(const Config* config, const Dataset* train_data, const Objective
shrinkage_rate_ = config_->learning_rate; shrinkage_rate_ = config_->learning_rate;
std::string forced_splits_path = config->forcedsplits_filename; std::string forced_splits_path = config->forcedsplits_filename;
//load forced_splits file // load forced_splits file
if (forced_splits_path != "") { if (forced_splits_path != "") {
std::ifstream forced_splits_file(forced_splits_path.c_str()); std::ifstream forced_splits_file(forced_splits_path.c_str());
std::stringstream buffer; std::stringstream buffer;
...@@ -188,7 +186,7 @@ void GBDT::Bagging(int iter) { ...@@ -188,7 +186,7 @@ void GBDT::Bagging(int iter) {
data_size_t inner_size = (num_data_ + num_threads_ - 1) / num_threads_; data_size_t inner_size = (num_data_ + num_threads_ - 1) / num_threads_;
if (inner_size < min_inner_size) { inner_size = min_inner_size; } if (inner_size < min_inner_size) { inner_size = min_inner_size; }
OMP_INIT_EX(); OMP_INIT_EX();
#pragma omp parallel for schedule(static,1) #pragma omp parallel for schedule(static, 1)
for (int i = 0; i < num_threads_; ++i) { for (int i = 0; i < num_threads_; ++i) {
OMP_LOOP_EX_BEGIN(); OMP_LOOP_EX_BEGIN();
left_cnts_buf_[i] = 0; left_cnts_buf_[i] = 0;
...@@ -451,7 +449,6 @@ bool GBDT::EvalAndCheckEarlyStopping() { ...@@ -451,7 +449,6 @@ bool GBDT::EvalAndCheckEarlyStopping() {
} }
void GBDT::UpdateScore(const Tree* tree, const int cur_tree_id) { void GBDT::UpdateScore(const Tree* tree, const int cur_tree_id) {
// update training score // update training score
if (!is_use_subset_) { if (!is_use_subset_) {
train_score_updater_->AddScore(tree_learner_.get(), tree, cur_tree_id); train_score_updater_->AddScore(tree_learner_.get(), tree, cur_tree_id);
...@@ -624,7 +621,6 @@ void GBDT::GetPredictAt(int data_idx, double* out_result, int64_t* out_len) { ...@@ -624,7 +621,6 @@ void GBDT::GetPredictAt(int data_idx, double* out_result, int64_t* out_len) {
void GBDT::ResetTrainingData(const Dataset* train_data, const ObjectiveFunction* objective_function, void GBDT::ResetTrainingData(const Dataset* train_data, const ObjectiveFunction* objective_function,
const std::vector<const Metric*>& training_metrics) { const std::vector<const Metric*>& training_metrics) {
if (train_data != train_data_ && !train_data_->CheckAlign(*train_data)) { if (train_data != train_data_ && !train_data_->CheckAlign(*train_data)) {
Log::Fatal("Cannot reset training data, since new training data has different bin mappers"); Log::Fatal("Cannot reset training data, since new training data has different bin mappers");
} }
......
...@@ -25,7 +25,6 @@ namespace LightGBM { ...@@ -25,7 +25,6 @@ namespace LightGBM {
*/ */
class GBDT : public GBDTBase { class GBDT : public GBDTBase {
public: public:
/*! /*!
* \brief Constructor * \brief Constructor
*/ */
...@@ -356,7 +355,6 @@ public: ...@@ -356,7 +355,6 @@ public:
virtual const char* SubModelName() const override { return "tree"; } virtual const char* SubModelName() const override { return "tree"; }
protected: protected:
/*! /*!
* \brief Print eval result and check early stopping * \brief Print eval result and check early stopping
*/ */
...@@ -488,7 +486,6 @@ protected: ...@@ -488,7 +486,6 @@ protected:
std::string loaded_parameter_; std::string loaded_parameter_;
Json forced_splits_json_; Json forced_splits_json_;
}; };
} // namespace LightGBM } // namespace LightGBM
......
...@@ -194,7 +194,7 @@ std::string GBDT::ModelToIfElse(int num_iteration) const { ...@@ -194,7 +194,7 @@ std::string GBDT::ModelToIfElse(int num_iteration) const {
str_buf << "\t" << "}" << '\n'; str_buf << "\t" << "}" << '\n';
str_buf << "}" << '\n'; str_buf << "}" << '\n';
//PredictLeafIndexByMap // PredictLeafIndexByMap
str_buf << "double (*PredictTreeLeafByMapPtr[])(const std::unordered_map<int, double>&) = { "; str_buf << "double (*PredictTreeLeafByMapPtr[])(const std::unordered_map<int, double>&) = { ";
for (int i = 0; i < num_used_model; ++i) { for (int i = 0; i < num_used_model; ++i) {
if (i > 0) { if (i > 0) {
...@@ -511,7 +511,6 @@ bool GBDT::LoadModelFromString(const char* buffer, size_t len) { ...@@ -511,7 +511,6 @@ bool GBDT::LoadModelFromString(const char* buffer, size_t len) {
} }
std::vector<double> GBDT::FeatureImportance(int num_iteration, int importance_type) const { std::vector<double> GBDT::FeatureImportance(int num_iteration, int importance_type) const {
int num_used_model = static_cast<int>(models_.size()); int num_used_model = static_cast<int>(models_.size());
if (num_iteration > 0) { if (num_iteration > 0) {
num_iteration += 0; num_iteration += 0;
......
...@@ -29,7 +29,6 @@ public: ...@@ -29,7 +29,6 @@ public:
* \brief Constructor * \brief Constructor
*/ */
GOSS() : GBDT() { GOSS() : GBDT() {
} }
~GOSS() { ~GOSS() {
......
...@@ -69,7 +69,7 @@ PredictionEarlyStopInstance CreateBinary(const PredictionEarlyStopConfig& config ...@@ -69,7 +69,7 @@ PredictionEarlyStopInstance CreateBinary(const PredictionEarlyStopConfig& config
}; };
} }
} } // namespace
namespace LightGBM { namespace LightGBM {
...@@ -86,4 +86,4 @@ PredictionEarlyStopInstance CreatePredictionEarlyStopInstance(const std::string& ...@@ -86,4 +86,4 @@ PredictionEarlyStopInstance CreatePredictionEarlyStopInstance(const std::string&
} }
} }
} } // namespace LightGBM
...@@ -17,7 +17,6 @@ namespace LightGBM { ...@@ -17,7 +17,6 @@ namespace LightGBM {
*/ */
class RF : public GBDT { class RF : public GBDT {
public: public:
RF() : GBDT() { RF() : GBDT() {
average_output_ = true; average_output_ = true;
} }
...@@ -106,7 +105,6 @@ public: ...@@ -106,7 +105,6 @@ public:
std::unique_ptr<Tree> new_tree(new Tree(2)); std::unique_ptr<Tree> new_tree(new Tree(2));
size_t bias = static_cast<size_t>(cur_tree_id)* num_data_; size_t bias = static_cast<size_t>(cur_tree_id)* num_data_;
if (class_need_train_[cur_tree_id]) { if (class_need_train_[cur_tree_id]) {
auto grad = gradients + bias; auto grad = gradients + bias;
auto hess = hessians + bias; auto hess = hessians + bias;
...@@ -202,11 +200,9 @@ public: ...@@ -202,11 +200,9 @@ public:
}; };
private: private:
std::vector<score_t> tmp_grad_; std::vector<score_t> tmp_grad_;
std::vector<score_t> tmp_hess_; std::vector<score_t> tmp_hess_;
std::vector<double> init_scores_; std::vector<double> init_scores_;
}; };
} // namespace LightGBM } // namespace LightGBM
......
...@@ -46,7 +46,6 @@ public: ...@@ -46,7 +46,6 @@ public:
} }
/*! \brief Destructor */ /*! \brief Destructor */
~ScoreUpdater() { ~ScoreUpdater() {
} }
inline bool has_init_score() const { return has_init_score_; } inline bool has_init_score() const { return has_init_score_; }
...@@ -109,6 +108,7 @@ public: ...@@ -109,6 +108,7 @@ public:
ScoreUpdater& operator=(const ScoreUpdater&) = delete; ScoreUpdater& operator=(const ScoreUpdater&) = delete;
/*! \brief Disable copy */ /*! \brief Disable copy */
ScoreUpdater(const ScoreUpdater&) = delete; ScoreUpdater(const ScoreUpdater&) = delete;
private: private:
/*! \brief Number of total data */ /*! \brief Number of total data */
data_size_t num_data_; data_size_t num_data_;
......
...@@ -37,7 +37,6 @@ inline int LGBM_APIHandleException(const std::string& ex) { ...@@ -37,7 +37,6 @@ inline int LGBM_APIHandleException(const std::string& ex) {
} }
#define API_BEGIN() try { #define API_BEGIN() try {
#define API_END() } \ #define API_END() } \
catch(std::exception& ex) { return LGBM_APIHandleException(ex); } \ catch(std::exception& ex) { return LGBM_APIHandleException(ex); } \
catch(std::string& ex) { return LGBM_APIHandleException(ex); } \ catch(std::string& ex) { return LGBM_APIHandleException(ex); } \
...@@ -77,7 +76,6 @@ public: ...@@ -77,7 +76,6 @@ public:
} }
boosting_->Init(&config_, train_data_, objective_fun_.get(), boosting_->Init(&config_, train_data_, objective_fun_.get(),
Common::ConstPtrInVectorWrapper<Metric>(train_metric_)); Common::ConstPtrInVectorWrapper<Metric>(train_metric_));
} }
void MergeFrom(const Booster* other) { void MergeFrom(const Booster* other) {
...@@ -86,7 +84,6 @@ public: ...@@ -86,7 +84,6 @@ public:
} }
~Booster() { ~Booster() {
} }
void CreateObjectiveAndMetrics() { void CreateObjectiveAndMetrics() {
...@@ -158,7 +155,6 @@ public: ...@@ -158,7 +155,6 @@ public:
} }
boosting_->ResetConfig(&config_); boosting_->ResetConfig(&config_);
} }
void AddValidData(const Dataset* valid_data) { void AddValidData(const Dataset* valid_data) {
...@@ -275,7 +271,7 @@ public: ...@@ -275,7 +271,7 @@ public:
return boosting_->SaveModelToString(start_iteration, num_iteration); return boosting_->SaveModelToString(start_iteration, num_iteration);
} }
std::string DumpModel(int start_iteration,int num_iteration) { std::string DumpModel(int start_iteration, int num_iteration) {
return boosting_->DumpModel(start_iteration, num_iteration); return boosting_->DumpModel(start_iteration, num_iteration);
} }
...@@ -328,7 +324,6 @@ public: ...@@ -328,7 +324,6 @@ public:
const Boosting* GetBoosting() const { return boosting_.get(); } const Boosting* GetBoosting() const { return boosting_.get(); }
private: private:
const Dataset* train_data_; const Dataset* train_data_;
std::unique_ptr<Boosting> boosting_; std::unique_ptr<Boosting> boosting_;
/*! \brief All configs */ /*! \brief All configs */
...@@ -343,7 +338,7 @@ private: ...@@ -343,7 +338,7 @@ private:
std::mutex mutex_; std::mutex mutex_;
}; };
} } // namespace LightGBM
using namespace LightGBM; using namespace LightGBM;
...@@ -394,7 +389,7 @@ int LGBM_DatasetCreateFromFile(const char* filename, ...@@ -394,7 +389,7 @@ int LGBM_DatasetCreateFromFile(const char* filename,
if (config.num_threads > 0) { if (config.num_threads > 0) {
omp_set_num_threads(config.num_threads); omp_set_num_threads(config.num_threads);
} }
DatasetLoader loader(config,nullptr, 1, filename); DatasetLoader loader(config, nullptr, 1, filename);
if (reference == nullptr) { if (reference == nullptr) {
if (Network::num_machines() == 1) { if (Network::num_machines() == 1) {
*out = loader.LoadFromFile(filename, ""); *out = loader.LoadFromFile(filename, "");
......
...@@ -44,7 +44,6 @@ namespace LightGBM { ...@@ -44,7 +44,6 @@ namespace LightGBM {
} }
BinMapper::~BinMapper() { BinMapper::~BinMapper() {
} }
bool NeedFilter(const std::vector<int>& cnt_in_bin, int total_cnt, int filter_cnt, BinType bin_type) { bool NeedFilter(const std::vector<int>& cnt_in_bin, int total_cnt, int filter_cnt, BinType bin_type) {
......
...@@ -151,7 +151,6 @@ void GetTreeLearnerType(const std::unordered_map<std::string, std::string>& para ...@@ -151,7 +151,6 @@ void GetTreeLearnerType(const std::unordered_map<std::string, std::string>& para
} }
void Config::Set(const std::unordered_map<std::string, std::string>& params) { void Config::Set(const std::unordered_map<std::string, std::string>& params) {
// generate seeds by seed. // generate seeds by seed.
if (GetInt(params, "seed", &seed)) { if (GetInt(params, "seed", &seed)) {
Random rand(seed); Random rand(seed);
......
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