Class DBSCANClusterer<T extends org.apache.commons.math3.ml.clustering.Clusterable>
java.lang.Object
org.apache.commons.math3.ml.clustering.Clusterer<T>
org.aksw.jena_sparql_api.sparql.ext.geosparql.DBSCANClusterer<T>
- Type Parameters:
T- type of the points to cluster
public class DBSCANClusterer<T extends org.apache.commons.math3.ml.clustering.Clusterable>
extends org.apache.commons.math3.ml.clustering.Clusterer<T>
DBSCAN (density-based spatial clustering of applications with noise) algorithm.
The DBSCAN algorithm forms clusters based on the idea of density connectivity, i.e. a point p is density connected to another point q, if there exists a chain of points pi, with i = 1 .. n and p1 = p and pn = q, such that each pair <pi, pi+1> is directly density-reachable. A point q is directly density-reachable from point p if it is in the ε-neighborhood of this point.
Any point that is not density-reachable from a formed cluster is treated as noise, and will thus not be present in the result.
The algorithm requires two parameters:
- eps: the distance that defines the ε-neighborhood of a point
- minPoints: the minimum number of density-connected points required to form a cluster
-
Constructor Summary
ConstructorsConstructorDescriptionDBSCANClusterer(double eps, int minPts) Creates a new instance of a DBSCANClusterer.DBSCANClusterer(double eps, int minPts, org.apache.commons.math3.ml.distance.DistanceMeasure measure) Creates a new instance of a DBSCANClusterer. -
Method Summary
Modifier and TypeMethodDescriptioncluster(Collection<T> points) Performs DBSCAN cluster analysis.doublegetEps()Returns the maximum radius of the neighborhood to be considered.intReturns the minimum number of points needed for a cluster.getNeighbors(T point, Collection<T> points) Returns a list of density-reachable neighbors of apoint.Methods inherited from class org.apache.commons.math3.ml.clustering.Clusterer
distance, getDistanceMeasure
-
Constructor Details
-
DBSCANClusterer
public DBSCANClusterer(double eps, int minPts) throws org.apache.commons.math3.exception.NotPositiveException Creates a new instance of a DBSCANClusterer.The euclidean distance will be used as default distance measure.
- Parameters:
eps- maximum radius of the neighborhood to be consideredminPts- minimum number of points needed for a cluster- Throws:
org.apache.commons.math3.exception.NotPositiveException- ifeps < 0.0orminPts < 0
-
DBSCANClusterer
public DBSCANClusterer(double eps, int minPts, org.apache.commons.math3.ml.distance.DistanceMeasure measure) throws org.apache.commons.math3.exception.NotPositiveException Creates a new instance of a DBSCANClusterer.- Parameters:
eps- maximum radius of the neighborhood to be consideredminPts- minimum number of points needed for a clustermeasure- the distance measure to use- Throws:
org.apache.commons.math3.exception.NotPositiveException- ifeps < 0.0orminPts < 0
-
-
Method Details
-
getEps
public double getEps()Returns the maximum radius of the neighborhood to be considered.- Returns:
- maximum radius of the neighborhood
-
getMinPts
public int getMinPts()Returns the minimum number of points needed for a cluster.- Returns:
- minimum number of points needed for a cluster
-
cluster
public List<org.apache.commons.math3.ml.clustering.Cluster<T>> cluster(Collection<T> points) throws org.apache.commons.math3.exception.NullArgumentException Performs DBSCAN cluster analysis.- Specified by:
clusterin classorg.apache.commons.math3.ml.clustering.Clusterer<T extends org.apache.commons.math3.ml.clustering.Clusterable>- Parameters:
points- the points to cluster- Returns:
- the list of clusters
- Throws:
org.apache.commons.math3.exception.NullArgumentException- if the data points are null
-
getNeighbors
Returns a list of density-reachable neighbors of apoint.- Parameters:
point- the point to look forpoints- possible neighbors- Returns:
- the List of neighbors
-