Class SphericalKMeansPlusPlus.Instance
- java.lang.Object
-
- elki.clustering.kmeans.initialization.SphericalKMeansPlusPlus.Instance
-
- Enclosing class:
- SphericalKMeansPlusPlus<O>
protected static class SphericalKMeansPlusPlus.Instance extends java.lang.ObjectAbstract instance implementing the weight handling.- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description protected doublealphaParameter to balance distance vs. uniform sampling.protected longdiststatCount the number of distance computations.protected java.util.RandomrandomRandom generatorprotected elki.database.relation.Relation<? extends elki.data.NumberVector>relationData relation.protected elki.database.datastore.WritableDoubleDataStoreweightsWeights
-
Constructor Summary
Constructors Constructor Description Instance(elki.database.relation.Relation<? extends elki.data.NumberVector> relation, double alpha, elki.utilities.random.RandomFactory rnd)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidchooseRemaining(int k, java.util.List<elki.data.NumberVector> means, double weightsum)Choose remaining means, weighted by distance.protected doubleinitialWeights(elki.data.NumberVector first)Initialize the weight list.protected doublenextDouble(double weightsum)double[][]run(int k)Run k-means++ initialization for number vectors.protected doublesimilarity(elki.data.NumberVector a, elki.database.ids.DBIDRef b)Compute the distance of two objects.protected doubleupdateWeights(elki.data.NumberVector latest)Update the weight list.
-
-
-
Field Detail
-
alpha
protected double alpha
Parameter to balance distance vs. uniform sampling.
-
relation
protected elki.database.relation.Relation<? extends elki.data.NumberVector> relation
Data relation.
-
weights
protected elki.database.datastore.WritableDoubleDataStore weights
Weights
-
diststat
protected long diststat
Count the number of distance computations.
-
random
protected java.util.Random random
Random generator
-
-
Method Detail
-
run
public double[][] run(int k)
Run k-means++ initialization for number vectors.- Parameters:
k- K- Returns:
- Vectors
-
similarity
protected double similarity(elki.data.NumberVector a, elki.database.ids.DBIDRef b)Compute the distance of two objects.- Parameters:
a- First objectb- Second object- Returns:
- Distance
-
chooseRemaining
protected void chooseRemaining(int k, java.util.List<elki.data.NumberVector> means, double weightsum)Choose remaining means, weighted by distance.- Parameters:
k- Number of means to choosemeans- Means storageweightsum- Sum of weights
-
initialWeights
protected double initialWeights(elki.data.NumberVector first)
Initialize the weight list.- Parameters:
first- Added ID- Returns:
- Weight sum
-
updateWeights
protected double updateWeights(elki.data.NumberVector latest)
Update the weight list.- Parameters:
latest- Added ID- Returns:
- Weight sum
-
nextDouble
protected double nextDouble(double weightsum)
-
-