jsat.clustering
Class OPTICS
- java.lang.Object
-
- jsat.clustering.ClustererBase
-
- jsat.clustering.OPTICS
-
- All Implemented Interfaces:
- java.io.Serializable, Clusterer, Parameterized
public class OPTICS extends ClustererBase implements Parameterized
An Implementation of the OPTICS algorithm, which is a generalization ofDBSCAN. OPTICS creates an ordering of the ports, and then clusters can be extracted from this ordering in numerous different ways.
NOTE: The original clustering method proposed in the paper is fairly complicated, and its implementation is not yet complete. Though it does perform some amount of clustering, it may not return the expected results.
See original paper
Ankerst, M., Breunig, M., Kriegel, H.-P.,&Sander, J. (1999). OPTICS: ordering points to identify the clustering structure. Proceedings of the 1999 ACM SIGMOD international conference on Management of data (Vol. 28, pp. 49–60). Philadelphia, Pennsylvania: ACM.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classOPTICS.ExtractionMethodEnum to indicate which method of extracting clusters should be used on the reachability plot.
-
Field Summary
Fields Modifier and Type Field and Description static OPTICS.ExtractionMethodDEFAULT_EXTRACTION_METHODThe default method used to extract clusters in OPTICSstatic intDEFAULT_MIN_POINTSThe default number of points to consider is 10.static doubleDEFAULT_XIThe default value for xi is 0.005
-
Constructor Summary
Constructors Constructor and Description OPTICS()Creates a new OPTICS cluster object.OPTICS(DistanceMetric dm, int minPts)Creates a new OPTICS cluster object.OPTICS(DistanceMetric dm, int minPts, double xi)Creates a new OPTICS cluster object.OPTICS(int minPts)Creates a new OPTICS cluster object.OPTICS(OPTICS toCopy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description OPTICSclone()int[]cluster(DataSet dataSet, boolean parallel, int[] designations)Performs clustering on the given data set.int[]cluster(DataSet dataSet, int[] designations)Performs clustering on the given data set.DistanceMetricgetDistanceMetric()Returns the distance metric used to compute distances in the algorithm.OPTICS.ExtractionMethodgetExtractionMethod()Returns the method used to extract clusters from the reachability plot.intgetMinPts()Sets the minimum number of points needed to compute the core distance.double[]getReachabilityArray()Returns a copy of the reachability array in correct reachability order.doublegetXi()Returns the xi value used inOPTICS.ExtractionMethod.XI_STEEP_ORIGINALto produce cluster results.voidsetDistanceMetric(DistanceMetric dm)Sets the distance metric used to compute distances in the algorithm.voidsetExtractionMethod(OPTICS.ExtractionMethod extractionMethod)Sets the method used to extract clusters from the reachability plot.voidsetMinPts(int minPts)Sets the minimum number of points needed to compute the core distance.voidsetVCF(VectorCollection<VecPaired<Vec,java.lang.Integer>> vc)Sets theVectorCollectionused to produce acceleration structures for the OPTICS computation.voidsetXi(double xi)Sets the xi value used inOPTICS.ExtractionMethod.XI_STEEP_ORIGINALto produce cluster results.-
Methods inherited from class jsat.clustering.ClustererBase
createClusterListFromAssignmentArray, getDatapointsFromCluster
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jsat.parameters.Parameterized
getParameter, getParameters
-
Methods inherited from interface jsat.clustering.Clusterer
cluster, cluster, supportsWeightedData
-
-
-
-
Field Detail
-
DEFAULT_XI
public static final double DEFAULT_XI
The default value for xi is 0.005- See Also:
- Constant Field Values
-
DEFAULT_MIN_POINTS
public static final int DEFAULT_MIN_POINTS
The default number of points to consider is 10.- See Also:
- Constant Field Values
-
DEFAULT_EXTRACTION_METHOD
public static final OPTICS.ExtractionMethod DEFAULT_EXTRACTION_METHOD
The default method used to extract clusters in OPTICS
-
-
Constructor Detail
-
OPTICS
public OPTICS()
Creates a new OPTICS cluster object. Because the radius of OPTICS is not sensitive, it is estimated from the data and set to a sufficiently large value. TheEuclideanDistancewill be used as the metric.
-
OPTICS
public OPTICS(int minPts)
Creates a new OPTICS cluster object. Because the radius of OPTICS is not sensitive, it is estimated from the data and set to a sufficiently large value. TheEuclideanDistancewill be used as the metric.- Parameters:
minPts- the minimum number of points for reachability
-
OPTICS
public OPTICS(DistanceMetric dm, int minPts)
Creates a new OPTICS cluster object. Because the radius of OPTICS is not sensitive, it is estimated from the data and set to a sufficiently large value.- Parameters:
dm- the distance metric to useminPts- the minimum number of points for reachability
-
OPTICS
public OPTICS(DistanceMetric dm, int minPts, double xi)
Creates a new OPTICS cluster object. Because the radius of OPTICS is not sensitive, it is estimated from the data and set to a sufficiently large value.- Parameters:
dm- the distance metric to useminPts- the minimum number of points for reachabilityxi- the xi value
-
OPTICS
public OPTICS(OPTICS toCopy)
-
-
Method Detail
-
clone
public OPTICS clone()
- Specified by:
clonein interfaceClusterer- Specified by:
clonein classClustererBase
-
setDistanceMetric
public void setDistanceMetric(DistanceMetric dm)
Sets the distance metric used to compute distances in the algorithm.- Parameters:
dm- the distance metric to use
-
getDistanceMetric
public DistanceMetric getDistanceMetric()
Returns the distance metric used to compute distances in the algorithm.- Returns:
- the distance metric used
-
setXi
public void setXi(double xi)
Sets the xi value used inOPTICS.ExtractionMethod.XI_STEEP_ORIGINALto produce cluster results.- Parameters:
xi- the value in the range (0, 1)- Throws:
java.lang.ArithmeticException- if the value is not in the appropriate range
-
getXi
public double getXi()
Returns the xi value used inOPTICS.ExtractionMethod.XI_STEEP_ORIGINALto produce cluster results.- Returns:
- the xi value used
-
setExtractionMethod
public void setExtractionMethod(OPTICS.ExtractionMethod extractionMethod)
Sets the method used to extract clusters from the reachability plot.- Parameters:
extractionMethod- the clustering method
-
getExtractionMethod
public OPTICS.ExtractionMethod getExtractionMethod()
Returns the method used to extract clusters from the reachability plot.- Returns:
- the clustering method used
-
setMinPts
public void setMinPts(int minPts)
Sets the minimum number of points needed to compute the core distance. Higher values tend to smooth out the reachability plot.- Parameters:
minPts- the number of points to compute reachability and core distance
-
getMinPts
public int getMinPts()
Sets the minimum number of points needed to compute the core distance.- Returns:
- the number of points to compute reachability and core distance
-
setVCF
public void setVCF(VectorCollection<VecPaired<Vec,java.lang.Integer>> vc)
Sets theVectorCollectionused to produce acceleration structures for the OPTICS computation.- Parameters:
vc- the vector collection to use
-
cluster
public int[] cluster(DataSet dataSet, int[] designations)
Description copied from interface:ClustererPerforms clustering on the given data set. Parameters may be estimated by the method, or other heuristics performed.- Specified by:
clusterin interfaceClusterer- Parameters:
dataSet- the data set to perform clustering ondesignations- the array which will contain the designated values. The array will be altered and returned by the function. If null is given, a new array will be created and returned.- Returns:
- an array indicating for each value indicating the cluster designation. This is the same array as designations, or a new one if the input array was null
-
cluster
public int[] cluster(DataSet dataSet, boolean parallel, int[] designations)
Description copied from interface:ClustererPerforms clustering on the given data set. Parameters may be estimated by the method, or other heuristics performed.- Specified by:
clusterin interfaceClusterer- Parameters:
dataSet- the data set to perform clustering onparallel-trueif multiple threads should be used to perform clustering.falseif it should be done in a single threaded manner.designations- the array which will contain the designated values. The array will be altered and returned by the function. If null is given, a new array will be created and returned.- Returns:
- the int[]
-
getReachabilityArray
public double[] getReachabilityArray()
Returns a copy of the reachability array in correct reachability order. Some values that are not density reachability could have a value ofDouble.POSITIVE_INFINITY.- Returns:
- an array of the reachability values
-
-
DataMelt 3.0 © DataMelt by jWork.ORG