Commit 2e100eeb authored by wxchan's avatar wxchan Committed by Guolin Ke
Browse files

not check metrics w/o eval set (#212)

parent 011fe024
...@@ -564,7 +564,7 @@ class LGBMClassifier(LGBMModel, LGBMClassifierBase): ...@@ -564,7 +564,7 @@ class LGBMClassifier(LGBMModel, LGBMClassifierBase):
if self.n_classes > 2: if self.n_classes > 2:
# Switch to using a multiclass objective in the underlying LGBM instance # Switch to using a multiclass objective in the underlying LGBM instance
self.objective = "multiclass" self.objective = "multiclass"
if eval_set is not None and eval_metric == "binary_logloss": if eval_metric == "binary_logloss":
eval_metric = "multi_logloss" eval_metric = "multi_logloss"
if eval_set is not None: if eval_set is not None:
......
...@@ -147,11 +147,13 @@ void OverallConfig::CheckParamConflict() { ...@@ -147,11 +147,13 @@ void OverallConfig::CheckParamConflict() {
Log::Fatal("Number of classes must be 1 for non-multiclass training"); Log::Fatal("Number of classes must be 1 for non-multiclass training");
} }
} }
for (std::string metric_type : metric_types) { if (boosting_config.is_provide_training_metric || !io_config.valid_data_filenames.empty()) {
bool metric_type_multiclass = (metric_type == std::string("multi_logloss") || metric_type == std::string("multi_error")); for (std::string metric_type : metric_types) {
if ((objective_type_multiclass && !metric_type_multiclass) bool metric_type_multiclass = (metric_type == std::string("multi_logloss") || metric_type == std::string("multi_error"));
|| (!objective_type_multiclass && metric_type_multiclass)) { if ((objective_type_multiclass && !metric_type_multiclass)
Log::Fatal("Objective and metrics don't match"); || (!objective_type_multiclass && metric_type_multiclass)) {
Log::Fatal("Objective and metrics don't match");
}
} }
} }
......
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