Class FastMSC.Instance2

  • Direct Known Subclasses:
    FasterMSC.Instance2
    Enclosing class:
    FastMSC<O>

    protected class FastMSC.Instance2
    extends java.lang.Object
    Simplified FastMSC clustering instance for k=2.

    For k=2, we can use a much simpler logic.

    Author:
    Erich Schubert
    • Constructor Detail

    • Method Detail

      • run

        protected double run​(ArrayModifiableDBIDs medoids,
                             int maxiter)
        Run the FastMSC optimization phase.
        Parameters:
        medoids - Initial medoids list
        maxiter - Maximum number of iterations
        Returns:
        final medoid Silhouette
      • assignToNearestCluster

        protected double assignToNearestCluster​(ArrayDBIDs means)
        Assign each object to the nearest cluster.
        Parameters:
        means - Cluster medoids
        Returns:
        loss
      • findBestSwap

        protected void findBestSwap​(DBIDRef j,
                                    double[] ploss)
        Compute the loss change when choosing j as new medoid.
        Parameters:
        j - New medoid
        ploss - Loss array
      • doSwap

        protected double doSwap​(ArrayDBIDs medoids,
                                int b,
                                DBIDRef j)
        Assign each object to the nearest cluster when replacing one medoid.
        Parameters:
        medoids - Cluster medoids
        b - Medoid position index
        j - New medoid
        Returns:
        medoid silhouette
      • silhouetteScores

        public DoubleDataStore silhouetteScores()
        Get the silhouette scores per point (must be run() first)
        Returns:
        Silhouette scores