[FEATURE] DictMapper
See original GitHub issueIn this example you pass the transformer a column to transform but also a dict. In this case you’d pass;
{'young': 1, 'adult': 2, 'old': 3}
A transformer that transformers based on a dictionary. I don’t know if sklearn has this feature but I couldn’t find it.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
dictmapper - PyPI
dictmapper was created to help transforming a sequence of python dictionaries to tabular format and specifically to transform json documents ...
Read more >Source code for sklego.preprocessing.dictmapper
[docs]class DictMapper(TransformerMixin, BaseEstimator): """ Map the values of values of columns according to the input dictionary, fall back to the default ...
Read more >tfsnippet.modules — TFSnippet 0.1.2 documentation
This module is a branch module, which maps the inputs into a list of outputs, according to the specified mapper list. Each item...
Read more >scikit-lego/readme.md at main - GitHub
DeadZoneRegressor experimental feature that has a deadzone in the cost ... DictMapper assign numeric values on categorical columns; sklego.preprocessing.
Read more >xyz.josephcz.dictmapper - Python package | Snyk
Learn more about xyz.josephcz.dictmapper: package health score, popularity, ... The encoding is a parameter of python built-in function open (See: Python ...
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 FreeTop 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
Top GitHub Comments
@kayhoogland this is why I usually wait until @MBrouns gives feedback before I implement something 😉.
From my end: I’ve tried using the Ordinal Encoder in the past but it is not an intuitive API.
I can imagine if you map strings to numeric values you could surely get some gridsearch value out of it though. I like you could enfore monotonicity across a discrete variable this way and how you might add the hard “up-down-up” shape too if you’d like.
Suppose you’d use these mappings in a disease suseptibility study, I can imagine it can be use-ful to gridsearch.
Some things that might be worth discussing:
Why does this need to live in a transformer? I don’t expect to
gridsearch
over it and it doesn’t contain learned properties as far as I can tell.Isn’t this what the OrdinalEncoder in sklearn does?