Skip to content
New issue

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

CosineRecommender isn't pickable #191

Closed
marinkreso opened this issue Mar 18, 2019 · 4 comments
Closed

CosineRecommender isn't pickable #191

marinkreso opened this issue Mar 18, 2019 · 4 comments

Comments

@marinkreso
Copy link

I created CosineRecommender model and fitted it to my dataset. When I try to pickle the fitted model with pickle.dumps(model) I get TypeError: no default __reduce__ due to non-trivial __cinit__ error in because of NearestNeighboursScorer.reduce_cython() method.

Pickling AlternatingLeastSquares model works great.

Is there a way to pickle CosineRecommender model or to use some other serialization method for serializing this object/model?

@mohjeih
Copy link

mohjeih commented Mar 24, 2019

I have encountered recently the same issue as you. My quick solution which definitely is not the best one is as follows: assign model scorer to a temporary variable, assign 0 to the model scorer, pickle the fitted model, and finally assign the value of the temporary variable to the model scorer. Hopefully, this issue will be fixed in the future versions.

@benfred
Copy link
Owner

benfred commented Jul 13, 2019

This PR adds support for pickling knn models: #229

@benfred
Copy link
Owner

benfred commented Jul 13, 2019

fix is in v0.3.9

@benfred benfred closed this as completed Jul 13, 2019
@marinkreso
Copy link
Author

marinkreso commented Jul 14, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants