class_docstr: Perform DBSCAN clustering from vector array or distance matrix.
  
  DBSCAN - Density-Based Spatial Clustering of Applications with Noise.
  Finds core samples of high density and expands clusters from them.
  Good for data which contains clusters of similar density.
  
  Read more in the :ref:`User Guide <dbscan>`.
  
  Parameters
  ----------
  eps : float, optional
      The maximum distance between two samples for them to be considered
      as in the same neighborhood.
  
  min_samples : int, optional
      The number of samples (or total weight) in a neighborhood for a point
      to be considered as a core point. This includes the point itself.
  
  metric : string, or callable
      The metric to use when calculating distance between instances in a
      feature array. If metric is a string or callable, it must be one of
      the options allowed by metrics.pairwise.calculate_distance for its
      metric parameter.
      If metric is "precomputed", X is assumed to be a distance matrix and
      must be square. X may be a sparse matrix, in which case only "nonzero"
      elements may be considered neighbors for DBSCAN.
  
      .. versionadded:: 0.17
         metric *precomputed* to accept precomputed sparse matrix.
  
  algorithm : {'auto', 'ball_tree', 'kd_tree', 'brute'}, optional
      The algorithm to be used by the NearestNeighbors module
      to compute pointwise distances and find nearest neighbors.
      See NearestNeighbors module documentation for details.
  
  leaf_size : int, optional (default = 30)
      Leaf size passed to BallTree or cKDTree. This can affect the speed
      of the construction and query, as well as the memory required
      to store the tree. The optimal value depends
      on the nature of the problem.
  
  p : float, optional
      The power of the Minkowski metric to be used to calculate distance
      between points.
  
  n_jobs : int, optional (default = 1)
      The number of parallel jobs to run.
      If ``-1``, then the number of jobs is set to the number of CPU cores.
  
  Attributes
  ----------
  core_sample_indices_ : array, shape = [n_core_samples]
      Indices of core samples.
  
  components_ : array, shape = [n_core_samples, n_features]
      Copy of each core sample found by training.
  
  labels_ : array, shape = [n_samples]
      Cluster labels for each point in the dataset given to fit().
      Noisy samples are given the label -1.
  
  Notes
  -----
  See examples/cluster/plot_dbscan.py for an example.
  
  This implementation bulk-computes all neighborhood queries, which increases
  the memory complexity to O(n.d) where d is the average number of neighbors,
  while original DBSCAN had memory complexity O(n).
  
  Sparse neighborhoods can be precomputed using
  :func:`NearestNeighbors.radius_neighbors_graph
  <sklearn.neighbors.NearestNeighbors.radius_neighbors_graph>`
  with ``mode='distance'``.
  
  References
  ----------
  Ester, M., H. P. Kriegel, J. Sander, and X. Xu, "A Density-Based
  Algorithm for Discovering Clusters in Large Spatial Databases with Noise".
  In: Proceedings of the 2nd International Conference on Knowledge Discovery
  and Data Mining, Portland, OR, AAAI Press, pp. 226-231. 1996
