We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
preprocessing.OrdinalEncoder
river version: 0.22.0 Python version: 3.10.12 (google colab) Operating system: Linux (google colab)
Cannot pickle preprocessing.OrdinalEncoder instance
import pickle from river import preprocessing X = [ {"country": "France", "place": "Taco Bell"}, {"country": None, "place": None}, {"country": "Sweden", "place": "Burger King"}, {"country": "France", "place": "Burger King"}, {"country": "Russia", "place": "Starbucks"}, {"country": "Russia", "place": "Starbucks"}, {"country": "Sweden", "place": "Taco Bell"}, {"country": None, "place": None}, ] encoder = preprocessing.OrdinalEncoder() for x in X: print(encoder.transform_one(x)) encoder.learn_one(x) with open("encoder.pkl", "wb") as f: pickle.dump(encoder, f)
{'country': 0, 'place': 0} {'country': -1, 'place': -1} {'country': 0, 'place': 0} {'country': 1, 'place': 2} {'country': 0, 'place': 0} {'country': 3, 'place': 3} {'country': 2, 'place': 1} {'country': -1, 'place': -1} --------------------------------------------------------------------------- TypeError Traceback (most recent call last) [<ipython-input-3-fa4773e7a2b5>](https://localhost:8080/#) in <cell line: 21>() 20 21 with open("encoder.pkl", "wb") as f: ---> 22 pickle.dump(encoder, f) TypeError: cannot pickle 'generator' object
The problematic generator seems to be this one.
river/river/preprocessing/ordinal.py
Lines 13 to 14 in 5531ae5
The text was updated successfully, but these errors were encountered:
Good catch!
Sorry, something went wrong.
No branches or pull requests
river version: 0.22.0
Python version: 3.10.12 (google colab)
Operating system: Linux (google colab)
Describe the bug
Cannot pickle
preprocessing.OrdinalEncoder
instanceSteps/code to reproduce
The problematic generator seems to be this one.
river/river/preprocessing/ordinal.py
Lines 13 to 14 in 5531ae5
The text was updated successfully, but these errors were encountered: