Package elki.clustering.kmeans
Class BestOfMultipleKMeans<V extends NumberVector,M extends MeanModel>
- java.lang.Object
-
- elki.clustering.kmeans.BestOfMultipleKMeans<V,M>
-
- Type Parameters:
V
- Vector typeM
- Model type
- All Implemented Interfaces:
Algorithm
,ClusteringAlgorithm<Clustering<M>>
,KMeans<V,M>
public class BestOfMultipleKMeans<V extends NumberVector,M extends MeanModel> extends java.lang.Object implements KMeans<V,M>
Run K-Means multiple times, and keep the best run.- Since:
- 0.6.0
- Author:
- Stephan Baier, Erich Schubert
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface elki.Algorithm
Algorithm.Utils
-
-
Field Summary
Fields Modifier and Type Field Description private KMeans<V,M>
innerkMeans
Variant of kMeans for the bisecting step.private static Logging
LOG
The logger for this class.private KMeansQualityMeasure<? super V>
qualityMeasure
Quality measure which should be used.private int
trials
Number of trials to do.-
Fields inherited from interface elki.clustering.kmeans.KMeans
DISTANCE_FUNCTION_ID, INIT_ID, K_ID, MAXITER_ID, SEED_ID, VARSTAT_ID
-
-
Constructor Summary
Constructors Constructor Description BestOfMultipleKMeans(int trials, KMeans<V,M> innerkMeans, KMeansQualityMeasure<? super V> qualityMeasure)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NumberVectorDistance<? super V>
getDistance()
Returns the distance.TypeInformation[]
getInputTypeRestriction()
Get the input type restriction used for negotiating the data query.Clustering<M>
run(Relation<V> relation)
Run the clustering algorithm.void
setDistance(NumberVectorDistance<? super V> distance)
Set the distance function to use.void
setInitializer(KMeansInitialization init)
Set the initialization method.void
setK(int k)
Set the value of k.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.clustering.ClusteringAlgorithm
autorun
-
-
-
-
Field Detail
-
LOG
private static final Logging LOG
The logger for this class.
-
trials
private int trials
Number of trials to do.
-
innerkMeans
private KMeans<V extends NumberVector,M extends MeanModel> innerkMeans
Variant of kMeans for the bisecting step.
-
qualityMeasure
private KMeansQualityMeasure<? super V extends NumberVector> qualityMeasure
Quality measure which should be used.
-
-
Constructor Detail
-
BestOfMultipleKMeans
public BestOfMultipleKMeans(int trials, KMeans<V,M> innerkMeans, KMeansQualityMeasure<? super V> qualityMeasure)
Constructor.- Parameters:
trials
- Number of trials to do.innerkMeans
- K-Means variant to actually use.qualityMeasure
- Quality measure
-
-
Method Detail
-
getInputTypeRestriction
public TypeInformation[] getInputTypeRestriction()
Description copied from interface:Algorithm
Get the input type restriction used for negotiating the data query.- Specified by:
getInputTypeRestriction
in interfaceAlgorithm
- Returns:
- Type restriction
-
run
public Clustering<M> run(Relation<V> relation)
Description copied from interface:KMeans
Run the clustering algorithm.
-
getDistance
public NumberVectorDistance<? super V> getDistance()
Description copied from interface:KMeans
Returns the distance.- Specified by:
getDistance
in interfaceKMeans<V extends NumberVector,M extends MeanModel>
- Returns:
- the distance
-
setK
public void setK(int k)
Description copied from interface:KMeans
Set the value of k. Needed for some types of nested k-means.
-
setDistance
public void setDistance(NumberVectorDistance<? super V> distance)
Description copied from interface:KMeans
Set the distance function to use.- Specified by:
setDistance
in interfaceKMeans<V extends NumberVector,M extends MeanModel>
- Parameters:
distance
- Distance function.
-
setInitializer
public void setInitializer(KMeansInitialization init)
Description copied from interface:KMeans
Set the initialization method.- Specified by:
setInitializer
in interfaceKMeans<V extends NumberVector,M extends MeanModel>
- Parameters:
init
- Initialization method
-
-