# Buggy code
def decision_function(self, X):
    """Decision function for the OneVsOneClassifier.

    The decision values for the samples are computed by adding the
    normalized sum of pair-wise classification confidence levels to the
    votes in order to disambiguate between the decision values when the
    votes for all the classes are equal leading to a tie.

    Parameters
    ----------
    X : array-like, shape = [n_samples, n_features]

    Returns
    -------
    Y : array-like, shape = [n_samples, n_classes]
    """
    check_is_fitted(self, "estimators_")

    n_samples = X.shape[0]
    n_classes = self.classes_.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):
            pred = self.estimators_[k].predict(X)
            confidence_levels_ij = _predict_binary(self.estimators_[k], X)
            sum_of_confidences[:, i] -= confidence_levels_ij
            sum_of_confidences[:, j] += confidence_levels_ij
            votes[pred == 0, i] += 1
            votes[pred == 1, j] += 1
            k += 1

    max_confidences = sum_of_confidences.max()
    min_confidences = sum_of_confidences.min()

    if max_confidences == min_confidences:
        return votes

    # Scale the sum_of_confidences to [-0.4, 0.4] and add it with votes
    return votes + sum_of_confidences * (
        0.4 / max(abs(max_confidences), abs(min_confidences))
    )


# Traceback (AssertionError)
======================================================================
FAIL: Tests that class_weight and sample_weight are multiplicative
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/buildd/scikit-learn-0.16.0~b1+git1-gab4d07d/debian/python-sklearn/usr/lib/python2.7/dist-packages/sklearn/linear_model/tests/test_sgd.py", line 633, in test_weights_multiplied
assert_array_equal(clf1.coef_, clf2.coef_)
File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 718, in assert_array_equal
verbose=verbose, header='Arrays are not equal')
File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 644, in assert_array_compare
raise AssertionError(msg)
AssertionError:
Arrays are not equal

(mismatch 16.6666666667%)
x: array([[-0.34681637, -0.32240913, -0.31335029,  0.34920789,  0.3658206 ,
0.38752489]])
y: array([[-0.34681637, -0.32240913, -0.31335029,  0.34920789,  0.3658206 ,
0.38752489]])

# Fixed code
def decision_function(self, X):
    """Decision function for the OneVsOneClassifier.

    The decision values for the samples are computed by adding the
    normalized sum of pair-wise classification confidence levels to the
    votes in order to disambiguate between the decision values when the
    votes for all the classes are equal leading to a tie.

    Parameters
    ----------
    X : array-like, shape = [n_samples, n_features]

    Returns
    -------
    Y : array-like, shape = [n_samples, n_classes]
    """
    check_is_fitted(self, "estimators_")

    n_samples = X.shape[0]
    n_classes = self.classes_.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):
            pred = self.estimators_[k].predict(X)
            confidence_levels_ij = _predict_binary(self.estimators_[k], X)
            sum_of_confidences[:, i] -= confidence_levels_ij
            sum_of_confidences[:, j] += confidence_levels_ij
            votes[pred == 0, i] += 1
            votes[pred == 1, j] += 1
            k += 1

    max_confidences = sum_of_confidences.max()
    min_confidences = sum_of_confidences.min()

    if max_confidences == min_confidences:
        return votes

    # Scale the sum_of_confidences to (-0.5, 0.5) and add it with votes.
    # The motivation is to use confidence levels as a way to break ties in
    # the votes without switching any decision made based on a difference
    # of 1 vote.
    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