scikit-learn: LocalOutlierFactor exposes methods that it shouldn't

Describe the issue linked to the documentation

The LocalOutlierFactor class (and hence documentation) exposes methods that it probably shouldn’t:

https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.LocalOutlierFactor.html#sklearn.neighbors.LocalOutlierFactor.kneighbors https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.LocalOutlierFactor.html#sklearn.neighbors.LocalOutlierFactor.kneighbors_graph

these appear to be inherited from the parent class, and should not be exposed.

Suggest a potential alternative/fix

Rather than using KNeighborsMixin and NeighborsBase, the implementation should probably just use an instance of a nearest neighbor search internally, and not expose this as part of the local outlier factor API.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 17 (16 by maintainers)

Most upvoted comments

Hiding them in the documentation is a hack, not a solution: The methods will still show up in tab completion in IDEs, and still pollute the API.