<commit_before>import numpy as np
from scipy import sparse as sp

from scikits.learn.svm.bounds import l1_min_c
from scikits.learn.svm import LinearSVC
from scikits.learn.linear_model.logistic import LogisticRegression
from scikits.learn.svm.sparse import LinearSVC as SparseSVC
from scikits.learn.linear_model.sparse.logistic import LogisticRegression as \
                                                       SparseLogRegression


dense_X = [[-1, 0], [0, 1], [1, 1], [1, 1]]
sparse_X = sp.csr_matrix(dense_X)

Y1 = [0, 1, 1, 1]
Y2 = [2, 1, 0, 0]


def test_l1_min_c():
    losses = ['l2', 'log']
    Xs = {'sparse': sparse_X, 'dense': dense_X}
    Ys = {'two-classes': Y1, 'multi-class': Y2}
    intercepts = {'no-intercept':  {'fit_intercept': False},
                  'fit-intercept': {'fit_intercept': True,
                                    'intercept_scaling': 10}}

    for loss in losses:
        for X_label, X in Xs.items():
            for Y_label, Y in Ys.items():
                for intercept_label, intercept_params in intercepts.items():
                    desc = 'Test l1_min_c loss=%r %s %s %s' % \
                           (loss, X_label, Y_label, intercept_label)
                    check = lambda X, Y, loss, intercept_ps: \
                                   check_l1_min_c(X, Y, loss, **intercept_ps)
                    check.description = desc
                    yield check, X, Y, loss, intercept_params<commit_msg>cleaned up tests<commit_after>import numpy as np
from scipy import sparse as sp

from scikits.learn.svm.bounds import l1_min_c
from scikits.learn.svm import LinearSVC
from scikits.learn.linear_model.logistic import LogisticRegression
from scikits.learn.svm.sparse import LinearSVC as SparseSVC
from scikits.learn.linear_model.sparse.logistic import LogisticRegression as \
                                                       SparseLogRegression


dense_X = [[-1, 0], [0, 1], [1, 1], [1, 1]]
sparse_X = sp.csr_matrix(dense_X)

Y1 = [0, 1, 1, 1]
Y2 = [2, 1, 0, 0]


def test_l1_min_c():
    losses = ['l2', 'log']
    Xs = {'sparse': sparse_X, 'dense': dense_X}
    Ys = {'two-classes': Y1, 'multi-class': Y2}
    intercepts = {'no-intercept':  {'fit_intercept': False},
                  'fit-intercept': {'fit_intercept': True,
                                    'intercept_scaling': 10}}

    for loss in losses:
        for X_label, X in Xs.items():
            for Y_label, Y in Ys.items():
                for intercept_label, intercept_params in intercepts.items():
                    check = lambda: check_l1_min_c(X, Y, loss,
                                                   **intercept_params)
                    check.description = 'Test l1_min_c loss=%r %s %s %s' % \
                                      (loss, X_label, Y_label, intercept_label)
                    yield check
{'fraction_non_alphanumeric': 0.11126711126711127, 'fraction_numerical': 0.018954018954018954, 'mean_word_length': 1.9533678756476685, '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': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3090595', 'n_tokens_mistral': 974, 'n_tokens_neox': 904, 'n_words': 245}