def fit(self, X, y=None, **kwargs):
        """
        Fits the model and generates the silhouette visualization.
        """
        # TODO: decide to use this method or the score method to draw.
        # NOTE: Probably this would be better in score, but the standard score
        # is a little different and I'm not sure how it's used.

        # Fit the wrapped estimator
        self.estimator.fit(X, y, **kwargs)

        # Get the properties of the dataset
        self.n_samples_ = X.shape[0]
        self.n_clusters_ = self.estimator.n_clusters

        # Compute the scores of the cluster
        labels = self.estimator.predict(X)
        self.silhouette_score_ = silhouette_score(X, labels)
        self.silhouette_samples_ = silhouette_samples(X, labels)

        # Draw the silhouette figure
        self.draw(labels)

        # Return the estimator
        return self
def fit ( self , X , y = None , ** kwargs ) : self . estimator . fit ( X , y , ** kwargs ) self . n_samples_ = X . shape [ 0 ] self . n_clusters_ = self . estimator . n_clusters labels = self . estimator . predict ( X ) self . silhouette_score_ = silhouette_score ( X , labels ) self . silhouette_samples_ = silhouette_samples ( X , labels ) self . draw ( labels ) return self
Fits the model and generates the silhouette visualization.