diff --git a/src/learner/evaluation-inl.hpp b/src/learner/evaluation-inl.hpp index 64ad40849..ab68a6ec6 100644 --- a/src/learner/evaluation-inl.hpp +++ b/src/learner/evaluation-inl.hpp @@ -166,6 +166,7 @@ struct EvalMultiLogLoss : public EvalMClassBase { inline static float EvalRow(float label, const float *pred, size_t nclass) { + const float eps = 1e-16f; size_t k = static_cast(label); utils::Check(k < nclass, "mlogloss: label must be in [0, num_class)"); if (pred[k] > eps) { @@ -173,8 +174,7 @@ struct EvalMultiLogLoss : public EvalMClassBase { } else { return -std::log(eps); } - } - const static float eps = 1e-16; + } }; /*! \brief ctest */