-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Local outlier factor gives incorrect results #9874
Copy link
Copy link
Closed
Description
Steps/Code to Reproduce
import numpy as np
from sklearn.neighbors import LocalOutlierFactor
c=np.array([[0,0],[0,1],[1,1],[3,0]])
k=2 #numNeighbours
clf = LocalOutlierFactor(n_neighbors=k, n_jobs=-1,algorithm='brute',metric='manhattan').fit(c)
Z = clf._decision_function(c)
print(-Z)
[ 0.875 0.875 0.875 1.5 ]However, the result should be: [ 0.875 1.333 0.875 2. ] if you work it out by hand (assuming a sample can't be the 1st nearest neighbour to itself). So, I think there is something wrong with the LOF implementation. Could somebody confirm either way?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels