def test_multiclass_hinge_sgd(): for data in (mult_dense, mult_csr): for fit_intercept in (True, False): clf = SGDClassifier(loss="hinge", multiclass=True, fit_intercept=fit_intercept, random_state=0) clf.fit(data, mult_target) assert_greater(clf.score(data, mult_target), 0.78)
def test_multiclass_hinge_sgd_l1l2(): for data in (mult_dense, mult_csr): clf = SGDClassifier(loss="hinge", penalty="l1/l2", multiclass=True, random_state=0) clf.fit(data, mult_target) assert_greater(clf.score(data, mult_target), 0.75)
def test_multiclass_hinge_sgd_l1l2(data, request): X, y = request.getfixturevalue(data) clf = SGDClassifier(loss="hinge", penalty="l1/l2", multiclass=True, random_state=0) clf.fit(X, y) assert clf.score(X, y) > 0.75
def test_multiclass_hinge_sgd(data, fit_intercept, request): X, y = request.getfixturevalue(data) clf = SGDClassifier(loss="hinge", multiclass=True, fit_intercept=fit_intercept, random_state=0) clf.fit(X, y) assert clf.score(X, y) > 0.78
def test_multiclass_squared_hinge_sgd(): for data in (mult_dense, mult_csr): for fit_intercept in (True, False): clf = SGDClassifier(loss="squared_hinge", multiclass=True, learning_rate="constant", eta0=1e-3, fit_intercept=fit_intercept, random_state=0) clf.fit(data, mult_target) assert_greater(clf.score(data, mult_target), 0.78)
def test_multiclass_squared_hinge_sgd(data, fit_intercept, request): X, y = request.getfixturevalue(data) clf = SGDClassifier(loss="squared_hinge", multiclass=True, learning_rate="constant", eta0=1e-3, fit_intercept=fit_intercept, random_state=0) clf.fit(X, y) assert clf.score(X, y) > 0.78
def test_multiclass_sgd(): clf = SGDClassifier(random_state=0) clf.fit(mult_dense, mult_target) assert_greater(clf.score(mult_dense, mult_target), 0.80) assert_equal(list(clf.classes_), [0, 1, 2])
def test_multiclass_sgd(): clf = SGDClassifier(random_state=0) clf.fit(mult_dense, mult_target) assert_greater(clf.score(mult_dense, mult_target), 0.80)
def test_multiclass_sgd(): clf = SGDClassifier(random_state=0) clf.fit(mult_dense, mult_target) assert clf.score(mult_dense, mult_target) > 0.80 assert list(clf.classes_) == [0, 1, 2]