Commit 9fe30681 authored by zhangyafeikimi's avatar zhangyafeikimi Committed by Guolin Ke
Browse files

fix typos (#361)

parent 6fac4702
...@@ -48,11 +48,11 @@ Boosting* Boosting::CreateBoosting(const std::string& type, const char* filename ...@@ -48,11 +48,11 @@ Boosting* Boosting::CreateBoosting(const std::string& type, const char* filename
} else if (type == std::string("goss")) { } else if (type == std::string("goss")) {
ret.reset(new GOSS()); ret.reset(new GOSS());
} else { } else {
Log::Fatal("unknow boosting type %s", type.c_str()); Log::Fatal("unknown boosting type %s", type.c_str());
} }
LoadFileToBoosting(ret.get(), filename); LoadFileToBoosting(ret.get(), filename);
} else { } else {
Log::Fatal("unknow submodel type in model file %s", filename); Log::Fatal("unknown submodel type in model file %s", filename);
} }
return ret.release(); return ret.release();
} }
...@@ -64,7 +64,7 @@ Boosting* Boosting::CreateBoosting(const char* filename) { ...@@ -64,7 +64,7 @@ Boosting* Boosting::CreateBoosting(const char* filename) {
if (type == std::string("tree")) { if (type == std::string("tree")) {
ret.reset(new GBDT()); ret.reset(new GBDT());
} else { } else {
Log::Fatal("unknow submodel type in model file %s", filename); Log::Fatal("unknown submodel type in model file %s", filename);
} }
LoadFileToBoosting(ret.get(), filename); LoadFileToBoosting(ret.get(), filename);
return ret.release(); return ret.release();
......
...@@ -84,7 +84,7 @@ private: ...@@ -84,7 +84,7 @@ private:
void DroppingTrees() { void DroppingTrees() {
drop_index_.clear(); drop_index_.clear();
bool is_skip = random_for_drop_.NextFloat() < gbdt_config_->skip_drop; bool is_skip = random_for_drop_.NextFloat() < gbdt_config_->skip_drop;
// select dropping tree indexes based on drop_rate and tree weights // select dropping tree indices based on drop_rate and tree weights
if (!is_skip) { if (!is_skip) {
double drop_rate = gbdt_config_->drop_rate; double drop_rate = gbdt_config_->drop_rate;
if (!gbdt_config_->uniform_drop) { if (!gbdt_config_->uniform_drop) {
...@@ -180,7 +180,7 @@ private: ...@@ -180,7 +180,7 @@ private:
std::vector<double> tree_weight_; std::vector<double> tree_weight_;
/*! \brief sum weights of all trees */ /*! \brief sum weights of all trees */
double sum_weight_; double sum_weight_;
/*! \brief The indexes of dropping trees */ /*! \brief The indices of dropping trees */
std::vector<int> drop_index_; std::vector<int> drop_index_;
/*! \brief Random generator, used to select dropping trees */ /*! \brief Random generator, used to select dropping trees */
Random random_for_drop_; Random random_for_drop_;
......
...@@ -370,7 +370,7 @@ bool GBDT::TrainOneIter(const score_t* gradient, const score_t* hessian, bool is ...@@ -370,7 +370,7 @@ bool GBDT::TrainOneIter(const score_t* gradient, const score_t* hessian, bool is
#ifdef TIMETAG #ifdef TIMETAG
start_time = std::chrono::steady_clock::now(); start_time = std::chrono::steady_clock::now();
#endif #endif
std::unique_ptr<Tree> new_tree(new Tree(2)); std::unique_ptr<Tree> new_tree;
// train a new tree // train a new tree
new_tree.reset(tree_learner_->Train(gradient + curr_class * num_data_, hessian + curr_class * num_data_)); new_tree.reset(tree_learner_->Train(gradient + curr_class * num_data_, hessian + curr_class * num_data_));
#ifdef TIMETAG #ifdef TIMETAG
......
...@@ -26,11 +26,10 @@ public: ...@@ -26,11 +26,10 @@ public:
~GBDT(); ~GBDT();
/*! /*!
* \brief Initialization logic * \brief Initialization logic
* \param config Config for boosting * \param gbdt_config Config for boosting
* \param train_data Training data * \param train_data Training data
* \param object_function Training objective function * \param object_function Training objective function
* \param training_metrics Training metrics * \param training_metrics Training metrics
* \param output_model_filename Filename of output model
*/ */
void Init(const BoostingConfig* gbdt_config, const Dataset* train_data, const ObjectiveFunction* object_function, void Init(const BoostingConfig* gbdt_config, const Dataset* train_data, const ObjectiveFunction* object_function,
const std::vector<const Metric*>& training_metrics) const std::vector<const Metric*>& training_metrics)
...@@ -267,7 +266,6 @@ protected: ...@@ -267,7 +266,6 @@ protected:
std::string OutputMetric(int iter); std::string OutputMetric(int iter);
/*! /*!
* \brief Calculate feature importances * \brief Calculate feature importances
* \param last_iter Last tree use to calculate
*/ */
std::vector<std::pair<size_t, std::string>> FeatureImportance() const; std::vector<std::pair<size_t, std::string>> FeatureImportance() const;
/*! \brief current iteration */ /*! \brief current iteration */
......
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