YingfanWang/PaCMAP

Possible bug: plotting intermediate snapshots

Closed this issue · 3 comments

pirao commented

I am currently working on a numerical dataset with 42359 rows and 12 columns and would like to apply PaCMAP to it and visualize the intermediate snapshots during training. I applied the code below, where df_scaled is my dataset after applying StandardScaler().

embedding1 = pacmap.PaCMAP(n_components=2, n_neighbors=10,MN_ratio=0.5, FP_ratio=2.0,
random_state=20, save_tree=False,
intermediate=True,
verbose=1)

X_transformed1 = embedding1.fit_transform(df_scaled, init="pca")


The output was:

X is normalized
PaCMAP(n_neighbors=10, n_MN=5, n_FP=20, distance=euclidean, lr=1.0, n_iters=450, apply_pca=True, opt_method='adam', verbose=1, intermediate=True, seed=20)
Finding pairs
Found nearest neighbor
Calculated sigma
Found scaled dist
Pairs sampled successfully.

File c:\Users\arthu\anaconda3\envs\dr_visualization\lib\site-packages\pacmap\pacmap.py:530, in pacmap(X, n_dims, pair_neighbors, pair_MN, pair_FP, lr, num_iters, Yinit, verbose, intermediate, inter_snapshots, pca_solution, tsvd)

[526](file:///c%3A/Users/arthu/anaconda3/envs/dr_visualization/lib/site-packages/pacmap/pacmap.py?line=525) n, _ = X.shape
[528](file:///c%3A/Users/arthu/anaconda3/envs/dr_visualization/lib/site-packages/pacmap/pacmap.py?line=527) if intermediate:
[529](file:///c%3A/Users/arthu/anaconda3/envs/dr_visualization/lib/site-packages/pacmap/pacmap.py?line=528)     intermediate_states = np.empty(

--> 530 (len(inter_snapshots), n, n_dims), dtype=np.float32)
531 else:
532 intermediate_states = None

TypeError: object of type 'bool' has no len()

Can you guys help me solve this issue? I think my problem is in len(inter_snapshots) but it should be already known.

I will look into this and try to replicate the problem locally.

There is a potential bug in the code and a hotfix will be updated shortly. Thanks for reporting!

Problem fixed in v 0.6.5.