code: def dbscan(
      input_matrix: Union[pd.Series, pd.DataFrame],
      eps=0.5,
      min_samples=5,
      metric="euclidean",
      metric_params=None,
      leaf_size=30,
      n_jobs=-1,
  ) -> VectorSeries:
      """
      Perform DBSCAN clustering on the given input.
  
      Density-based spatial clustering of applications with noise (DBSCAN)
      is used in natural language processing
      to separate texts into clusters (groups)
      (e.g. some texts in a corpus might be about sports
      and some about music, so they will differ in the usage
      of technical terms; the DBSCAN algorithm uses this
      to separate them into clusters). It chooses the
      number of clusters on its own.
  
      Given a document-term matrix (so in
      texthero usually a Series after applying
      :meth:`texthero.representation.tfidf` or some other first
      representation function that assigns a scalar (a weight) to each
      word), DBSCAN will find topics (clusters) and assign a topic to
      each document.
  
      DBSCAN can directly handle sparse input, so when calling dbscan on a
      sparse DataFrame, the advantage of sparseness is kept.
  
      Parameters
      ----------
      input_matrix: Pandas Series (VectorSeries) or DataFrame
  
      eps : float, optional, default=0.5
          The maximum distance between two samples for one to be considered
          as in the neighborhood of the other. This is not a maximum bound
          on the distances of points within a cluster. This is the most
          important DBSCAN parameter to choose appropriately for your data
          set and distance function.
  
      min_samples : int, optional, default=5
          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, optional, default='euclidean'
          The metric to use when calculating distance between instances in a
          feature array. Use
          `sorted(sklearn.neighbors.VALID_METRICS['brute'])`
          to see valid options.
  
      metric_params : dict, optional, default=None
          Additional keyword arguments for the metric function.
  
      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.
  
      n_jobs : int, optional, default=-1
          The number of parallel jobs to run.
          ``-1`` means using all processors.
  
      Returns
      -------
      Pandas Series with the cluster the document was assigned to in each
      cell.
  
      Examples
      --------
      >>> import texthero as hero
      >>> import pandas as pd
      >>> s = pd.Series(["Football, Sports, Soccer",
      ...                "music, violin, orchestra",
      ...                "football, fun, sports", "music, enjoy, guitar"])
      >>> s = s.pipe(hero.clean).pipe(hero.tokenize).pipe(hero.tfidf)
      >>> hero.dbscan(s, min_samples=1, eps=4)
      0    0
      1    1
      2    0
      3    1
      dtype: category
      Categories (2, int64): [0, 1]
      >>> # As we can see, the documents are correctly
      >>> # separated into topics / clusters by the algorithm
      >>> # and we didn't even have to say how many topics there are!
  
      See also
      --------
      `DBSCAN on Wikipedia <https://en.wikipedia.org/wiki/DBSCAN>`_
  
      """
  
      if isinstance(input_matrix, pd.DataFrame):
          input_matrix_coo = input_matrix.sparse.to_coo()
          input_matrix_for_vectorization = input_matrix_coo.astype(
              "float64"
          )
      else:
          input_matrix_for_vectorization = list(input_matrix)
  
      return pd.Series(
          DBSCAN(
              eps=eps,
              min_samples=min_samples,
              metric=metric,
              metric_params=metric_params,
              leaf_size=leaf_size,
              n_jobs=n_jobs,
          ).fit_predict(input_matrix_for_vectorization),
          index=input_matrix.index,
      ).astype("category")
  
imports: import pandas
  import numpy
  from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
  from sklearn.manifold import TSNE
  from sklearn.decomposition import PCA, NMF
  from sklearn.cluster import KMeans, DBSCAN, MeanShift
  from sklearn.metrics.pairwise import cosine_similarity
  from sklearn.preprocessing import normalize
  from scipy.sparse import coo_matrix
  from typing import Optional, Union, Any
  from texthero._types import TextSeries, TokenSeries, VectorSeries, DataFrame, InputSeries
  from texthero import preprocessing
  import logging
  import warnings
label_desc: Use image node_id 8 for calling a global function with example usage: dbscan(input_matrix, eps, min_samples, metric, metric_params, leaf_size, n_jobs) and returns: pd