Unify logging facilities. (#3982)
* Unify logging facilities. * Enhance `ConsoleLogger` to handle different verbosity. * Override macros from `dmlc`. * Don't use specialized gamma when building with GPU. * Remove verbosity cache in monitor. * Test monitor. * Deprecate `silent`. * Fix doc and messages. * Fix python test. * Fix silent tests.
This commit is contained in:
@@ -26,7 +26,6 @@ struct GBLinearTrainParam : public dmlc::Parameter<GBLinearTrainParam> {
|
||||
std::string updater;
|
||||
float tolerance;
|
||||
size_t max_row_perbatch;
|
||||
int debug_verbose;
|
||||
DMLC_DECLARE_PARAMETER(GBLinearTrainParam) {
|
||||
DMLC_DECLARE_FIELD(updater)
|
||||
.set_default("shotgun")
|
||||
@@ -38,10 +37,6 @@ struct GBLinearTrainParam : public dmlc::Parameter<GBLinearTrainParam> {
|
||||
DMLC_DECLARE_FIELD(max_row_perbatch)
|
||||
.set_default(std::numeric_limits<size_t>::max())
|
||||
.describe("Maximum rows per batch.");
|
||||
DMLC_DECLARE_FIELD(debug_verbose)
|
||||
.set_lower_bound(0)
|
||||
.set_default(0)
|
||||
.describe("flag to print out detailed breakdown of runtime");
|
||||
}
|
||||
};
|
||||
/*!
|
||||
@@ -69,7 +64,7 @@ class GBLinear : public GradientBooster {
|
||||
param_.InitAllowUnknown(cfg);
|
||||
updater_.reset(LinearUpdater::Create(param_.updater));
|
||||
updater_->Init(cfg);
|
||||
monitor_.Init("GBLinear ", param_.debug_verbose);
|
||||
monitor_.Init("GBLinear");
|
||||
}
|
||||
void Load(dmlc::Stream* fi) override {
|
||||
model_.Load(fi);
|
||||
|
||||
@@ -45,8 +45,6 @@ struct GBTreeTrainParam : public dmlc::Parameter<GBTreeTrainParam> {
|
||||
std::string updater_seq;
|
||||
/*! \brief type of boosting process to run */
|
||||
int process_type;
|
||||
// flag to print out detailed breakdown of runtime
|
||||
int debug_verbose;
|
||||
std::string predictor;
|
||||
// declare parameters
|
||||
DMLC_DECLARE_PARAMETER(GBTreeTrainParam) {
|
||||
@@ -64,10 +62,6 @@ struct GBTreeTrainParam : public dmlc::Parameter<GBTreeTrainParam> {
|
||||
.add_enum("update", kUpdate)
|
||||
.describe("Whether to run the normal boosting process that creates new trees,"\
|
||||
" or to update the trees in an existing model.");
|
||||
DMLC_DECLARE_FIELD(debug_verbose)
|
||||
.set_lower_bound(0)
|
||||
.set_default(0)
|
||||
.describe("flag to print out detailed breakdown of runtime");
|
||||
// add alias
|
||||
DMLC_DECLARE_ALIAS(updater_seq, updater);
|
||||
DMLC_DECLARE_FIELD(predictor)
|
||||
@@ -78,8 +72,6 @@ struct GBTreeTrainParam : public dmlc::Parameter<GBTreeTrainParam> {
|
||||
|
||||
/*! \brief training parameters */
|
||||
struct DartTrainParam : public dmlc::Parameter<DartTrainParam> {
|
||||
/*! \brief whether to not print info during training */
|
||||
bool silent;
|
||||
/*! \brief type of sampling algorithm */
|
||||
int sample_type;
|
||||
/*! \brief type of normalization algorithm */
|
||||
@@ -94,9 +86,6 @@ struct DartTrainParam : public dmlc::Parameter<DartTrainParam> {
|
||||
float learning_rate;
|
||||
// declare parameters
|
||||
DMLC_DECLARE_PARAMETER(DartTrainParam) {
|
||||
DMLC_DECLARE_FIELD(silent)
|
||||
.set_default(false)
|
||||
.describe("Not print information during training.");
|
||||
DMLC_DECLARE_FIELD(sample_type)
|
||||
.set_default(0)
|
||||
.add_enum("uniform", 0)
|
||||
@@ -160,7 +149,7 @@ class GBTree : public GradientBooster {
|
||||
// configure predictor
|
||||
predictor_ = std::unique_ptr<Predictor>(Predictor::Create(tparam_.predictor));
|
||||
predictor_->Init(cfg, cache_);
|
||||
monitor_.Init("GBTree", tparam_.debug_verbose);
|
||||
monitor_.Init("GBTree");
|
||||
}
|
||||
|
||||
void Load(dmlc::Stream* fi) override {
|
||||
@@ -488,10 +477,8 @@ class Dart : public GBTree {
|
||||
model_.CommitModel(std::move(new_trees[gid]), gid);
|
||||
}
|
||||
size_t num_drop = NormalizeTrees(num_new_trees);
|
||||
if (dparam_.silent != 1) {
|
||||
LOG(INFO) << "drop " << num_drop << " trees, "
|
||||
<< "weight = " << weight_drop_.back();
|
||||
}
|
||||
LOG(INFO) << "drop " << num_drop << " trees, "
|
||||
<< "weight = " << weight_drop_.back();
|
||||
}
|
||||
|
||||
// predict the leaf scores without dropped trees
|
||||
|
||||
Reference in New Issue
Block a user