def _ovr_decision_function(predictions, confidences, n_classes):
 n_samples = predictions.shape[0]
 votes = np.zeros((n_samples, n_classes))
 sum_of_confidences = np.zeros((n_samples, n_classes))
 k = 0
 for i in range(n_classes):
  for j in range((i + 1), n_classes):
   sum_of_confidences[:, i] -= confidences[:, k]
   sum_of_confidences[:, j] += confidences[:, k]
   votes[((predictions[:, k] == 0), i)] += 1
   votes[((predictions[:, k] == 1), j)] += 1
   k += 1
 max_confidences = sum_of_confidences.max()
 min_confidences = sum_of_confidences.min()
 if (max_confidences == min_confidences):
  return votes
 eps = np.finfo(sum_of_confidences.dtype).eps
 max_abs_confidence = max(abs(max_confidences), abs(min_confidences))
 scale = ((0.5 - eps) / max_abs_confidence)
 return (votes + (sum_of_confidences * scale))

def _ovr_decision_function ( predictions , confidences , n_classes ) : n_samples = predictions . shape [ 0 ] votes = np . zeros ( ( n_samples , n_classes ) ) sum_of_confidences = np . zeros ( ( n_samples , n_classes ) ) k = 0 for i in range ( n_classes ) : for j in range ( ( i + 1 ) , n_classes ) : sum_of_confidences [ : , i ] -= confidences [ : , k ] sum_of_confidences [ : , j ] += confidences [ : , k ] votes [ ( ( predictions [ : , k ] == 0 ) , i ) ] += 1 votes [ ( ( predictions [ : , k ] == 1 ) , j ) ] += 1 k += 1 max_confidences = sum_of_confidences . max ( ) min_confidences = sum_of_confidences . min ( ) if ( max_confidences == min_confidences ) : return votes eps = np . finfo ( sum_of_confidences . dtype ) . eps max_abs_confidence = max ( abs ( max_confidences ) , abs ( min_confidences ) ) scale = ( ( 0.5 - eps ) / max_abs_confidence ) return ( votes + ( sum_of_confidences * scale ) )
compute a continuous .