public class G1Function extends BaseFunction
CriterionFunction
interprets the dataset as a set of vertices in
a graph and measures the best cuts of these vertices. This reduces to a
comparison between computed centroids and the centroid for the dataset as a
whole, and is fairly similar to the E1Function
.assignments, centroids, clusterSizes, costs, matrix
Constructor and Description |
---|
G1Function()
Constructs a new
G1Function . |
Modifier and Type | Method and Description |
---|---|
protected double |
getNewCentroidScore(int newCentroidIndex,
DoubleVector dataPoint)
Returns the new score for the cluster centroid indexed by
newCentroidIndex when dataPoint is added to it. |
protected double |
getOldCentroidScore(DoubleVector vector,
int oldCentroidIndex,
int altClusterSize)
Returns the new score for the cluster centroid represented by
altCurrentCentroid with the new altClusterSize . |
boolean |
isMaximize()
Returns true if this
CriterionFunction tries to maximize it's
score, and false otherwise. |
protected void |
subSetup(Matrix m)
Setup any extra information needed before computing the cost values for
each cluster.
|
protected void |
updateScores(int newCentroidIndex,
int oldCentroidIndex,
DoubleVector vector) |
assignments, centroids, clusterSizes, modifiedMagnitude, modifiedMagnitudeSqrd, score, setup, subtract, subtractedMagnitude, subtractedMagnitudeSqrd, update
public G1Function()
G1Function
.protected void subSetup(Matrix m)
subSetup
in class BaseFunction
protected double getOldCentroidScore(DoubleVector vector, int oldCentroidIndex, int altClusterSize)
altCurrentCentroid
with the new altClusterSize
.getOldCentroidScore
in class BaseFunction
altClusterSize
- The current updated cluster sizeprotected double getNewCentroidScore(int newCentroidIndex, DoubleVector dataPoint)
BaseFunction
newCentroidIndex
when dataPoint
is added to it. Implementations
of this method should not actually add dataPoint
to the centroid,
but should instead use the helper functions provided to compute the new
score.getNewCentroidScore
in class BaseFunction
newCentroidIndex
- The index of the current alternate centroiddataPoint
- The current data point that is being reassignedpublic boolean isMaximize()
CriterionFunction
tries to maximize it's
score, and false otherwise.protected void updateScores(int newCentroidIndex, int oldCentroidIndex, DoubleVector vector)
updateScores
in class BaseFunction
Copyright © 2012. All Rights Reserved.