class_docstr: Hierarchical Clustering via Approximate Euclidean Minimum Spanning Tree
  
  Parameters
  ----------
  n_neighbors : int
      number of neighbors of each point used for approximate Euclidean
      minimum spanning tree (MST) algorithm.  See Notes below.
  edge_cutoff : float
      specify a fraction of edges to keep when selecting clusters.
      edge_cutoff should be between 0 and 1.
  min_cluster_size : int, optional
      specify a minimum number of points per cluster.  If not specified,
      all clusters will be kept.
  
  Attributes
  ----------
  X_train_ : ndarray
      the training data
  full_tree_ : sparse graph
      the full approximate Euclidean MST spanning the data
  cluster_graph_ : sparse graph
      the final (truncated) graph showing clusters
  n_components_ : int
      the number of clusters found.
  labels_ : int
      the cluster labels for each training point.  Labels range from -1
      to n_components_ - 1: points labeled -1 are in the background (i.e.
      their clusters were smaller than min_cluster_size)
  
  Notes
  -----
  This routine uses an approximate Euclidean minimum spanning tree (MST)
  to perform hierarchical clustering.  A true Euclidean minimum spanning
  tree naively costs O[N^3].  Graph traversal algorithms only help so much,
  because all N^2 edges must be used as candidates.  In this approximate
  algorithm, we use k < N edges from each point, so that the cost is only
  O[Nk log(Nk)]. For k = N, the approximation is exact; in practice for
  well-behaved data sets, the result is exact for k << N.
docstr: Fit the clustering model
  
  Parameters
  ----------
  X : array_like
      the data to be clustered: shape = [n_samples, n_features]
code: def fit(self, X):
      """Fit the clustering model
  
      Parameters
      ----------
      X : array_like
          the data to be clustered: shape = [n_samples, n_features]
      """
      X = np.asarray(X, dtype=float)
  
      self.X_train_ = X
  
      # generate a sparse graph using the k nearest neighbors of each point
      G = kneighbors_graph(
          X, n_neighbors=self.n_neighbors, mode="distance"
      )
  
      # Compute the minimum spanning tree of this graph
      self.full_tree_ = minimum_spanning_tree(G, overwrite=True)
  
      # Find the cluster labels
      (
          self.n_components_,
          self.labels_,
          self.cluster_graph_,
      ) = self.compute_clusters()
  
      return self
  
file_path: astroML/astroML/clustering/mst_clustering.py
imports: import numpy
  from scipy import sparse
  from sklearn.base import BaseEstimator
  from sklearn.neighbors import kneighbors_graph
label_desc: Use image node_id 2 for calling the HierarchicalClustering obj's underlying member method code with example usage: obj.fit(X) and returns: self