lmcinnes / lmcinnes/umap

cannot set init parameter to pca

Open
#994 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.3k
Forks
871
Avg merge
1d 13h
Merged PRs (30d)
5

Description

I have installed umap-learn==0.5.3 with python 3.10

```
% pip list
Package Version
--------------- -------
colorama 0.4.6
joblib 1.2.0
llvmlite 0.39.1
numba 0.56.3
numpy 1.23.4
pandas 2.0.0
pip 22.3.1
pynndescent 0.5.8
python-dateutil 2.8.2
pytz 2023.3
scikit-learn 1.1.3
scipy 1.9.3
setuptools 65.5.1
six 1.16.0
threadpoolctl 3.1.0
tqdm 4.64.1
tzdata 2023.3
umap-learn 0.5.3
wheel 0.38.4
```

tried to run a simple umap conversion with init parameter set to **'pca'**

```
import umap as umap
from umap import UMAP
umap_nd = UMAP(n_components=components,
init='pca',
random_state=42,
n_neighbors=n_neighbors,
min_dist=min_dist
)
print(umap.__version__)
proj_nd = umap_nd.fit(data_df.values)
```

the print output is saying its version **0.5.3**
but it is giving error as below (sharing snippet)

```
proj_nd = umap_nd.fit(data_df.values)
File "/home/.pyenv/versions/anaconda3-5.3.1/envs/project-p/lib/python3.10/site-packages/umap/umap_.py", line 2290, in fit
self._validate_parameters()
File "/home/versions/anaconda3-5.3.1/envs/project-p/lib/python3.10/site-packages/umap/umap_.py", line 1704, in _validate_parameters
raise ValueError('string init values must be "spectral" or "random"')
ValueError: string init values must be "spectral" or "random"
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported UMAP 0.5.3 failure with Python 3.10 and init='pca' using the provided environment. Inspect umap/umap_.py around _validate_parameters at line 1704, then determine whether PCA initialization should be supported; done when the intended behavior is enforced and covered by the relevant validation or regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.