lmcinnes / lmcinnes/umap

Can't pickle AlignedUMAP

Open
#672 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
8.3k
Forks
871
Avg merge
1d 13h
Merged PRs (30d)
5

Description

Hey,

First thanks for this awesome repo and biblio, I really enjoyed dive in the doc !

I experienced an issue when I wanted to save the AlignedUMAP function. Here some sample code to reproduce:

```python
import umap.aligned_umap
import pickle

aligned_mapper_10D = umap.AlignedUMAP(metric='cosine', n_components=10, n_neighbors=50,
init='spectral', transform_seed=42, random_state=11)

n = 400
X = np.random.normal(0, 1, (1000, 50))
Y = np.random.normal(0, 1, (500, 50))
Y = np.concatenate((X[-n:], Y))
relations = {600+i: i for i in range(n)}

aligned_mapper_10D.fit([X, Y], relations=[relations])
pickle.dump(aligned_mapper_10D, open(join(PATH_DATA, 'test.pkl'), 'wb'))
```

And I got the following error:
```python
TypeError: cannot pickle '_nrt_python._MemInfo' object
```

I saw it could be related to the #273 issue, but I could not manage to solve it. Has anyone succeeded in solving it?

I also add my versions of packages:

```
numba==0.52
umap==0.5.1
pynndescent==0.5.2
```

Thanks,

Arnault

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied AlignedUMAP reproduction with the listed Python package versions and inspect where pickle.dump encounters the _nrt_python._MemInfo object. Check whether the fitted AlignedUMAP object can be serialized and restored without the TypeError; the issue is resolved when the save and load workflow succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.