Class KMeansPlusPlus.NumberVectorInstance
- java.lang.Object
-
- elki.clustering.kmeans.initialization.KMeansPlusPlus.Instance<NumberVector>
-
- elki.clustering.kmeans.initialization.KMeansPlusPlus.NumberVectorInstance
-
- Direct Known Subclasses:
Ostrovsky.NumberVectorInstance
- Enclosing class:
- KMeansPlusPlus<O>
protected static class KMeansPlusPlus.NumberVectorInstance extends KMeansPlusPlus.Instance<NumberVector>
Instance for k-means, number vector based.- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description protected NumberVectorDistance<?>
distance
Distance functionprotected Relation<? extends NumberVector>
relation
Data relation.-
Fields inherited from class elki.clustering.kmeans.initialization.KMeansPlusPlus.Instance
diststat, ids, random, weights
-
-
Constructor Summary
Constructors Constructor Description NumberVectorInstance(Relation<? extends NumberVector> relation, NumberVectorDistance<?> distance, RandomFactory rnd)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
chooseRemaining(int k, java.util.List<NumberVector> means, double weightsum)
Choose remaining means, weighted by distance.protected double
distance(NumberVector a, DBIDRef b)
Compute the distance of two objects.double[][]
run(int k)
Run k-means++ initialization for number vectors.-
Methods inherited from class elki.clustering.kmeans.initialization.KMeansPlusPlus.Instance
initialWeights, nextDouble, updateWeights
-
-
-
-
Field Detail
-
distance
protected NumberVectorDistance<?> distance
Distance function
-
relation
protected Relation<? extends NumberVector> relation
Data relation.
-
-
Constructor Detail
-
NumberVectorInstance
public NumberVectorInstance(Relation<? extends NumberVector> relation, NumberVectorDistance<?> distance, RandomFactory rnd)
Constructor.- Parameters:
relation
- Data relation to processdistance
- Distance functionrnd
- Random generator
-
-
Method Detail
-
run
public double[][] run(int k)
Run k-means++ initialization for number vectors.- Parameters:
k
- K- Returns:
- Vectors
-
distance
protected double distance(NumberVector a, DBIDRef b)
Description copied from class:KMeansPlusPlus.Instance
Compute the distance of two objects.- Specified by:
distance
in classKMeansPlusPlus.Instance<NumberVector>
- Parameters:
a
- First objectb
- Second object- Returns:
- Distance
-
chooseRemaining
protected void chooseRemaining(int k, java.util.List<NumberVector> means, double weightsum)
Choose remaining means, weighted by distance.- Parameters:
k
- Number of means to choosemeans
- Means storageweightsum
- Sum of weights
-
-