question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi! thanks for implementing UMAP it’s very handy! When serializing a trained UMAP object via pickle I had the following error:

pickle.dump(myumap, open('pickle.pkl', 'w'))
TypeError: a class that defines __slots__ without defining __getstate__ cannot be pickled

A workaround I’ve found is:

pickle.dump(myumap, open('pickle.pkl', 'w'), protocol=-1)

Do you think it is safe? Is there a better/recommended serialization approach?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
lefnirecommented, Aug 1, 2020

bump. I need to use loaded umap (pickle, joblib, etc) for inference (“You’ll only need [._rp_trees] it if you want to transform new data”). I think that might be a main reason people would want to serialize incidentally; future inference. Thanks for the project!

1reaction
lmcinnescommented, Jan 25, 2020

I think the simplest thing is to delete the _rp_trees attribute. You’ll only need it if you want to transform new data, and for the use cases you describe that should be fine. I’ll try to figure out a more long term fix when I get some time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

UMapBuildDataRegistry::Serialize
Handles reading, writing, and reference collecting using FArchive. This implementation handles all FProperty serialization, but can be overridden for native ...
Read more >
How to Use UMAP — umap 0.5 documentation
If you are not so familiar with sklearn this tutorial will step you through the basics of using UMAP to transform and visualise...
Read more >
UMAP
public class UMAP extends java.lang.Object implements java.io.Serializable. Uniform Manifold Approximation and Projection. UMAP is a dimension reduction ...
Read more >
Asset Serialization (Text based uAsset and uMap) - Reddit
Asset Serialization (Text based uAsset and uMap). Hey all, I've been moving over from using Unity to Unreal for the past couple months....
Read more >
Saving Sklearn Model to Pickle - Pema Grg
Saving the model and vectorizer as pickle. The pickle module implements binary protocols for serializing and de-serializing a Python object structure.“Pickling” ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found