Skip to content

Commit

Permalink
rewrote chained comparisons in _optimize_layout_aligned_euclidean_sin…
Browse files Browse the repository at this point in the history
…gle_epoch
  • Loading branch information
parashardhapola committed Jul 29, 2021
1 parent 3992e96 commit 4201631
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ scipy>=1.3.1
scikit-learn>=0.22
numba>=0.51.2
pynndescent>=0.5
tbb>=2019.0
tbb>=2019.0
tqdm
14 changes: 3 additions & 11 deletions umap/layouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,9 +860,7 @@ def _optimize_layout_aligned_euclidean_single_epoch(
for offset in range(-window_size, window_size):
neighbor_m = m + offset
if (
neighbor_m >= 0
and neighbor_m < n_embeddings
and offset != 0
n_embeddings > neighbor_m >= 0 != offset
):
identified_index = relations[m, offset + window_size, j]
if identified_index >= 0:
Expand All @@ -884,9 +882,7 @@ def _optimize_layout_aligned_euclidean_single_epoch(
for offset in range(-window_size, window_size):
neighbor_m = m + offset
if (
neighbor_m >= 0
and neighbor_m < n_embeddings
and offset != 0
n_embeddings > neighbor_m >= 0 != offset
):
identified_index = relations[m, offset + window_size, k]
if identified_index >= 0:
Expand Down Expand Up @@ -940,11 +936,7 @@ def _optimize_layout_aligned_euclidean_single_epoch(

for offset in range(-window_size, window_size):
neighbor_m = m + offset
if (
neighbor_m >= 0
and neighbor_m < n_embeddings
and offset != 0
):
if n_embeddings > neighbor_m >= 0 != offset:
identified_index = relations[m, offset + window_size, j]
if identified_index >= 0:
grad_d -= clip(
Expand Down

0 comments on commit 4201631

Please sign in to comment.