diff --git a/src/objective/binary_objective.hpp b/src/objective/binary_objective.hpp index 7d66a9950e8d..52be93eeeca1 100644 --- a/src/objective/binary_objective.hpp +++ b/src/objective/binary_objective.hpp @@ -152,6 +152,10 @@ class BinaryLogloss: public ObjectiveFunction { suml += is_pos_(label_[i]); } } + if (Network::num_machines() > 1) { + suml = Network::GlobalSyncUpBySum(suml); + sumw = Network::GlobalSyncUpBySum(sumw); + } double pavg = suml / sumw; pavg = std::min(pavg, 1.0 - kEpsilon); pavg = std::max(pavg, kEpsilon);