[SciPy-User] sparse distance matrix ?

Emanuele Olivetti emanuele at relativita.com
Thu Apr 10 10:07:46 EDT 2014


On 04/06/2014 02:34 PM, josef.pktd at gmail.com wrote:
> (sunday morning puzzle)
>
> Is there a way to get thresholded distance matrices as sparse matrices
> without going through the full dense distance array or explicit
> looping?
>
>

There is something like that in scikit.learn: kneighbors_graph() and
radius_neighbors_graph(), with the argument mode='distance':

http://scikit-learn.org/stable/modules/generated/sklearn.neighbors.kneighbors_graph.html#sklearn.neighbors.kneighbors_graph
http://scikit-learn.org/stable/modules/generated/sklearn.neighbors.radius_neighbors_graph.html#sklearn.neighbors.radius_neighbors_graph

Best,

Emanuele





More information about the SciPy-User mailing list