Skip to content

Commit

Permalink
Back to the old way for now
Browse files Browse the repository at this point in the history
  • Loading branch information
lmcinnes committed Sep 7, 2019
1 parent 70bc1e5 commit 687d28b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion umap/umap_.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ def nearest_neighbors(
if metric == "precomputed":
# Note that this does not support sparse distance matrices yet ...
# Compute indices of n nearest neighbors
knn_indices = fast_knn_indices(X, n_neighbors)
# knn_indices = fast_knn_indices(X, n_neighbors)
knn_indices = np.argsort(X)[:, :n_neighbors]
# Compute the nearest neighbor distances
# (equivalent to np.sort(X)[:,:n_neighbors])
knn_dists = X[np.arange(X.shape[0])[:, None], knn_indices].copy()
Expand Down
3 changes: 2 additions & 1 deletion umap/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def fast_knn_indices(X, n_neighbors):
"""
knn_indices = np.empty((X.shape[0], n_neighbors), dtype=np.int32)
for row in numba.prange(X.shape[0]):
v = np.argsort(X[row]) # Need to call argsort this way for numba
# v = np.argsort(X[row]) # Need to call argsort this way for numba
v = X[row].argsort(kind='quicksort')
v = v[:n_neighbors]
knn_indices[row] = v
return knn_indices
Expand Down

0 comments on commit 687d28b

Please sign in to comment.