Skip to content

Commit

Permalink
lobpcg for spectral; back to parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
lmcinnes committed Oct 6, 2018
1 parent 16e7ce6 commit bdd80d3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
20 changes: 13 additions & 7 deletions umap/spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,20 @@ def spectral_layout(data, graph, dim, random_state, metric="euclidean", metric_k
k = dim + 1
num_lanczos_vectors = max(2 * k + 1, int(np.sqrt(graph.shape[0])))
try:
eigenvalues, eigenvectors = scipy.sparse.linalg.eigsh(
# eigenvalues, eigenvectors = scipy.sparse.linalg.eigsh(
# L,
# k,
# which="SM",
# ncv=num_lanczos_vectors,
# tol=1e-4,
# v0=np.ones(L.shape[0]),
# maxiter=graph.shape[0] * 5,
# )
eigenvalues, eigenvectors = scipy.sparse.linalg.lobpcg(
L,
k,
which="SM",
ncv=num_lanczos_vectors,
tol=1e-4,
v0=np.ones(L.shape[0]),
maxiter=graph.shape[0] * 5,
random_state.normal(size=(L.shape[0], k)),
largest=False,
tol=1e-4
)
order = np.argsort(eigenvalues)[1:k]
return eigenvectors[:, order]
Expand Down
2 changes: 1 addition & 1 deletion umap/umap_.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ def rdist(x, y):
return result


@numba.njit(fastmath=True)
@numba.njit(fastmath=True, parallel=True)
def optimize_layout(
head_embedding,
tail_embedding,
Expand Down

0 comments on commit bdd80d3

Please sign in to comment.