def test_corrupted_classif(loss, weighting, k, c, multi_class): clf = RobustWeightedClassifier( loss=loss, max_iter=100, weighting=weighting, k=k, c=c, multi_class=multi_class, random_state=rng, ) clf.fit(X_cc, y_cc) score = clf.score(X_cc, y_cc) assert score > 0.8
def test_not_robust_classif(loss, weighting, multi_class): clf = RobustWeightedClassifier( loss=loss, max_iter=100, weighting=weighting, k=0, c=1e7, burn_in=0, multi_class=multi_class, random_state=rng, ) clf_not_rob = SGDClassifier(loss=loss, random_state=rng) clf.fit(X_c, y_c) clf_not_rob.fit(X_c, y_c) pred1 = clf.predict(X_c) pred2 = clf_not_rob.predict(X_c) assert np.mean((pred1 > 0) == (pred2 > 0)) > 0.8 assert clf.score(X_c, y_c) == np.mean(pred1 == y_c)