File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -569,9 +569,14 @@ def decision_function(self, X):
569569 if max_confidences == min_confidences :
570570 return votes
571571
572- # Scale the sum_of_confidences to [-0.4, 0.4] and add it with votes
573- return votes + sum_of_confidences * \
574- (0.4 / max (abs (max_confidences ), abs (min_confidences )))
572+ # Scale the sum_of_confidences to (-0.5, 0.5) and add it with votes.
573+ # The motivation is to use confidence levels as a way to break ties in
574+ # the votes without switching any decision made based on a difference
575+ # of 1 vote.
576+ eps = np .finfo (sum_of_confidences .dtype ).eps
577+ max_abs_confidence = max (abs (max_confidences ), abs (min_confidences ))
578+ scale = (0.5 - eps ) / max_abs_confidence
579+ return votes + sum_of_confidences * scale
575580
576581
577582@deprecated ("fit_ecoc is deprecated and will be removed in 0.18."
You can’t perform that action at this time.
0 commit comments