question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LocalOutlierFactor exposes methods that it shouldn't

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:17 (16 by maintainers)

github_iconTop GitHub Comments

2reactions
kno10commented, Sep 12, 2022

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.

0reactions
thomasjpfancommented, Nov 30, 2022

@oswinoswin The most acceptable solution is the one suggested in https://github.com/scikit-learn/scikit-learn/issues/21876#issuecomment-1243375277. I do not think it is a simple task for someone new. I recommend https://github.com/scikit-learn/scikit-learn/issues/24862 as a good first issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Local Outlier Factor only calculated for some points ...
normalising the data will help you in making more visible graphs and as per your code you have taken multipier of radius as...
Read more >
Choosing a k-value for Local Outlier Factor (LOF) detection ...
... outlier factor algorithm, "LOF: Identifying Density-Based Local Outliers" (Breunig et al), recommends a method of choosing a k-value.
Read more >
Outlier detection with Local Outlier Factor (LOF)
The Local Outlier Factor (LOF) algorithm is an unsupervised anomaly detection method which computes the local density deviation of a given data point...
Read more >
Local Outlier Factor | Haroon Rashid Lone - WordPress.com
Local outlier Factor (LoF) is another density based approach to identify outliers in ... The above figure shows two different distributions, ...
Read more >
Outlier Detection Method - an overview
Unsupervised methods cannot detect such outliers effectively. ... The local outlier factor[23] is a stabilized variant of the density estimation approach ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found