<commit_before>import numpy as np

from sklearn.datasets import make_classification
from sklearn.linear_model import Ridge
from sklearn.kernel_ridge import KernelRidge
from sklearn.metrics.pairwise import pairwise_kernels

from sklearn.utils.testing import assert_array_almost_equal


X, y = make_classification(n_classes=2, random_state=0)
Y = np.array([y, y]).T


def test_kernel_ridge():
    pred = Ridge(alpha=1, fit_intercept=False).fit(X, y).predict(X)
    pred2 = KernelRidge(kernel="linear", alpha=1).fit(X, y).predict(X)
    assert_array_almost_equal(pred, pred2)


def test_kernel_ridge_singula():
    # alpha=0 causes a LinAlgError in computing the dual coeeficients,
    # which causes a fall back to a lstsq solver. This is tested here.
    # XXX: Other solvers than lsqr give different results for Ridge
    pred = Ridge(alpha=0, fit_intercept=False, solver="lsqr").fit(X, y).predict(X)
    pred2 = KernelRidge(kernel="linear", alpha=0).fit(X, y).predict(X)<commit_msg>MINOR Fixed typo in test name (test_kernel_ridge_singular_kernel)<commit_after>import numpy as np

from sklearn.datasets import make_classification
from sklearn.linear_model import Ridge
from sklearn.kernel_ridge import KernelRidge
from sklearn.metrics.pairwise import pairwise_kernels

from sklearn.utils.testing import assert_array_almost_equal


X, y = make_classification(n_classes=2, random_state=0)
Y = np.array([y, y]).T


def test_kernel_ridge():
    pred = Ridge(alpha=1, fit_intercept=False).fit(X, y).predict(X)
    pred2 = KernelRidge(kernel="linear", alpha=1).fit(X, y).predict(X)
    assert_array_almost_equal(pred, pred2)


def test_kernel_ridge_singular_kernel():
    # alpha=0 causes a LinAlgError in computing the dual coeeficients,
    # which causes a fall back to a lstsq solver. This is tested here.
    # XXX: Other solvers than lsqr give different results for Ridge
    pred = Ridge(alpha=0, fit_intercept=False, solver="lsqr").fit(X, y).predict(X)
    pred2 = KernelRidge(kernel="linear", alpha=0).fit(X, y).predict(X)
{'fraction_non_alphanumeric': 0.1016781836130306, 'fraction_numerical': 0.009871668311944718, 'mean_word_length': 5.476038338658147, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1192729', 'n_tokens_mistral': 687, 'n_tokens_neox': 659, 'n_words': 177}