[Breaking] Change default evaluation metric for classification to logloss / mlogloss (#6183)

* Change DefaultEvalMetric of classification from error to logloss

* Change default binary metric in plugin/example/custom_obj.cc

* Set old error metric in python tests

* Set old error metric in R tests

* Fix missed eval metrics and typos in R tests

* Fix setting eval_metric twice in R tests

* Add warning for empty eval_metric for classification

* Fix Dask tests

Co-authored-by: Hyunsu Cho <chohyu01@cs.washington.edu>
This commit is contained in:
Christian Lorentzen
2020-10-02 21:06:47 +02:00
committed by GitHub
parent e0e4f15d0e
commit cf4f019ed6
18 changed files with 56 additions and 32 deletions

View File

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