T
- type of the clustered pointspublic abstract class ClusterEvaluator<T extends Clusterable> extends Object
Constructor and Description |
---|
ClusterEvaluator()
Creates a new cluster evaluator with an
EuclideanDistance
as distance measure. |
ClusterEvaluator(DistanceMeasure measure)
Creates a new cluster evaluator with the given distance measure.
|
Modifier and Type | Method and Description |
---|---|
protected Clusterable |
centroidOf(Cluster<T> cluster)
Computes the centroid for a cluster.
|
protected double |
distance(Clusterable p1,
Clusterable p2)
Calculates the distance between two
Clusterable instances
with the configured DistanceMeasure . |
boolean |
isBetterScore(double score1,
double score2)
Returns whether the first evaluation score is considered to be better
than the second one by this evaluator.
|
abstract double |
score(List<? extends Cluster<T>> clusters)
Computes the evaluation score for the given list of clusters.
|
public ClusterEvaluator()
EuclideanDistance
as distance measure.public ClusterEvaluator(DistanceMeasure measure)
measure
- the distance measure to usepublic abstract double score(List<? extends Cluster<T>> clusters)
clusters
- the clusters to evaluatepublic boolean isBetterScore(double score1, double score2)
Specific implementations shall override this method if the returned scores do not follow the same ordering, i.e. smaller score is better.
score1
- the first scorescore2
- the second scoretrue
if the first score is considered to be better, false
otherwiseprotected double distance(Clusterable p1, Clusterable p2)
Clusterable
instances
with the configured DistanceMeasure
.p1
- the first clusterablep2
- the second clusterableprotected Clusterable centroidOf(Cluster<T> cluster)
cluster
- the clusternull
if the cluster does not contain any pointsCopyright © 2003–2016 The Apache Software Foundation. All rights reserved.