class_docstr_tok: ["Perform","DBSCAN","clustering","from","vector","array","or","distance","matrix",".","DBSCAN","-","Density-Based","Spatial","Clustering","of","Applications","with","Noise",".","Finds","core","samples","of","high","density","and","expands","clusters","from","them",".","Good","for","data","which","contains","clusters","of","similar","density",".","Read","more","in","the",":","ref",":","`","User","Guide","<","dbscan",">","`",".","Parameters","--","--","--","--","--","eps",":","float",",","optional","The","maximum","distance","between","two","samples","for","them","to","be","considered","as","in","the","same","neighborhood",".","min_samples",":","int",",","optional","The","number","of","samples","(","or","total","weight",")","in","a","neighborhood","for","a","point","to","be","considered","as","a","core","point",".","This","includes","the","point","itself",".","metric",":","string",",","or","callable","The","metric","to","use","when","calculating","distance","between","instances","in","a","feature","array",".","If","metric","is","a","string","or","callable",",","it","must","be","one","of","the","options","allowed","by","metrics.pairwise.calculate_distance","for","its","metric","parameter",".","If","metric","is","``","precomputed","''",",","X","is","assumed","to","be","a","distance","matrix","and","must","be","square",".","X","may","be","a","sparse","matrix",",","in","which","case","only","``","nonzero","''","elements","may","be","considered","neighbors","for","DBSCAN",".","..","versionadded",":",":","0.17","metric","*","precomputed","*","to","accept","precomputed","sparse","matrix",".","algorithm",":","{","'auto","'",",","'ball_tree","'",",","'kd_tree","'",",","'brute","'","}",",","optional","The","algorithm","to","be","used","by","the","NearestNeighbors","module","to","compute","pointwise","distances","and","find","nearest","neighbors",".","See","NearestNeighbors","module","documentation","for","details",".","leaf_size",":","int",",","optional","(","default","=","30",")","Leaf","size","passed","to","BallTree","or","cKDTree",".","This","can","affect","the","speed","of","the","construction","and","query",",","as","well","as","the","memory","required","to","store","the","tree",".","The","optimal","value","depends","on","the","nature","of","the","problem",".","p",":","float",",","optional","The","power","of","the","Minkowski","metric","to","be","used","to","calculate","distance","between","points",".","n_jobs",":","int",",","optional","(","default","=","1",")","The","number","of","parallel","jobs","to","run",".","If","``","-1","``",",","then","the","number","of","jobs","is","set","to","the","number","of","CPU","cores",".","Attributes","--","--","--","--","--","core_sample_indices_",":","array",",","shape","=","[","n_core_samples","]","Indices","of","core","samples",".","components_",":","array",",","shape","=","[","n_core_samples",",","n_features","]","Copy","of","each","core","sample","found","by","training",".","labels_",":","array",",","shape","=","[","n_samples","]","Cluster","labels","for","each","point","in","the","dataset","given","to","fit","(",")",".","Noisy","samples","are","given","the","label","-1",".","Notes","--","--","-","See","examples\/cluster\/plot_dbscan.py","for","an","example",".","This","implementation","bulk-computes","all","neighborhood","queries",",","which","increases","the","memory","complexity","to","O","(","n.d",")","where","d","is","the","average","number","of","neighbors",",","while","original","DBSCAN","had","memory","complexity","O","(","n",")",".","Sparse","neighborhoods","can","be","precomputed","using",":","func",":","`","NearestNeighbors.radius_neighbors_graph","<","sklearn.neighbors.NearestNeighbors.radius_neighbors_graph",">","`","with","``","mode='distance","'","``",".","References","--","--","--","--","--","Ester",",","M.",",","H.","P.","Kriegel",",","J.","Sander",",","and","X.","Xu",",","``","A","Density-Based","Algorithm","for","Discovering","Clusters","in","Large","Spatial","Databases","with","Noise","''",".","In",":","Proceedings","of","the","2nd","International","Conference","on","Knowledge","Discovery","and","Data","Mining",",","Portland",",","OR",",","AAAI","Press",",","pp",".","226-231",".","1996"]
docstr: Perform DBSCAN clustering from features or distance matrix.
  
  Parameters
  ----------
  X : array or sparse (CSR) matrix of shape (n_samples, n_features), or                 array of shape (n_samples, n_samples)
      A feature array, or array of distances between samples if
      ``metric='precomputed'``.
  sample_weight : array, shape (n_samples,), optional
      Weight of each sample, such that a sample with a weight of at least
      ``min_samples`` is by itself a core sample; a sample with negative
      weight may inhibit its eps-neighbor from being core.
      Note that weights are absolute, and default to 1.
docstr_tok: ["Perform","DBSCAN","clustering","from","features","or","distance","matrix",".","Parameters","--","--","--","--","--","X",":","array","or","sparse","(","CSR",")","matrix","of","shape","(","n_samples",",","n_features",")",",","or","array","of","shape","(","n_samples",",","n_samples",")","A","feature","array",",","or","array","of","distances","between","samples","if","``","metric='precomputed","'","``",".","sample_weight",":","array",",","shape","(","n_samples",",",")",",","optional","Weight","of","each","sample",",","such","that","a","sample","with","a","weight","of","at","least","``","min_samples","``","is","by","itself","a","core","sample",";","a","sample","with","negative","weight","may","inhibit","its","eps-neighbor","from","being","core",".","Note","that","weights","are","absolute",",","and","default","to","1","."]
code: def fit(self, X, y=None, sample_weight=None):
      """Perform DBSCAN clustering from features or distance matrix.
  
          Parameters
          ----------
          X : array or sparse (CSR) matrix of shape (n_samples, n_features), or \
                  array of shape (n_samples, n_samples)
              A feature array, or array of distances between samples if
              ``metric='precomputed'``.
          sample_weight : array, shape (n_samples,), optional
              Weight of each sample, such that a sample with a weight of at least
              ``min_samples`` is by itself a core sample; a sample with negative
              weight may inhibit its eps-neighbor from being core.
              Note that weights are absolute, and default to 1.
          """
      X = check_array(X, accept_sparse="csr")
      clust = dbscan(
          X, sample_weight=sample_weight, **self.get_params()
      )
      self.core_sample_indices_, self.labels_ = clust
      if len(self.core_sample_indices_):
          # fix for scipy sparse indexing issue
          self.components_ = X[self.core_sample_indices_].copy()
      else:
          # no core samples
          self.components_ = np.empty((0, X.shape[1]))
      return self
  
file_path: catboost/contrib/python/scikit-learn/py2/sklearn/cluster/dbscan_.py
imports: import numpy
  from scipy import sparse
  from ..base import BaseEstimator, ClusterMixin
  from ..utils import check_array, check_consistent_length
  from ..utils.fixes import astype
  from ..neighbors import NearestNeighbors
  from ._dbscan_inner import dbscan_inner
label_desc: Use image node_id 2 for calling the DBSCAN obj's underlying member method code with example usage: obj.fit(X, y, sample_weight) and returns: self