code: def fit(self, X):
          
          self.n_samples_fit = X.shape[0]
  
          if self.metric_kwds is None:
              metric_kwds = {}
          else:
              metric_kwds = self.metric_kwds
  
          self.pynndescent_ = NNDescent(
              X,
              self.metric,
              metric_kwds,
              self.n_neighbors,
              self.n_trees,
              self.leaf_size,
              self.pruning_level,
              self.tree_init,
              self.random_state,
              self.algorithm,
              self.max_candidates,
              self.n_iters,
              self.early_termination_value,
              self.sampling_rate,
          )
  
          return self
docs: Fit the PyNNDescent transformer to build KNN graphs with
          neighbors given by the dataset X.
  
          Parameters
          ----------
          X : array-like, shape (n_samples, n_features)
              Sample data
  
          Returns
          -------
          transformer : PyNNDescentTransformer
              The trained transformer