class_docstr: The Silhouette Visualizer displays the silhouette coefficient for each
  sample on a per-cluster basis, visually evaluating the density and
  separation between clusters. The score is calculated by averaging the
  silhouette coefficient for each sample, computed as the difference
  between the average intra-cluster distance and the mean nearest-cluster
  distance for each sample, normalized by the maximum value. This produces a
  score between -1 and +1, where scores near +1 indicate high separation
  and scores near -1 indicate that the samples may have been assigned to
  the wrong cluster.
  
  In SilhouetteVisualizer plots, clusters with higher scores have wider
  silhouettes, but clusters that are less cohesive will fall short of the
  average score across all clusters, which is plotted as a vertical dotted
  red line.
  
  This is particularly useful for determining cluster imbalance, or for
  selecting a value for K by comparing multiple visualizers.
  
  Parameters
  ----------
  estimator : a Scikit-Learn clusterer
      Should be an instance of a centroidal clustering algorithm (``KMeans``
      or ``MiniBatchKMeans``). If the estimator is not fitted, it is fit when
      the visualizer is fitted, unless otherwise specified by ``is_fitted``.
  
  ax : matplotlib Axes, default: None
      The axes to plot the figure on. If None is passed in the current axes
      will be used (or generated if required).
  
  colors : iterable or string, default: None
      A collection of colors to use for each cluster group. If there are
      fewer colors than cluster groups, colors will repeat. May also be a
      Yellowbrick or matplotlib colormap string.
  
  is_fitted : bool or str, default='auto'
      Specify if the wrapped estimator is already fitted. If False, the
      estimator will be fit when the visualizer is fit, otherwise, the
      estimator will not be modified. If 'auto' (default), a helper method
      will check if the estimator is fitted before fitting it again.
  
  kwargs : dict
      Keyword arguments that are passed to the base class and may influence
      the visualization as defined in other Visualizers.
  
  Attributes
  ----------
  silhouette_score_ : float
      Mean Silhouette Coefficient for all samples. Computed via scikit-learn
      `sklearn.metrics.silhouette_score`.
  
  silhouette_samples_ : array, shape = [n_samples]
      Silhouette Coefficient for each samples. Computed via scikit-learn
      `sklearn.metrics.silhouette_samples`.
  
  n_samples_ : integer
      Number of total samples in the dataset (X.shape[0])
  
  n_clusters_ : integer
      Number of clusters (e.g. n_clusters or k value) passed to internal
      scikit-learn model.
  
  y_tick_pos_ : array of shape (n_clusters,)
      The computed center positions of each cluster on the y-axis
  
  Examples
  --------
  
  >>> from yellowbrick.cluster import SilhouetteVisualizer
  >>> from sklearn.cluster import KMeans
  >>> model = SilhouetteVisualizer(KMeans(10))
  >>> model.fit(X)
  >>> model.show()
