Skip to content

Commit

Permalink
ensure that pipelines share structure
Browse files Browse the repository at this point in the history
  • Loading branch information
mrocklin committed Sep 21, 2015
1 parent 44a9eeb commit 63e0e5f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions dask/learn/tests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import dask
import dask.learn as dl
import dask.imperative as di
from toolz import merge

X, y = make_blobs()

Expand Down Expand Up @@ -38,3 +39,19 @@ def test_pipeline():
sk_y2 = skpipeline.predict(X)
sk_score = skpipeline.score(X, y)
assert sk_score == score.compute()


def test_pipeline_shares_structure():
pipeline = dl.Pipeline([("scale", StandardScaler()),
("fdr", SelectFdr()),
("svm", LinearSVC())])

pipeline.fit(X, y)
score = pipeline.score(X, y)

pipeline.set_params(svm__C=0.1)
pipeline.fit(X, y)
score2 = pipeline.score(X, y)

assert len(merge(score.dask, score2.dask)) <= len(score.dask) + 3
assert score.key != score2.key

0 comments on commit 63e0e5f

Please sign in to comment.