How to use a precomputed distance matrix in Scikit KMeans?
Asked Answered
A

1

6

I'm new to scikit.
I can't find an example using a precomputed distance matrix in Scikit KMeans.
Could anybody shed a light now this, better with an example?

Allen answered 3/7, 2014 at 18:21 Comment(2)
Wrong site for an open-ended question like this. Please review our help files to see what kinds of questions are wanted and unwanted here.Seeger
You can't unless you hack up the code. K-means is tied to Euclidean distances for speed reasons.Slipperwort
G
1

Scikit-learn does not allow you to pass in a custom (precomputed) distance matrix. It can precompute Euclidean distance matrix to speed-up the process, but there's no way to use your own one without hacking the source.

Gory answered 20/4, 2015 at 11:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.