def test_sparsa_multitask_l1(): for data in (mult_dense, mult_csr): clf = SparsaClassifier(max_iter=500, penalty="l1", multiclass=False) clf.fit(data, mult_target) assert_almost_equal(clf.score(data, mult_target), 0.87, 2)
def test_sparsa_bin_l1(): for data in (bin_dense, bin_csr): clf = SparsaClassifier(max_iter=500, penalty="l1") clf.fit(data, bin_target) assert_greater(clf.score(data, bin_target), 0.95)
def test_sparsa_multiclass_l1l2(): for data in (mult_dense, mult_csr): clf = SparsaClassifier(max_iter=500, penalty="l1/l2", multiclass=True) clf.fit(data, mult_target) assert_almost_equal(clf.score(data, mult_target), 0.97)