class_docstr: Perform robust single linkage clustering from a vector array
  or distance matrix.
  
  Robust single linkage is a modified version of single linkage that
  attempts to be more robust to noise. Specifically the goal is to
  more accurately approximate the level set tree of the unknown
  probability density function from which the sample data has
  been drawn.
  
  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'``.
  
  cut : float
      The reachability distance value to cut the cluster heirarchy at
      to derive a flat cluster labelling.
  
  k : int, optional (default=5)
      Reachability distances will be computed with regard to the `k`
      nearest neighbors.
  
  alpha : float, optional (default=np.sqrt(2))
      Distance scaling for reachability distance computation. Reachability
      distance is computed as
      $max \{ core_k(a), core_k(b), 1/\alpha d(a,b) \}$.
  
  gamma : int, optional (default=5)
      Ignore any clusters in the flat clustering with size less than gamma,
      and declare points in such clusters as noise points.
  
  metric : string, or callable, optional (default='euclidean')
      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.pairwise_distances for its
      metric parameter.
      If metric is "precomputed", X is assumed to be a distance matrix and
      must be square.
      
  metric_params : dict, option (default={})
      Keyword parameter arguments for calling the metric (for example
      the p values if using the minkowski metric).
  
  algorithm : string, optional (default='best')
      Exactly which algorithm to use; hdbscan has variants specialised
      for different characteristics of the data. By default this is set
      to ``best`` which chooses the "best" algorithm given the nature of
      the data. You can force other options if you believe you know
      better. Options are:
          * ``small``
          * ``small_kdtree``
          * ``large_kdtree``
          * ``large_kdtree_fastcluster``
  
  
  core_dist_n_jobs : int, optional
      Number of parallel jobs to run in core distance computations (if
      supported by the specific algorithm). For ``core_dist_n_jobs``
      below -1, (n_cpus + 1 + core_dist_n_jobs) are used.
      (default 4)
  
  Attributes
  -------
  labels_ : ndarray, shape (n_samples, )
      Cluster labels for each point.  Noisy samples are given the label -1.
  
  cluster_hierarchy_ : SingleLinkageTree object
      The single linkage tree produced during clustering.
      This object provides several methods for:
          * Plotting
          * Generating a flat clustering
          * Exporting to NetworkX
          * Exporting to Pandas
  
  References
  ----------
  .. [1] Chaudhuri, K., & Dasgupta, S. (2010). Rates of convergence for the
     cluster tree. In Advances in Neural Information Processing Systems
     (pp. 343-351).
class_docstr_tok: ["Perform","robust","single","linkage","clustering","from","a","vector","array","or","distance","matrix",".","Robust","single","linkage","is","a","modified","version","of","single","linkage","that","attempts","to","be","more","robust","to","noise",".","Specifically","the","goal","is","to","more","accurately","approximate","the","level","set","tree","of","the","unknown","probability","density","function","from","which","the","sample","data","has","been","drawn",".","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","'","``",".","cut",":","float","The","reachability","distance","value","to","cut","the","cluster","heirarchy","at","to","derive","a","flat","cluster","labelling",".","k",":","int",",","optional","(","default=5",")","Reachability","distances","will","be","computed","with","regard","to","the","`","k","`","nearest","neighbors",".","alpha",":","float",",","optional","(","default=np.sqrt","(","2",")",")","Distance","scaling","for","reachability","distance","computation",".","Reachability","distance","is","computed","as","$","max","\\","{","core_k","(","a",")",",","core_k","(","b",")",",","1\/\\alpha","d","(","a",",","b",")","\\","}","$",".","gamma",":","int",",","optional","(","default=5",")","Ignore","any","clusters","in","the","flat","clustering","with","size","less","than","gamma",",","and","declare","points","in","such","clusters","as","noise","points",".","metric",":","string",",","or","callable",",","optional","(","default='euclidean","'",")","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.pairwise_distances","for","its","metric","parameter",".","If","metric","is","``","precomputed","''",",","X","is","assumed","to","be","a","distance","matrix","and","must","be","square",".","metric_params",":","dict",",","option","(","default=","{","}",")","Keyword","parameter","arguments","for","calling","the","metric","(","for","example","the","p","values","if","using","the","minkowski","metric",")",".","algorithm",":","string",",","optional","(","default='best","'",")","Exactly","which","algorithm","to","use",";","hdbscan","has","variants","specialised","for","different","characteristics","of","the","data",".","By","default","this","is","set","to","``","best","``","which","chooses","the","``","best","''","algorithm","given","the","nature","of","the","data",".","You","can","force","other","options","if","you","believe","you","know","better",".","Options","are",":","*","``","small","``","*","``","small_kdtree","``","*","``","large_kdtree","``","*","``","large_kdtree_fastcluster","``","core_dist_n_jobs",":","int",",","optional","Number","of","parallel","jobs","to","run","in","core","distance","computations","(","if","supported","by","the","specific","algorithm",")",".","For","``","core_dist_n_jobs","``","below","-1",",","(","n_cpus","+","1","+","core_dist_n_jobs",")","are","used",".","(","default","4",")","Attributes","--","--","--","-","labels_",":","ndarray",",","shape","(","n_samples",",",")","Cluster","labels","for","each","point",".","Noisy","samples","are","given","the","label","-1.","cluster_hierarchy_",":","SingleLinkageTree","object","The","single","linkage","tree","produced","during","clustering",".","This","object","provides","several","methods","for",":","*","Plotting","*","Generating","a","flat","clustering","*","Exporting","to","NetworkX","*","Exporting","to","Pandas","References","--","--","--","--","--","..","[","1","]","Chaudhuri",",","K.",",","&","Dasgupta",",","S.","(","2010",")",".","Rates","of","convergence","for","the","cluster","tree",".","In","Advances","in","Neural","Information","Processing","Systems","(","pp",".","343-351",")","."]
code: def __init__(
      self,
      cut=0.4,
      k=5,
      alpha=1.4142135623730951,
      gamma=5,
      metric="euclidean",
      algorithm="best",
      core_dist_n_jobs=4,
      metric_params={},
  ):
      self.cut = cut
      self.k = k
      self.alpha = alpha
      self.gamma = gamma
      self.metric = metric
      self.algorithm = algorithm
      self.core_dist_n_jobs = core_dist_n_jobs
      self.metric_params = metric_params
  
imports: import numpy
  from sklearn.base import BaseEstimator, ClusterMixin
  from sklearn.metrics import pairwise_distances
  from scipy.sparse import issparse
  from joblib import Memory
  from sklearn.utils import check_array
  from ._hdbscan_linkage import mst_linkage_core, mst_linkage_core_vector, label
  from ._hdbscan_boruvka import KDTreeBoruvkaAlgorithm, BallTreeBoruvkaAlgorithm
  from .dist_metrics import DistanceMetric
  from ._hdbscan_reachability import mutual_reachability
  from .plots import SingleLinkageTree
  from sklearn.neighbors import KDTree, BallTree
  from warnings import warn
label_desc: Use image node_id 1 to create a new RobustSingleLinkage object from inherited base classes: BaseEstimator, ClusterMixin with example: obj = RobustSingleLinkage(cut, k, alpha, gamma, metric, algorithm, core_dist_n_jobs, metric_params)