Skip to content

[Feature Request] Add kneighbors_graph method to all transformers supporting mode={"connectivity", "distance"} and include_self={True,False} #41

Open
@jolespin

Description

@jolespin

I'm trying to adapt some methods that use kneighbors_graph from scikit-learn but I need access to the mode=connectivity and include_self=True which are not supported in the current fit methods. Here's some more details on the problem: https://stackoverflow.com/questions/78486997/how-to-reproduce-kneighbors-graphinclude-self-true-using-kneighborstransfor . My goal is to speed up some DiffusionMap algorithms that use KNN methods but I need the connectivity and include_self options.

Here's the docs:
https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.kneighbors_graph.html#sklearn.neighbors.kneighbors_graph

mode{‘connectivity’, ‘distance’}, default=’connectivity’
Type of returned matrix: ‘connectivity’ will return the connectivity matrix with ones and zeros, and ‘distance’ will return the distances between neighbors according to the given metric.

include_selfbool or ‘auto’, default=False
Whether or not to mark each sample as the first nearest neighbor to itself. If ‘auto’, then True is used for mode=’connectivity’ and False for mode=’distance’.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions