public class KMeansPivotChooser extends AbstractPivotChooser
Modifier and Type | Class and Description |
---|---|
static class |
KMeansPivotChooser.CenterThread
Internal abract thread for selecting new "center" of a cluster.
|
static class |
KMeansPivotChooser.ComputeCentroidThread
Thread for computing a new artifical cluster center as a mean vector of all passed vectors.
|
static class |
KMeansPivotChooser.SelectClustroidThread
Thread for selecting the "center" of a cluster.
|
Modifier and Type | Field and Description |
---|---|
protected AbstractObjectList<LocalAbstractObject> |
initialPivots
List of initial pivots
|
static int |
MAX_ITERATIONS
Maximal number of iterations to let run
|
static float |
PIVOTS_DISTINCTION_THRESHOLD
Threshold to consider 2 pivots the same
|
static int |
PIVOTS_SAMPLE_SIZE
Size of the sample set to select a pivot from in each iteration of the k-means
|
counterBucketReadBuckets, counterObjectDistComp, counterPivotDistComp, counterPivotReadBuckets, preselectedPivots, sampleProviders
Constructor and Description |
---|
KMeansPivotChooser()
Creates a new instance of KMeansPivotChooser with empty initial list of pivots.
|
KMeansPivotChooser(AbstractObjectList<LocalAbstractObject> initialPivots)
Creates a new instance of KMeansPivotChooser.
|
KMeansPivotChooser(boolean useKmeansForCenters) |
Modifier and Type | Method and Description |
---|---|
java.util.Iterator<AbstractObjectList<LocalAbstractObject>> |
iteratorPartitions() |
void |
printPivots(java.lang.String msg)
Prints all pivots selected by this chooser.
|
protected void |
selectPivot(int count,
AbstractObjectIterator<? extends LocalAbstractObject> sampleSetIterator)
This method only uses the preselected pivots as initial pivots for k-means and rewrites the pivots completely
|
addPivot, clear, deregisterSampleProvider, getLastPivot, getNextPivot, getPivot, getPivot, iterator, registerSampleProvider, removeLastPivot, selectPivot, selectPivot, size
public static int PIVOTS_SAMPLE_SIZE
public static float PIVOTS_DISTINCTION_THRESHOLD
public static int MAX_ITERATIONS
protected AbstractObjectList<LocalAbstractObject> initialPivots
public KMeansPivotChooser()
public KMeansPivotChooser(boolean useKmeansForCenters)
public KMeansPivotChooser(AbstractObjectList<LocalAbstractObject> initialPivots)
initialPivots
- the list of initial pivotsprotected void selectPivot(int count, AbstractObjectIterator<? extends LocalAbstractObject> sampleSetIterator)
selectPivot
in class AbstractPivotChooser
count
- Number of pivots to generatesampleSetIterator
- Iterator over the sample set of objects to choose new pivots frompublic java.util.Iterator<AbstractObjectList<LocalAbstractObject>> iteratorPartitions()
public void printPivots(java.lang.String msg)
System.err
.msg
- optional message printed before the pivots