class_docstr_tok: ["The","Silhouette","Visualizer","displays","the","silhouette","coefficient","for","each","sample","on","a","per-cluster","basis",",","visually","evaluating","the","density","and","separation","between","clusters",".","The","score","is","calculated","by","averaging","the","silhouette","coefficient","for","each","sample",",","computed","as","the","difference","between","the","average","intra-cluster","distance","and","the","mean","nearest-cluster","distance","for","each","sample",",","normalized","by","the","maximum","value",".","This","produces","a","score","between","-1","and","+1",",","where","scores","near","+1","indicate","high","separation","and","scores","near","-1","indicate","that","the","samples","may","have","been","assigned","to","the","wrong","cluster",".","In","SilhouetteVisualizer","plots",",","clusters","with","higher","scores","have","wider","silhouettes",",","but","clusters","that","are","less","cohesive","will","fall","short","of","the","average","score","across","all","clusters",",","which","is","plotted","as","a","vertical","dotted","red","line",".","This","is","particularly","useful","for","determining","cluster","imbalance",",","or","for","selecting","a","value","for","K","by","comparing","multiple","visualizers",".","Parameters","--","--","--","--","--","estimator",":","a","Scikit-Learn","clusterer","Should","be","an","instance","of","a","centroidal","clustering","algorithm","(","``","KMeans","``","or","``","MiniBatchKMeans","``",")",".","If","the","estimator","is","not","fitted",",","it","is","fit","when","the","visualizer","is","fitted",",","unless","otherwise","specified","by","``","is_fitted","``",".","ax",":","matplotlib","Axes",",","default",":","None","The","axes","to","plot","the","figure","on",".","If","None","is","passed","in","the","current","axes","will","be","used","(","or","generated","if","required",")",".","colors",":","iterable","or","string",",","default",":","None","A","collection","of","colors","to","use","for","each","cluster","group",".","If","there","are","fewer","colors","than","cluster","groups",",","colors","will","repeat",".","May","also","be","a","Yellowbrick","or","matplotlib","colormap","string",".","is_fitted",":","bool","or","str",",","default='auto'","Specify","if","the","wrapped","estimator","is","already","fitted",".","If","False",",","the","estimator","will","be","fit","when","the","visualizer","is","fit",",","otherwise",",","the","estimator","will","not","be","modified",".","If","'auto","'","(","default",")",",","a","helper","method","will","check","if","the","estimator","is","fitted","before","fitting","it","again",".","kwargs",":","dict","Keyword","arguments","that","are","passed","to","the","base","class","and","may","influence","the","visualization","as","defined","in","other","Visualizers",".","Attributes","--","--","--","--","--","silhouette_score_",":","float","Mean","Silhouette","Coefficient","for","all","samples",".","Computed","via","scikit-learn","`","sklearn.metrics.silhouette_score","`",".","silhouette_samples_",":","array",",","shape","=","[","n_samples","]","Silhouette","Coefficient","for","each","samples",".","Computed","via","scikit-learn","`","sklearn.metrics.silhouette_samples","`",".","n_samples_",":","integer","Number","of","total","samples","in","the","dataset","(","X.shape","[","0","]",")","n_clusters_",":","integer","Number","of","clusters","(","e.g",".","n_clusters","or","k","value",")","passed","to","internal","scikit-learn","model",".","y_tick_pos_",":","array","of","shape","(","n_clusters",",",")","The","computed","center","positions","of","each","cluster","on","the","y-axis","Examples","--","--","--","--",">",">",">","from","yellowbrick.cluster","import","SilhouetteVisualizer",">",">",">","from","sklearn.cluster","import","KMeans",">",">",">","model","=","SilhouetteVisualizer","(","KMeans","(","10",")",")",">",">",">","model.fit","(","X",")",">",">",">","model.show","(",")"]
code: def __init__(
      self, estimator, ax=None, colors=None, is_fitted="auto", **kwargs
  ):
      # Initialize the visualizer bases
      super(SilhouetteVisualizer, self).__init__(
          estimator, ax=ax, is_fitted=is_fitted, **kwargs
      )
  
      # Visual Properties
      # Use colors if it is given, otherwise attempt to use colormap which
      # which will override colors. If neither is found, default to None.
      # The colormap may yet still be found in resolve_colors
      self.colors = colors
      if "colormap" in kwargs:
          self.colors = kwargs["colormap"]
  
file_path: yellowbrick/yellowbrick/cluster/silhouette.py
imports: import numpy
  import matplotlib.ticker
  from sklearn.metrics import silhouette_score, silhouette_samples
  from yellowbrick.utils import check_fitted
  from yellowbrick.style import resolve_colors
  from yellowbrick.cluster.base import ClusteringScoreVisualizer
label_desc: Use image node_id 1 to create a new SilhouetteVisualizer object from inherited base classes: ClusteringScoreVisualizer with example: obj = SilhouetteVisualizer(estimator, ax, colors, is_fitted)