Replies: 1 comment 2 replies
-
Mostly what you will lose (should you work around it) is the ability to
transform new data -- you need the pynndescent index for that. So you can
likely fudge your way past that error and have a basic fit_transform work,
but other things such as transform and inverse transform will likely break
in strange ways if you were to try and use them. On the other hand there
are some DTW distance implementations that may work with UMAP. There's this
one: https://gist.github.com/kylemcdonald/76b6f18fb4026e01196282b59bd31e7e,
and the softdtw library uses JAX which I think you can make play nice with
numba. Finally, if you do have a good DTW implementation you like we can
try to get it suitably numba jitted and included in pynndescent so you can
just use ``metric="DTW"`` in future.
…On Sun, Jul 10, 2022 at 7:27 AM kimartin ***@***.***> wrote:
Hi, just a small question: is it possible (or sensible) to use a
precomputed k-nn when using metric = "precomputed"?
In my use case I computed the distance matrix ahead of time (as I use DTW
for distance between spectrograms, it was easier to optimise without trying
to make it usable inside UMAP).
I want to test several parameter combinations for UMAP, and I saw the
'Precomputed k-nn' documentation that may possibly help accelerate UMAP
computation.
However:
when I pre-compute the k-nn graph using umap.umap_.nearest_neighbors:
knn_graph = nearest_neighbors(distance_matrix,
n_neighbors=max_n_neighbors,
metric="precomputed",
metric_kwds=None,
angular=False,
random_state=None)
then pass knn_graph to UMAP, I get the following error:
ValueError: precomputed_knn[2] (knn_search_index) must be an NNDescent
object.
Turns out that nearest_neighbors returns None for its last output when
'metric = "precomputed".
Would it be sensible to try to work around that somehow? Or am I not going
to gain anything because metric="precomputed"?
—
Reply to this email directly, view it on GitHub
<#888>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC3IUBNS2ZTDCLRDSZEYQJDVTKXQPANCNFSM53E32KZA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, just a small question: is it possible (or sensible) to use a precomputed k-nn when using metric = "precomputed"?
In my use case I computed the distance matrix ahead of time (as I use DTW for distance between spectrograms, it was easier to optimise without trying to make it usable inside UMAP).
I want to test several parameter combinations for UMAP, and I saw the 'Precomputed k-nn' documentation that may possibly help accelerate UMAP computation.
However:
when I pre-compute the k-nn graph using
umap.umap_.nearest_neighbors
:then pass
knn_graph
toUMAP
, I get the following error:ValueError: precomputed_knn[2] (knn_search_index) must be an NNDescent object.
Turns out that
nearest_neighbors
returnsNone
for its last output when 'metric = "precomputed".Would it be sensible to try to work around that somehow? Or am I not going to gain anything because
metric="precomputed"
?Beta Was this translation helpful? Give feedback.
All reactions