Skip to content

Commit

Permalink
Replace if else with a minimum comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-JG3 committed Oct 25, 2023
1 parent b89db4a commit afde81e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions sktime/transformations/series/_clasp_numba.py
Expand Up @@ -111,10 +111,8 @@ def _compute_distances_iterative(X, m, k):
)
dist[trivialMatchRange[0] : trivialMatchRange[1]] = np.inf

if k >= len(dist):
idx = np.argpartition(dist, len(dist) - 1)
else:
idx = np.argpartition(dist, k)
_k = min(k, len(dist) - 1)
idx = np.argpartition(dist, _k)

knns[order, :] = idx[:k]
dot_prev = dot_rolled
Expand Down

0 comments on commit afde81e

Please sign in to comment.