parameters: (self, X, y=None)
return_statement: return self
docstring: Perform OPTICS clustering.
  
          Extracts an ordered list of points and reachability distances, and
          performs initial clustering using ``max_eps`` distance specified at
          OPTICS object instantiation.
  
          Parameters
          ----------
          X : array, shape (n_samples, n_features), or (n_samples, n_samples)  \
          if metric=’precomputed’
              A feature array, or array of distances between samples if
              metric='precomputed'.
  
          y : ignored
              Ignored.
  
          Returns
          -------
          self : instance of OPTICS
              The instance.
docstring_summary: Perform OPTICS clustering.
docstring_tokens: Perform OPTICS clustering .
function: def fit(self, X, y=None):
          """Perform OPTICS clustering.
  
          Extracts an ordered list of points and reachability distances, and
          performs initial clustering using ``max_eps`` distance specified at
          OPTICS object instantiation.
  
          Parameters
          ----------
          X : array, shape (n_samples, n_features), or (n_samples, n_samples)  \
          if metric=’precomputed’
              A feature array, or array of distances between samples if
              metric='precomputed'.
  
          y : ignored
              Ignored.
  
          Returns
          -------
          self : instance of OPTICS
              The instance.
          """
          X = check_array(X, dtype=np.float)
  
          if self.cluster_method not in ['dbscan', 'xi']:
              raise ValueError("cluster_method should be one of"
                               " 'dbscan' or 'xi' but is %s" %
                               self.cluster_method)
  
          (self.ordering_, self.core_distances_, self.reachability_,
           self.predecessor_) = compute_optics_graph(
               X=X, min_samples=self.min_samples, algorithm=self.algorithm,
               leaf_size=self.leaf_size, metric=self.metric,
               metric_params=self.metric_params, p=self.p, n_jobs=self.n_jobs,
               max_eps=self.max_eps)
  
          # Extract clusters from the calculated orders and reachability
          if self.cluster_method == 'xi':
              labels_, clusters_ = cluster_optics_xi(
                  self.reachability_,
                  self.predecessor_,
                  self.ordering_,
                  self.min_samples,
                  self.min_cluster_size,
                  self.xi,
                  self.predecessor_correction)
              self.cluster_hierarchy_ = clusters_
          elif self.cluster_method == 'dbscan':
              if self.eps is None:
                  eps = self.max_eps
              else:
                  eps = self.eps
  
              if eps > self.max_eps:
                  raise ValueError('Specify an epsilon smaller than %s. Got %s.'
                                   % (self.max_eps, eps))
  
              labels_ = cluster_optics_dbscan(self.reachability_,
                                              self.core_distances_,
                                              self.ordering_,
                                              eps)
  
          self.labels_ = labels_
          return self
function_tokens: def fit ( self , X , y = None ) : X = check_array ( X , dtype = np . float ) if self . cluster_method not in [ 'dbscan' , 'xi' ] : raise ValueError ( "cluster_method should be one of" " 'dbscan' or 'xi' but is %s" % self . cluster_method ) ( self . ordering_ , self . core_distances_ , self . reachability_ , self . predecessor_ ) = compute_optics_graph ( X = X , min_samples = self . min_samples , algorithm = self . algorithm , leaf_size = self . leaf_size , metric = self . metric , metric_params = self . metric_params , p = self . p , n_jobs = self . n_jobs , max_eps = self . max_eps ) # Extract clusters from the calculated orders and reachability if self . cluster_method == 'xi' : labels_ , clusters_ = cluster_optics_xi ( self . reachability_ , self . predecessor_ , self . ordering_ , self . min_samples , self . min_cluster_size , self . xi , self . predecessor_correction ) self . cluster_hierarchy_ = clusters_ elif self . cluster_method == 'dbscan' : if self . eps is None : eps = self . max_eps else : eps = self . eps if eps > self . max_eps : raise ValueError ( 'Specify an epsilon smaller than %s. Got %s.' % ( self . max_eps , eps ) ) labels_ = cluster_optics_dbscan ( self . reachability_ , self . core_distances_ , self . ordering_ , eps ) self . labels_ = labels_ return self