# Buggy code
def decision_function(self, X):
    """Distance of the samples X to the separating hyperplane.

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

    Returns
    -------
    X : array-like, shape = [n_samples, n_class * (n_class-1) / 2]
        Returns the decision function of the sample for each class
        in the model.
    """
    # NOTE: _validate_for_predict contains check for is_fitted
    # hence must be placed before any other attributes are used.
    X = self._validate_for_predict(X)
    if self._sparse:
        raise NotImplementedError("Decision_function not supported for sparse SVM.")
    X = self._compute_kernel(X)

    kernel = self.kernel
    if callable(kernel):
        kernel = "precomputed"

    dec_func = libsvm.decision_function(
        X,
        self.support_,
        self.support_vectors_,
        self.n_support_,
        self._dual_coef_,
        self._intercept_,
        self.probA_,
        self.probB_,
        svm_type=LIBSVM_IMPL.index(self._impl),
        kernel=kernel,
        degree=self.degree,
        cache_size=self.cache_size,
        coef0=self.coef0,
        gamma=self._gamma,
    )

    # In binary case, we need to flip the sign of coef, intercept and
    # decision function.
    if self._impl in ["c_svc", "nu_svc"] and len(self.classes_) == 2:
        return -dec_func.ravel()

    return dec_func


# 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):
    """Distance of the samples X to the separating hyperplane.

    Parameters
    ----------
    X : array-like, shape = [n_samples, n_features]
        For kernel="precomputed", the expected shape of X is
        [n_samples_test, n_samples_train].

    Returns
    -------
    X : array-like, shape = [n_samples, n_class * (n_class-1) / 2]
        Returns the decision function of the sample for each class
        in the model.
    """
    # NOTE: _validate_for_predict contains check for is_fitted
    # hence must be placed before any other attributes are used.
    X = self._validate_for_predict(X)
    X = self._compute_kernel(X)

    if self._sparse:
        dec_func = self._sparse_decision_function(X)
    else:
        dec_func = self._dense_decision_function(X)

    # In binary case, we need to flip the sign of coef, intercept and
    # decision function.
    if self._impl in ["c_svc", "nu_svc"] and len(self.classes_) == 2:
        return -dec_func.ravel()

    return dec_func