Skip to content

Commit 0a5a491

Browse files
committed
fix number format for pynndescent.NNDescent
1 parent 8217580 commit 0a5a491

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mellon/parameters.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
DEFAULT_SIGMA,
3737
)
3838
from .validation import (
39+
validate_array,
3940
validate_time_x,
4041
validate_positive_float,
4142
validate_float_or_int,
@@ -375,6 +376,7 @@ def compute_distances(x, k, seed=DEFAULT_RANDOM_SEED):
375376
The returned result discards the self-distance (first column). The `seed` parameter controls
376377
the random state used to initialize the NNDescent index.
377378
"""
379+
x = validate_array(x, "x")
378380
x = ensure_2d(x)
379381
n_samples = x.shape[0]
380382

@@ -387,8 +389,10 @@ def compute_distances(x, k, seed=DEFAULT_RANDOM_SEED):
387389

388390
# The nearest neighbor of a point is itself, so request k+1 neighbors.
389391
index = pynndescent.NNDescent(
390-
x, n_neighbors=k + 1, metric="euclidean", random_state=seed
392+
x, n_neighbors=k + 1,
393+
metric="euclidean",
391394
)
395+
392396
_, distances = index.neighbor_graph
393397
return distances[:, 1:]
394398

0 commit comments

Comments
 (0)