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

Error running test code #56

Closed
morgansobol opened this issue Aug 25, 2023 · 5 comments
Closed

Error running test code #56

morgansobol opened this issue Aug 25, 2023 · 5 comments

Comments

@morgansobol
Copy link

Hi there,

I am trying to run this test code:

import pacmap
print('pacmap version:', pacmap.__version__)
import numpy as np
print('numpy version:', np.__version__)
import numba as nb
print('numba version:', nb.__version__)
import matplotlib.pyplot as plt

# loading preprocessed coil_20 dataset
# you can change it with any dataset that is in the ndarray format, with the shape (N, D)
# where N is the number of samples and D is the dimension of each sample
X = np.load("./data/coil_20.npy", allow_pickle=True)
X = X.reshape(X.shape[0], -1)
y = np.load("./data/coil_20_labels.npy", allow_pickle=True)

# initializing the pacmap instance
# Setting n_neighbors to "None" leads to a default choice shown below in "parameter" section
embedding = pacmap.PaCMAP(n_components=2, n_neighbors=None, MN_ratio=0.5, FP_ratio=2.0)

# fit the data (The index of transformed data corresponds to the index of the original data)
X_transformed = embedding.fit_transform(X, init="pca")

# visualize the embedding
fig, ax = plt.subplots(1, 1, figsize=(6, 6))
ax.scatter(X_transformed[:, 0], X_transformed[:, 1], cmap="Spectral", c=y, s=0.6)

However, I get this error

/Users/Morgan/miniconda3/envs/pacmap/lib/python3.11/site-packages/pacmap/pacmap.py:96: NumbaPendingDeprecationWarning: The 'old_style' error capturing is deprecated and will be replaced by new_style in a future release.
j = np.random.randint(maximum)
OMP: Info #276: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead.
/Users/Morgan/miniconda3/envs/pacmap/lib/python3.11/site-packages/pacmap/pacmap.py:143: NumbaPendingDeprecationWarning: The 'old_style' error capturing is deprecated and will be replaced by new_style in a future release.
sampled = np.random.randint(0, n, 6)
/Users/Morgan/miniconda3/envs/pacmap/lib/python3.11/site-packages/pacmap/pacmap.py:166: NumbaPendingDeprecationWarning: The 'old_style' error capturing is deprecated and will be replaced by new_style in a future release.
sampled = np.random.randint(0, n, 6)

Which seems to be attributed to numba, but I have tried with 0.57.0 (the one originally installed with conda) and the upgraded 0.58.0. Both give an error.

Not sure how to fix or what versions are needed here to be compatible.

Thanks,
Morgan

@hyhuang00
Copy link
Collaborator

Thank you for your interest in PaCMAP! Both of the warnings seems to be related with numba version, but it looks like these warnings are not fatal. Is there any other error output? I will try to replicate this issue locally.

@hyhuang00
Copy link
Collaborator

I tried out this script locally with a fresh conda environment, installed with the latest pacmap.

pacmap version: 0.7.0
numpy version: 1.24.4
numba version: 0.57.1

Your script successfully finished without any error. From your log, it seems like there is some compatibility with the numpy's random module. Would you be able to provide more information on the error?

@morgansobol
Copy link
Author

I did a fresh install as you did, and now it works!
Sorry, I should have tried that first.
Thanks again!

@hyhuang00
Copy link
Collaborator

Happy to hear that! Just want to confirm -- did you try to install pacmap on an existing environment, and get some error messages?

@morgansobol
Copy link
Author

morgansobol commented Aug 29, 2023 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

2 participants