Skip to content

Commit

Permalink
Merge pull request #417 from datajanko/poly-bug-fix
Browse files Browse the repository at this point in the history
[MRG] Bug-Fix in Polynomial-Features
  • Loading branch information
TomAugspurger authored Oct 30, 2018
2 parents ce6b337 + d716725 commit 33c9438
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dask_ml/preprocessing/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,11 @@ def __init__(
self.preserve_dataframe = preserve_dataframe

def fit(self, X, y=None):
self._transformer = skdata.PolynomialFeatures()
self._transformer = skdata.PolynomialFeatures(
degree=self.degree,
interaction_only=self.interaction_only,
include_bias=self.include_bias,
)
X_sample = X
if isinstance(X, dd.DataFrame):
X_sample = X._meta_nonempty
Expand Down
7 changes: 7 additions & 0 deletions tests/preprocessing/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,3 +553,10 @@ def test_df_transform(self, daskify):
assert_eq_df(res_df.compute().reset_index(drop=True), res_pandas)
assert_eq_ar(res_df.values, res_c)
assert_eq_ar(res_df.values, res_arr)

def test_transformer_params(self):
pf = dpp.PolynomialFeatures(degree=3, interaction_only=True, include_bias=False)
pf.fit(X)
assert pf._transformer.degree == pf.degree
assert pf._transformer.interaction_only is pf.interaction_only
assert pf._transformer.include_bias is pf.include_bias

0 comments on commit 33c9438

Please sign in to comment.