-
-
Notifications
You must be signed in to change notification settings - Fork 256
/
test_normalize.py
31 lines (22 loc) · 997 Bytes
/
test_normalize.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import dask
import sklearn.datasets
import sklearn.linear_model
import sklearn.model_selection
import dask_ml # noqa
def test_normalize_estimator():
m1 = sklearn.linear_model.LogisticRegression(solver="lbfgs")
m2 = sklearn.linear_model.LogisticRegression(solver="lbfgs")
assert dask.base.tokenize(m1) == dask.base.tokenize(m2)
m1.fit(*sklearn.datasets.make_classification())
m2.fit(*sklearn.datasets.make_classification())
assert dask.base.tokenize(m1) != dask.base.tokenize(m2)
def test_normalize_estimator_cv():
param_grid = {"C": [0.01]}
a = sklearn.linear_model.LogisticRegression(random_state=0, solver="lbfgs")
m1 = sklearn.model_selection.GridSearchCV(a, param_grid, cv=3)
m2 = sklearn.model_selection.GridSearchCV(a, param_grid, cv=3)
assert dask.base.tokenize(m1) == dask.base.tokenize(m2)
X, y = sklearn.datasets.make_classification()
m1.fit(X, y)
m2.fit(X, y)
assert dask.base.tokenize(m1) == dask.base.tokenize(m2)