Ejemplo n.º 1
0
def test_fit_linear_binary():
    for data in (bin_dense, bin_csr):
        for loss in ("l1", "l2"):
            clf = LinearSVC(loss=loss, random_state=0, max_iter=10)
            clf.fit(data, bin_target)
            assert_equal(clf.score(data, bin_target), 1.0)
            y_pred = clf.decision_function(data).ravel()
Ejemplo n.º 2
0
def test_fit_linear_binary(data, loss, request):
    X, y = request.getfixturevalue(data)
    clf = LinearSVC(loss=loss, random_state=0, max_iter=10)
    clf.fit(X, y)
    assert list(clf.classes_) == [0, 1]
    assert clf.score(X, y) == 1.0
    y_pred = clf.decision_function(X).ravel()
Ejemplo n.º 3
0
def test_fit_linear_binary():
    for data in (bin_dense, bin_csr):
        for loss in ("l1", "l2"):
            clf = LinearSVC(loss=loss, random_state=0, max_iter=10)
            clf.fit(data, bin_target)
            assert_equal(clf.score(data, bin_target), 1.0)
            y_pred = clf.decision_function(data).ravel()