Skip to content

Commit 691dbfa

Browse files
authored
Merge pull request #78 from YingfanWang/hotfix
Release 0.7.4
2 parents 3637bc5 + 5e17ab6 commit 691dbfa

22 files changed

+128
-113
lines changed

.github/workflows/python-package-conda.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

demo/basic_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
# Initialize the pacmap instance
1313
# By default, the n_neighbors is set to 10.
1414
# Setting n_neighbors to "None" can enable an automatic parameter selection
15-
# choice shown in "parameter" section of the README file.
15+
# choice shown in "parameter" section of the README file.
1616
# Notice that from v0.6.0 on, we rename the n_dims parameter to n_components.
17-
reducer = pacmap.PaCMAP(n_components=2, n_neighbors=10, MN_ratio=0.5, FP_ratio=2.0)
17+
reducer = pacmap.PaCMAP(n_components=2, n_neighbors=10, MN_ratio=0.5, FP_ratio=2.0)
1818

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

demo/demo_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
import matplotlib.pyplot as plt
22

3+
34
def generate_figure(embedding, labels, title):
45
fig, ax = plt.subplots(1, 1, figsize=(6, 6))
56
ax.scatter(embedding[:, 0], embedding[:, 1], s=0.5, c=labels, cmap='Spectral')
67
ax.axis('off')
78
ax.set_title(title)
89
plt.savefig(f"./{title}.png")
910

11+
1012
def generate_combined_figure(embeddings, labels, titles, theme_title):
1113
len_subfigs = len(embeddings)
1214
assert len(labels) == len_subfigs
1315
assert len(titles) == len_subfigs
1416
n_rows = (len_subfigs + 2) // 3
15-
fig, axes = plt.subplots(n_rows, 3, figsize = (18, n_rows * 6))
17+
fig, axes = plt.subplots(n_rows, 3, figsize=(18, n_rows * 6))
1618
axes = axes.flatten()
1719
for i in range(len_subfigs):
1820
ax = axes[i]

demo/specify_nn_demo.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323

2424
nbrs = np.zeros((n, 20), dtype=np.int32)
2525
for i in range(n):
26-
nbrs_ = tree.get_nns_by_item(i, 20 + 1) # The first nbr is always the point itself
26+
nbrs_ = tree.get_nns_by_item(i, 20 + 1) # The first nbr is always the point itself
2727
nbrs[i, :] = nbrs_[1:]
2828

29-
scaled_dist = np.ones((n, n_neighbors)) # No scaling is needed
29+
scaled_dist = np.ones((n, n_neighbors)) # No scaling is needed
3030

3131
# Type casting is needed for numba acceleration
3232
X = X.astype(np.float32)
@@ -37,7 +37,11 @@
3737

3838
# initializing the pacmap instance
3939
# feed the pair_neighbors into the instance
40-
embedding = pacmap.PaCMAP(n_components=2, n_neighbors=n_neighbors, MN_ratio=0.5, FP_ratio=2.0, pair_neighbors=pair_neighbors)
40+
embedding = pacmap.PaCMAP(n_components=2,
41+
n_neighbors=n_neighbors,
42+
MN_ratio=0.5,
43+
FP_ratio=2.0,
44+
pair_neighbors=pair_neighbors)
4145

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

demo/transform_demo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import pacmap
1010
import numpy as np
1111
from sklearn.model_selection import StratifiedKFold
12-
from demo_utils import *
12+
import demo_utils
1313

1414

1515
# MNIST
@@ -25,7 +25,7 @@
2525
X_train, X_test = mnist[train_index], mnist[test_index]
2626
y_train, y_test = labels[train_index], labels[test_index]
2727
break
28-
28+
2929
# Initialize the instance
3030
reducer = pacmap.PaCMAP(n_components=2, n_neighbors=10, MN_ratio=0.5, FP_ratio=2.0, random_state=20, save_tree=False)
3131

@@ -41,4 +41,4 @@
4141
embeddings = [embedding, embedding_test, embedding_combined]
4242
labelset = [y_train, y_test, y]
4343
titles = ['Training', 'Test', 'Combined']
44-
generate_combined_figure(embeddings, labelset, titles, f'mnist_transform_{n}')
44+
demo_utils.generate_combined_figure(embeddings, labelset, titles, f'mnist_transform_{n}')

evaluation/evaluation.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# pylint: skip-file
2+
# flake8: noqa
13
import os
24
import json
35
import matplotlib.cm as cm

experiments/FA2.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# pylint: skip-file
2+
# flake8: noqa
13
import os
24
import json
35
import numpy as np
@@ -7,6 +9,7 @@
79
from fa2 import ForceAtlas2 as FA2
810
from sklearn.preprocessing import scale
911
from sklearn.decomposition import PCA
12+
from sklearn.neighbors import NearestNeighbors
1013

1114
def transform_by_FA2(X, n_neighbors=6):
1215
if X.shape[1] > 100:

experiments/run_experiments.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# pylint: skip-file
2+
# flake8: noqa
13
import umap
24
import trimap
35
import FlowCal

experiments/run_experiments_LargeVis.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# pylint: skip-file
2+
# flake8: noqa
13
import FlowCal
24
import pandas as pd
35

experiments/run_experiments_tSNE.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# pylint: skip-file
2+
# flake8: noqa
13
import FlowCal
24
import json
35

0 commit comments

Comments
 (0)