damjankuznar / pylof Goto Github PK
View Code? Open in Web Editor NEWPython implementation of Local Outlier Factor algorithm.
License: GNU General Public License v2.0
Python implementation of Local Outlier Factor algorithm.
License: GNU General Public License v2.0
If the instance you're running lof for is the same distance away from most points, the distances list can have a length < k in which case distances[k - 1][0] returns an index out of range error
Hi
I know the input data must be in a form of tuple. But, I can't apply it on 1 dimensional data:
return lof.outliers(1, data)
File "C:\Users\lof.py", line 162, in outliers
value = l.local_outlier_factor(k, instance)
File "C:\Users\lof.py", line 95, in local_outlier_factor
return local_outlier_factor(min_pts, instance, self.instances, distance_function=self.distance_function)
File "C:\Users\lof.py", line 141, in local_outlier_factor
(k_distance_value, neighbours) = k_distance(min_pts, instance, instances, **kwargs)
File "C:\Users\lof.py", line 104, in k_distance
distance_value = distance_function(instance, instance2)
File "C:\Users\lof.py", line 33, in distance_euclidean
if len(instance1) != len(instance2):
TypeError: object of type 'float' has no len()
Do you have any suggestion?
Also do you have any advice on how to use it on large scale data?
Thanks
Hi Again,
I appreciate if you could put the codes of plotting figures (with outliers as different colors) here too.
Thanks
Hi,
When I'm trying to run example 2 on a different set of data, I got div-by-zero exceptions with some particular data. For example,
import lof
inst = [(1.,2.,3.),(2.,3.,4.),(1.,2.,4.),(1.,2.,1.)]
l = lof.outliers(1, inst)
produces
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/lof.py", line 160, in outliers
value = l.local_outlier_factor(k, instance)
File "/lof.py", line 95, in local_outlier_factor
return local_outlier_factor(min_pts, instance, self.instances, distance_function=self.distance_function)
File "/lof.py", line 142, in local_outlier_factor
instance_lrd = local_reachability_density(min_pts, instance, instances, **kwargs)
File "/lof.py", line 134, in local_reachability_density
return len(neighbours) / sum(reachability_distances_array)
ZeroDivisionError: float division by zero
I wonder if I'm doing anything wrong? Any help would be appreciated, thanks.
Hi, thanks for sharing this greate project!
There is one line of code I can't understand:
rmse = (sum(map(lambda x: x**2, differences)) / len(differences))**0.5
As far as I know, if x and y are two points in n-dimension space, the euclidean distance between them is
d(x,y) = sqrt((x1-y1)^2 + (x2-y2)^2 + ... + (xn-yn)^2)
So why in the code the sum term is divided by len(differences) ?
Thanks a lot if you could help me.
The performance evaluations of LOF in the paper shows that it takes about 2000 seconds for the algorithm to detect outliers in a 10-dimensional dataset with 200000 data points. However, when I run this implementation of LOF it takes about 2400 seconds to run a 7-dimensional dataset with just 1000 points. Why the huge discrepancy in performance?
I'm just getting started with LOF and just want to experiment with it a little. I'm sorry if I'm just misinterpreting the paper.
Hello~ I just know the LOF algorithm today and I want to use this algorithm on a 3D point set to cluster the outliers. I find your great work on git, but I don't quite understand how to use your lof file. Would you like to show me the way please? Thank you for your patience.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.