def test_estimator_param_raises(): class Dummy(sklearn.base.BaseEstimator): def __init__(self, estimator=42): self.estimator = estimator def fit(self, X): return self clf = Incremental(Dummy(estimator=1)) with pytest.raises(ValueError, match='used by both'): clf.get_params()
def test_set_params(): clf = Incremental(SGDClassifier()) clf.set_params(**{"scoring": "accuracy", "estimator__max_iter": 20}) result = clf.get_params() assert result["estimator__max_iter"] == 20 assert result["scoring"] == "accuracy"
def test_set_params(): clf = Incremental(SGDClassifier()) clf.set_params(**{'scoring': 'accuracy', 'estimator__max_iter': 20}) result = clf.get_params() assert result['estimator__max_iter'] == 20 assert result['scoring'] == 'accuracy'
def test_get_params(): clf = Incremental(SGDClassifier()) result = clf.get_params() assert "estimator__max_iter" in result assert result["scoring"] is None