[Breaking] Change default evaluation metric for binary:logitraw objective to logloss (#6647)

This commit is contained in:
Philip Hyunsu Cho 2021-01-29 00:12:12 +09:00 committed by GitHub
parent d167892c7e
commit 0f2ed21a9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 9 deletions

View File

@ -134,7 +134,7 @@ struct LogisticRawOneAPI : public LogisticRegressionOneAPI {
predt = SigmoidOneAPI(predt); predt = SigmoidOneAPI(predt);
return std::max(predt * (T(1.0f) - predt), eps); return std::max(predt * (T(1.0f) - predt), eps);
} }
static const char* DefaultEvalMetric() { return "auc"; } static const char* DefaultEvalMetric() { return "logloss"; }
static const char* Name() { return "binary:logitraw_oneapi"; } static const char* Name() { return "binary:logitraw_oneapi"; }
}; };

View File

@ -1035,16 +1035,18 @@ class LearnerImpl : public LearnerIO {
os << '[' << iter << ']' << std::setiosflags(std::ios::fixed); os << '[' << iter << ']' << std::setiosflags(std::ios::fixed);
if (metrics_.size() == 0 && tparam_.disable_default_eval_metric <= 0) { if (metrics_.size() == 0 && tparam_.disable_default_eval_metric <= 0) {
auto warn_default_eval_metric = [](const std::string& objective, const std::string& before, auto warn_default_eval_metric = [](const std::string& objective, const std::string& before,
const std::string& after) { const std::string& after, const std::string& version) {
LOG(WARNING) << "Starting in XGBoost 1.3.0, the default evaluation metric used with the " LOG(WARNING) << "Starting in XGBoost " << version << ", the default evaluation metric "
<< "objective '" << objective << "' was changed from '" << before << "used with the objective '" << objective << "' was changed from '"
<< "' to '" << after << "'. Explicitly set eval_metric if you'd like to " << before << "' to '" << after << "'. Explicitly set eval_metric if you'd "
<< "restore the old behavior."; << "like to restore the old behavior.";
}; };
if (tparam_.objective == "binary:logistic") { if (tparam_.objective == "binary:logistic") {
warn_default_eval_metric(tparam_.objective, "error", "logloss"); warn_default_eval_metric(tparam_.objective, "error", "logloss", "1.3.0");
} else if (tparam_.objective == "binary:logitraw") {
warn_default_eval_metric(tparam_.objective, "auc", "logloss", "1.4.0");
} else if ((tparam_.objective == "multi:softmax" || tparam_.objective == "multi:softprob")) { } else if ((tparam_.objective == "multi:softmax" || tparam_.objective == "multi:softprob")) {
warn_default_eval_metric(tparam_.objective, "merror", "mlogloss"); warn_default_eval_metric(tparam_.objective, "merror", "mlogloss", "1.3.0");
} }
metrics_.emplace_back(Metric::Create(obj_->DefaultEvalMetric(), &generic_parameters_)); metrics_.emplace_back(Metric::Create(obj_->DefaultEvalMetric(), &generic_parameters_));
metrics_.back()->Configure({cfg_.begin(), cfg_.end()}); metrics_.back()->Configure({cfg_.begin(), cfg_.end()});

View File

@ -165,7 +165,7 @@ struct LogisticRaw : public LogisticRegression {
static bst_float ProbToMargin(bst_float base_score) { static bst_float ProbToMargin(bst_float base_score) {
return base_score; return base_score;
} }
static const char* DefaultEvalMetric() { return "auc"; } static const char* DefaultEvalMetric() { return "logloss"; }
static const char* Name() { return "binary:logitraw"; } static const char* Name() { return "binary:logitraw"; }
}; };