parameters: (self, X, y=None)
return_statement: return self
docstring: Create affinity matrix from negative euclidean distances, then
          apply affinity propagation clustering.
  
          Parameters
          ----------
  
          X: array-like, shape (n_samples, n_features) or (n_samples, n_samples)
              Data matrix or, if affinity is ``precomputed``, matrix of
              similarities / affinities.
docstring_summary: Create affinity matrix from negative euclidean distances, then
          apply affinity propagation clustering.
docstring_tokens: Create affinity matrix from negative euclidean distances then apply affinity propagation clustering .
function: def fit(self, X, y=None):
          """ Create affinity matrix from negative euclidean distances, then
          apply affinity propagation clustering.
  
          Parameters
          ----------
  
          X: array-like, shape (n_samples, n_features) or (n_samples, n_samples)
              Data matrix or, if affinity is ``precomputed``, matrix of
              similarities / affinities.
          """
          X = check_array(X, accept_sparse='csr')
          if self.affinity == "precomputed":
              self.affinity_matrix_ = X
          elif self.affinity == "euclidean":
              self.affinity_matrix_ = -euclidean_distances(X, squared=True)
          else:
              raise ValueError("Affinity must be 'precomputed' or "
                               "'euclidean'. Got %s instead"
                               % str(self.affinity))
  
          self.cluster_centers_indices_, self.labels_, self.n_iter_ = \
              affinity_propagation(
                  self.affinity_matrix_, self.preference, max_iter=self.max_iter,
                  convergence_iter=self.convergence_iter, damping=self.damping,
                  copy=self.copy, verbose=self.verbose, return_n_iter=True)
  
          if self.affinity != "precomputed":
              self.cluster_centers_ = X[self.cluster_centers_indices_].copy()
  
          return self
function_tokens: def fit ( self , X , y = None ) : X = check_array ( X , accept_sparse = 'csr' ) if self . affinity == "precomputed" : self . affinity_matrix_ = X elif self . affinity == "euclidean" : self . affinity_matrix_ = - euclidean_distances ( X , squared = True ) else : raise ValueError ( "Affinity must be 'precomputed' or " "'euclidean'. Got %s instead" % str ( self . affinity ) ) self . cluster_centers_indices_ , self . labels_ , self . n_iter_ = affinity_propagation ( self . affinity_matrix_ , self . preference , max_iter = self . max_iter , convergence_iter = self . convergence_iter , damping = self . damping , copy = self . copy , verbose = self . verbose , return_n_iter = True ) if self . affinity != "precomputed" : self . cluster_centers_ = X [ self . cluster_centers_indices_ ] . copy ( ) return self