From 421f5c6570455dc82be4dad29c659084e48d2a4f Mon Sep 17 00:00:00 2001 From: tqchen Date: Mon, 6 Apr 2015 09:00:27 -0700 Subject: [PATCH] fix --- src/learner/evaluation-inl.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/learner/evaluation-inl.hpp b/src/learner/evaluation-inl.hpp index c7ef4ed30..02d86f606 100644 --- a/src/learner/evaluation-inl.hpp +++ b/src/learner/evaluation-inl.hpp @@ -119,6 +119,9 @@ struct EvalMClassBase : public IEvaluator { utils::Check(preds.size() % info.labels.size() == 0, "label and prediction size not match"); const size_t nclass = preds.size() / info.labels.size(); + utils::Check(nclass > 1, + "mlogloss and merror are only used for multi-class classification,"\ + " use logloss for binary classification"); const bst_omp_uint ndata = static_cast(info.labels.size()); float sum = 0.0, wsum = 0.0; int label_error = 0;