-
-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Closed
Labels
Description
Describe the bug
When calling get_params
on an Pipeline
or a ColumnTransformer
, it returns the steps as parameters as well. However, the docs for get_params says that only the arguments to __init__
will be returned. By having additional entries here, the output of get_params
can no longer be used to call __init__
.
Steps/Code to Reproduce
import sklearn.preprocessing
from sklearn.compose import ColumnTransformer
model_original = sklearn.pipeline.Pipeline(
steps=[("transform", 'passthrough')]
)
print(model_original.get_params().keys())
ct = ColumnTransformer(
[("continous", "passthrough", [])]
)
print(ct.get_params().keys())
params = ct.get_params()
ColumnTransformer(**params)
Expected Results
dict_keys(['memory', 'steps', 'verbose'])
dict_keys(['n_jobs', 'remainder', 'sparse_threshold', 'transformer_weights', 'transformers', 'verbose'])
Actual Results
dict_keys(['memory', 'steps', 'verbose', 'transform'])
dict_keys(['n_jobs', 'remainder', 'sparse_threshold', 'transformer_weights', 'transformers', 'verbose', 'continous'])
Traceback (most recent call last):
File "/home/feurerm/sync_dir/projects/openml/python/local/bug3.py", line 14, in <module>
ColumnTransformer(**params)
File "/home/feurerm/miniconda/3-4.5.4/envs/openml/lib/python3.7/site-packages/sklearn/utils/validation.py", line 72, in inner_f
return f(**kwargs)
TypeError: __init__() got an unexpected keyword argument 'continous'
Versions
Python 3.7.3 (default, Mar 27 2019, 22:11:17)
[GCC 7.3.0]
NumPy 1.17.0
SciPy 1.3.0
Scikit-Learn 0.23.2