jsat.clustering.evaluation.intra
Class SumOfSqrdPairwiseDistances
- java.lang.Object
-
- jsat.clustering.evaluation.intra.SumOfSqrdPairwiseDistances
-
- All Implemented Interfaces:
- IntraClusterEvaluation
public class SumOfSqrdPairwiseDistances extends java.lang.Object implements IntraClusterEvaluation
Evaluates a cluster's validity by computing the normalized sum of pairwise distances for all points in the cluster.
Note, the normalization value for each cluster is 1/(2 * n), where n is the number of points in each cluster.
For general distance metrics, this requires O(n2) work. TheEuclideanDistanceis a special case, and takes only O(n) work.
-
-
Constructor Summary
Constructors Constructor and Description SumOfSqrdPairwiseDistances()Creates a new evaluator that uses the Euclidean distanceSumOfSqrdPairwiseDistances(DistanceMetric dm)Creates a new cluster evaluator using the given distance metricSumOfSqrdPairwiseDistances(SumOfSqrdPairwiseDistances toCopy)Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description SumOfSqrdPairwiseDistancesclone()doubleevaluate(int[] designations, DataSet dataSet, int clusterID)Evaluates the cluster represented by the given list of data points.doubleevaluate(java.util.List<DataPoint> dataPoints)Evaluates the cluster represented by the given list of data points.DistanceMetricgetDistanceMetric()voidsetDistanceMetric(DistanceMetric dm)Sets the distance metric to be used whenever this object is called to evaluate a cluster
-
-
-
Constructor Detail
-
SumOfSqrdPairwiseDistances
public SumOfSqrdPairwiseDistances()
Creates a new evaluator that uses the Euclidean distance
-
SumOfSqrdPairwiseDistances
public SumOfSqrdPairwiseDistances(DistanceMetric dm)
Creates a new cluster evaluator using the given distance metric- Parameters:
dm- the distance metric to use
-
SumOfSqrdPairwiseDistances
public SumOfSqrdPairwiseDistances(SumOfSqrdPairwiseDistances toCopy)
Copy constructor- Parameters:
toCopy- the object to copy
-
-
Method Detail
-
setDistanceMetric
public void setDistanceMetric(DistanceMetric dm)
Sets the distance metric to be used whenever this object is called to evaluate a cluster- Parameters:
dm- the distance metric to use
-
getDistanceMetric
public DistanceMetric getDistanceMetric()
- Returns:
- the distance metric being used for evaluation
-
evaluate
public double evaluate(int[] designations, DataSet dataSet, int clusterID)Description copied from interface:IntraClusterEvaluationEvaluates the cluster represented by the given list of data points.- Specified by:
evaluatein interfaceIntraClusterEvaluation- Parameters:
designations- the array of cluster designations for the data setdataSet- the full data set of all clustersclusterID- the cluster id in the designations array to return the evaluation of- Returns:
- the value in the range [0, Inf) that indicates how well formed the cluster is.
-
evaluate
public double evaluate(java.util.List<DataPoint> dataPoints)
Description copied from interface:IntraClusterEvaluationEvaluates the cluster represented by the given list of data points.- Specified by:
evaluatein interfaceIntraClusterEvaluation- Parameters:
dataPoints- the data points that make up this cluster- Returns:
- the value in the range [0, Inf) that indicates how well formed the cluster is.
-
clone
public SumOfSqrdPairwiseDistances clone()
- Specified by:
clonein interfaceIntraClusterEvaluation- Overrides:
clonein classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG