docstr: Transforms a minibatch dataframe to one with a new column '_dbscan' containing the DBSCAN cluster labels on the minibatch and generates a graph with the minibatch and the original graph, with edges between the minibatch and the original graph inferred from the umap embedding or features dataframe. Graph nodes | edges will be colored by '_dbscan' column.
      
      Examples:
      ::
  
          fit:
              g = graphistry.edges(edf, 'src', 'dst').nodes(ndf, 'node')
              g2 = g.featurize().dbscan()
  
          predict:
          ::
  
              emb, X, _, ndf = g2.transform_dbscan(ndf, return_graph=False)
              # or
              g3 = g2.transform_dbscan(ndf, return_graph=True)
              g3.plot()
  
      likewise for umap:
      ::
  
          fit:
              g = graphistry.edges(edf, 'src', 'dst').nodes(ndf, 'node')
              g2 = g.umap(X=.., y=..).dbscan()
  
          predict:
          ::
  
              emb, X, y, ndf = g2.transform_dbscan(ndf, ndf, return_graph=False)
              # or
              g3 = g2.transform_dbscan(ndf, ndf, return_graph=True)
              g3.plot()
  
  
  Args:
      :df: dataframe to transform
      :y: optional labels dataframe
      :min_dist: The maximum distance between two samples for them to be considered as in the same neighborhood.
          smaller values will result in less edges between the minibatch and the original graph.
          Default 'auto', infers min_dist from the mean distance and std of new points to the original graph
      :fit_umap_embedding: whether to use UMAP embeddings or features dataframe when inferring edges between
          the minibatch and the original graph. Default False, uses the features dataframe
      :sample: number of samples to use when inferring edges between the minibatch and the original graph,
          if None, will only use closest point to the minibatch. If greater than 0, will sample the closest `sample` points
          in existing graph to pull in more edges. Default None
      :kind: 'nodes' or 'edges'
      :return_graph: whether to return a graph or the (emb, X, y, minibatch df enriched with DBSCAN labels), default True
          infered graph supports kind='nodes' only. 
      :verbose: whether to print out progress, default False
