コード例 #1
0
ファイル: test_incremental.py プロジェクト: convexset/dask-ml
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()
コード例 #2
0
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"
コード例 #3
0
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'
コード例 #4
0
def test_get_params():
    clf = Incremental(SGDClassifier())
    result = clf.get_params()

    assert "estimator__max_iter" in result
    assert result["scoring"] is None