Compositions return individual steps as part of get_params
See original GitHub issueDescribe 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
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (16 by maintainers)
Top Results From Across the Web
TF1 Class Reference - ROOT
Returns the first derivative of the function at point x, computed by Richardson's extrapolation method (use 2 derivative estimates to compute a third,...
Read more >How to get route url params in a page in Nuxt2 and 3?
It will be called server-side once (on the first request to the Nuxt app) and client-side when navigating to further routes. ref.
Read more >AudioManager - Android Developers
Return value for getDirectPlaybackSupport(android.media.AudioFormat, android.media.AudioAttributes) : direct offload playback supported with gapless ...
Read more >Passing parameters to routes - React Navigation
Pass params to a route by putting them in an object as a second parameter to the navigation.navigate function: navigation.navigate('RouteName', { /* params...
Read more >parse_url - Manual - PHP
This function parses a URL and returns an associative array containing any of the various components of the URL that are present.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I made a proposal there: https://github.com/scikit-learn/scikit-learn/pull/18285
deep
is useful forget_params
andset_params
to be more explicit regarding what will be returned or set.I think that would be great.