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.Object
Instance for a single dataset.- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description (package private) WritableIntegerDataStore
assignment
Cluster mapping.(package private) DistanceQuery<?>
distQ
Distance function to use.(package private) DBIDs
ids
Ids to process.(package private) WritableIntegerDataStore
scratch
Scratch cluster mapping.(package private) WritableDoubleDataStore
silhouettes
Store 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 void
assignToNearestCluster(ArrayDBIDs medoids)
Assign each object to the nearest cluster.protected void
reassignToNearestCluster(IntegerDataStore prev, WritableIntegerDataStore assignment, ArrayDBIDs medoids, int pi, DBIDRef h)
Assign each object to the nearest cluster when replacing one medoid.protected double
run(ArrayModifiableDBIDs medoids, int maxiter)
Run the PAMSIL optimization phase.protected double
silhouette(IntegerDataStore assignment, int k)
Evaluate the average Silhouette of the current cluster assignmentDoubleDataStore
silhouetteScores()
-
-
-
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()
-
-