code: def estimate_bandwidth(
      X, *, quantile=0.3, n_samples=None, random_state=0, n_jobs=None
  ):
      """Estimate the bandwidth to use with the mean-shift algorithm.
  
      This function takes time at least quadratic in `n_samples`. For large
      datasets, it is wise to subsample by setting `n_samples`. Alternatively,
      the parameter `bandwidth` can be set to a small value without estimating
      it.
  
      Parameters
      ----------
      X : array-like of shape (n_samples, n_features)
          Input points.
  
      quantile : float, default=0.3
          Should be between [0, 1]
          0.5 means that the median of all pairwise distances is used.
  
      n_samples : int, default=None
          The number of samples to use. If not given, all samples are used.
  
      random_state : int, RandomState instance, default=None
          The generator used to randomly select the samples from input points
          for bandwidth estimation. Use an int to make the randomness
          deterministic.
          See :term:`Glossary <random_state>`.
  
      n_jobs : int, default=None
          The number of parallel jobs to run for neighbors search.
          ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
          ``-1`` means using all processors. See :term:`Glossary <n_jobs>`
          for more details.
  
      Returns
      -------
      bandwidth : float
          The bandwidth parameter.
      """
      X = check_array(X)
  
      random_state = check_random_state(random_state)
      if n_samples is not None:
          idx = random_state.permutation(X.shape[0])[:n_samples]
          X = X[idx]
      n_neighbors = int(X.shape[0] * quantile)
      if (
          n_neighbors < 1
      ):  # cannot fit NearestNeighbors with n_neighbors = 0
          n_neighbors = 1
      nbrs = NearestNeighbors(n_neighbors=n_neighbors, n_jobs=n_jobs)
      nbrs.fit(X)
  
      bandwidth = 0.0
      for batch in gen_batches(len(X), 500):
          d, _ = nbrs.kneighbors(X[batch, :], return_distance=True)
          bandwidth += np.max(d, axis=1).sum()
  
      return bandwidth / X.shape[0]
  
imports: import warnings
  from collections import defaultdict
  from numbers import Integral, Real
  import numpy
  from .._config import config_context
  from ..base import BaseEstimator, ClusterMixin, _fit_context
  from ..metrics.pairwise import pairwise_distances_argmin
  from ..neighbors import NearestNeighbors
  from ..utils import check_array, check_random_state, gen_batches
  from ..utils._param_validation import Interval, validate_params
  from ..utils.parallel import Parallel, delayed
  from ..utils.validation import check_is_fitted
label_desc: Use image node_id 1 for calling a global function with example usage: estimate_bandwidth(X) and returns: unknown