Package elki.clustering.silhouette
Class PAMSIL.Instance
- java.lang.Object
-
- elki.clustering.silhouette.PAMSIL.Instance
-
- Direct Known Subclasses:
PAMMEDSIL.Instance
protected static class PAMSIL.Instance extends java.lang.ObjectInstance for a single dataset.- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description (package private) WritableIntegerDataStoreassignmentCluster mapping.(package private) DistanceQuery<?>distQDistance function to use.(package private) DBIDsidsIds to process.(package private) WritableIntegerDataStorescratchScratch cluster mapping.(package private) WritableDoubleDataStoresilhouettesStore the per-point silhouette scores for plotting.
-
Constructor Summary
Constructors Constructor Description Instance(DistanceQuery<?> distQ, DBIDs ids, WritableIntegerDataStore assignment)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidassignToNearestCluster(ArrayDBIDs medoids)Assign each object to the nearest cluster.protected voidreassignToNearestCluster(IntegerDataStore prev, WritableIntegerDataStore assignment, ArrayDBIDs medoids, int pi, DBIDRef h)Assign each object to the nearest cluster when replacing one medoid.protected doublerun(ArrayModifiableDBIDs medoids, int maxiter)Run the PAMSIL optimization phase.protected doublesilhouette(IntegerDataStore assignment, int k)Evaluate the average Silhouette of the current cluster assignmentDoubleDataStoresilhouetteScores()
-
-
-
Field Detail
-
ids
DBIDs ids
Ids to process.
-
distQ
DistanceQuery<?> distQ
Distance function to use.
-
assignment
WritableIntegerDataStore assignment
Cluster mapping.
-
scratch
WritableIntegerDataStore scratch
Scratch cluster mapping.
-
silhouettes
WritableDoubleDataStore silhouettes
Store the per-point silhouette scores for plotting.
-
-
Constructor Detail
-
Instance
public Instance(DistanceQuery<?> distQ, DBIDs ids, WritableIntegerDataStore assignment)
Constructor.- Parameters:
distQ- Distance queryids- IDs to processassignment- Cluster assignment
-
-
Method Detail
-
run
protected double run(ArrayModifiableDBIDs medoids, int maxiter)
Run the PAMSIL optimization phase.- Parameters:
medoids- Initial medoids listmaxiter- Maximum number of iterations- Returns:
- final Silhouette
-
assignToNearestCluster
protected void assignToNearestCluster(ArrayDBIDs medoids)
Assign each object to the nearest cluster.- Parameters:
medoids- Cluster medoids
-
silhouette
protected double silhouette(IntegerDataStore assignment, int k)
Evaluate the average Silhouette of the current cluster assignment- Parameters:
assignment- cluster assignmentk- number of clusters (for memory allocation)- Returns:
- Average silhouette width
-
reassignToNearestCluster
protected void reassignToNearestCluster(IntegerDataStore prev, WritableIntegerDataStore assignment, ArrayDBIDs medoids, int pi, DBIDRef h)
Assign each object to the nearest cluster when replacing one medoid.- Parameters:
prev- Previous assignmentassignment- New assignmentmedoids- Previous cluster medoidspi- Medoid positionh- New medoid
-
silhouetteScores
public DoubleDataStore silhouetteScores()
-
-