class_docstr: Combining multiple clusterings using evidence accumulation (EAC) first
  builds similarity matrix for each base clustering to model the similarity
  among the cluster assignment among each sample. After the similarity
  matrices are aggregated, a hierarchical clustering is built on it. See
  :cite:`fred2005combining` for details.
  
  Parameters
  ----------
  base_estimators : list or numpy array of shape (n_estimators,)
      A list of base estimators. Estimators must have a `labels_`
      attribute once fitted. Sklearn clustering estimators are recommended.
  
  n_clusters : int, optional (default=8)
      The number of clusters.
  
  linkage_method : str, optional (default='single')
      The linkage method to use (single, complete, average,
      weighted, median centroid, ward). See
      https://docs.scipy.org/doc/scipy/reference/cluster.hierarchy.html
      for more information.
  
  weights : numpy array of shape (n_estimators,)
      Estimator weights. May be used after the alignment.
  
  pre_fitted : bool, optional (default=False)
      Whether the base estimators are trained. If True, `fit`
      process may be skipped.
  
  Attributes
  ----------
  labels_ : int
      The predicted label of the fitted data.
  
  Z_ : numpy array
      The linkage matrix encoding the hierarchical clustering. This can be
      used to plot dendrogram using scipy.
docstr: Fit estimators.
  
  Parameters
  ----------
  X : numpy array of shape (n_samples, n_features)
      The input samples.
docstr_tok: ["Fit","estimators",".","Parameters","--","--","--","--","--","X",":","numpy","array","of","shape","(","n_samples",",","n_features",")","The","input","samples","."]
code: def fit(self, X):
      """Fit estimators.
  
      Parameters
      ----------
      X : numpy array of shape (n_samples, n_features)
          The input samples.
      """
  
      # Validate inputs X
      X = check_array(X)
      n_samples = X.shape[0]
  
      # initialize similarity matrix
      sim_mat_all = np.zeros([n_samples, n_samples])
  
      if self.pre_fitted:
          print("Training Skipped")
  
      else:
          for clf in self.base_estimators:
              clf.fit(X)
              clf.fitted_ = True
  
      for i, estimator in enumerate(self.base_estimators):
          check_is_fitted(estimator, ["labels_"])
  
          # get the labels from each base estimator
          labels = estimator.labels_.reshape(n_samples, 1)
  
          # generate the similarity matrix for the current estimator
          sim_mat = _generate_similarity_mat(labels)
  
          # add to the main similarity mat
          sim_mat_all = sim_mat_all + sim_mat
  
      # get the average of the similarity mat
      sim_mat_avg = np.divide(sim_mat_all, self.n_base_estimators_)
  
      # flip the similarity. smaller value implies more similarity
      sim_mat_avg = np.abs(np.max(sim_mat_avg) - sim_mat_avg)
  
      # build clusters
      self.Z_ = linkage(sim_mat_avg, method=self.linkage_method)
      self.labels_ = fcluster(
          self.Z_, self.n_clusters, criterion="maxclust"
      )
  
      # it may leads to different number of clusters as specified by the user
      if len(np.unique(self.labels_)) != self.n_clusters:
          warnings.warn(
              "EAC generates {n} clusters instead of {n_clusters}".format(
                  n=len(np.unique(self.labels_)),
                  n_clusters=self.n_clusters,
              )
          )
  
      return self
  
file_path: combo/combo/models/cluster_eac.py
imports: import warnings
  import numpy
  from scipy.cluster.hierarchy import fcluster
  from scipy.cluster.hierarchy import linkage
  from sklearn.utils import check_array
  from sklearn.utils.validation import check_is_fitted
  from pyod.utils.utility import check_parameter
  from .base import BaseAggregator
label_desc: Use image node_id 2 for calling the EAC obj's underlying member method code with example usage: obj.fit(X) and returns: self