docstr_tok: ["Transforms","a","minibatch","dataframe","to","one","with","a","new","column","'_dbscan","'","containing","the","DBSCAN","cluster","labels","on","the","minibatch","and","generates","a","graph","with","the","minibatch","and","the","original","graph",",","with","edges","between","the","minibatch","and","the","original","graph","inferred","from","the","umap","embedding","or","features","dataframe",".","Graph","nodes","|","edges","will","be","colored","by","'_dbscan","'","column",".","Examples",":",":",":","fit",":","g","=","graphistry.edges","(","edf",",","'src","'",",","'dst","'",")",".nodes","(","ndf",",","'node","'",")","g2","=","g.featurize","(",")",".dbscan","(",")","predict",":",":",":","emb",",","X",",","_",",","ndf","=","g2.transform_dbscan","(","ndf",",","return_graph=False",")","#","or","g3","=","g2.transform_dbscan","(","ndf",",","return_graph=True",")","g3.plot","(",")","likewise","for","umap",":",":",":","fit",":","g","=","graphistry.edges","(","edf",",","'src","'",",","'dst","'",")",".nodes","(","ndf",",","'node","'",")","g2","=","g.umap","(","X=","..",",","y=","..",")",".dbscan","(",")","predict",":",":",":","emb",",","X",",","y",",","ndf","=","g2.transform_dbscan","(","ndf",",","ndf",",","return_graph=False",")","#","or","g3","=","g2.transform_dbscan","(","ndf",",","ndf",",","return_graph=True",")","g3.plot","(",")","Args",":",":","df",":","dataframe","to","transform",":","y",":","optional","labels","dataframe",":","min_dist",":","The","maximum","distance","between","two","samples","for","them","to","be","considered","as","in","the","same","neighborhood",".","smaller","values","will","result","in","less","edges","between","the","minibatch","and","the","original","graph",".","Default","'auto","'",",","infers","min_dist","from","the","mean","distance","and","std","of","new","points","to","the","original","graph",":","fit_umap_embedding",":","whether","to","use","UMAP","embeddings","or","features","dataframe","when","inferring","edges","between","the","minibatch","and","the","original","graph",".","Default","False",",","uses","the","features","dataframe",":","sample",":","number","of","samples","to","use","when","inferring","edges","between","the","minibatch","and","the","original","graph",",","if","None",",","will","only","use","closest","point","to","the","minibatch",".","If","greater","than","0",",","will","sample","the","closest","`","sample","`","points","in","existing","graph","to","pull","in","more","edges",".","Default","None",":","kind",":","'nodes","'","or","'edges'",":","return_graph",":","whether","to","return","a","graph","or","the","(","emb",",","X",",","y",",","minibatch","df","enriched","with","DBSCAN","labels",")",",","default","True","infered","graph","supports","kind='nodes","'","only",".",":","verbose",":","whether","to","print","out","progress",",","default","False"]
code: def transform_dbscan(
      self,
      df: pd.DataFrame,
      y: Optional[pd.DataFrame] = None,
      min_dist: Union[float, str] = "auto",
      infer_umap_embedding: bool = False,
      sample: Optional[int] = None,
      n_neighbors: Optional[int] = None,
      kind: str = "nodes",
      return_graph: bool = True,
      verbose: bool = False,
  ):  # type: ignore
      """Transforms a minibatch dataframe to one with a new column '_dbscan' containing the DBSCAN cluster labels on the minibatch and generates a graph with the minibatch and the original graph, with edges between the minibatch and the original graph inferred from the umap embedding or features dataframe. Graph nodes | edges will be colored by '_dbscan' column.
  
          Examples:
          ::
  
              fit:
                  g = graphistry.edges(edf, 'src', 'dst').nodes(ndf, 'node')
                  g2 = g.featurize().dbscan()
  
              predict:
              ::
  
                  emb, X, _, ndf = g2.transform_dbscan(ndf, return_graph=False)
                  # or
                  g3 = g2.transform_dbscan(ndf, return_graph=True)
                  g3.plot()
  
          likewise for umap:
          ::
  
              fit:
                  g = graphistry.edges(edf, 'src', 'dst').nodes(ndf, 'node')
                  g2 = g.umap(X=.., y=..).dbscan()
  
              predict:
              ::
  
                  emb, X, y, ndf = g2.transform_dbscan(ndf, ndf, return_graph=False)
                  # or
                  g3 = g2.transform_dbscan(ndf, ndf, return_graph=True)
                  g3.plot()
  
  
      Args:
          :df: dataframe to transform
          :y: optional labels dataframe
          :min_dist: The maximum distance between two samples for them to be considered as in the same neighborhood.
              smaller values will result in less edges between the minibatch and the original graph.
              Default 'auto', infers min_dist from the mean distance and std of new points to the original graph
          :fit_umap_embedding: whether to use UMAP embeddings or features dataframe when inferring edges between
              the minibatch and the original graph. Default False, uses the features dataframe
          :sample: number of samples to use when inferring edges between the minibatch and the original graph,
              if None, will only use closest point to the minibatch. If greater than 0, will sample the closest `sample` points
              in existing graph to pull in more edges. Default None
          :kind: 'nodes' or 'edges'
          :return_graph: whether to return a graph or the (emb, X, y, minibatch df enriched with DBSCAN labels), default True
              infered graph supports kind='nodes' only.
          :verbose: whether to print out progress, default False
  
      """
      emb, X, y, df = self._transform_dbscan(
          df, y, kind=kind, verbose=verbose
      )
      if return_graph and kind not in ["edges"]:
          df, y = make_safe_gpu_dataframes(df, y, "pandas")
          X, emb = make_safe_gpu_dataframes(X, emb, "pandas")
          g = self._infer_edges(
              emb,
              X,
              y,
              df,
              eps=min_dist,
              sample=sample,
              n_neighbors=n_neighbors,  # type: ignore
              infer_on_umap_embedding=infer_umap_embedding,
          )
          return g
      return emb, X, y, df
  
imports: import logging
  import pandas
  import numpy
  from typing import Any, List, Union, TYPE_CHECKING, Tuple, Optional
  from typing_extensions import Literal
  from collections import Counter
  from graphistry.Plottable import Plottable
  from graphistry.constants import CUML, UMAP_LEARN, DBSCAN
  from graphistry.features import ModelDict
  from graphistry.feature_utils import get_matrix_by_column_parts
label_desc: Use image node_id 5 for calling the ClusterMixin obj's underlying member method code with example usage: obj.transform_dbscan(df, y, min_dist, infer_umap_embedding, sample, n_neighbors, kind, return_graph, verbose) and returns: emb,  X,  y,  df, g