code: def uncertainty_batch_sampling(
      classifier: Union[BaseLearner, BaseCommittee],
      X: Union[np.ndarray, sp.csr_matrix],
      n_instances: int = 20,
      metric: Union[str, Callable] = "euclidean",
      n_jobs: Optional[int] = None,
      **uncertainty_measure_kwargs,
  ) -> np.ndarray:
      """
      Batch sampling query strategy. Selects the least sure instances for labelling.
  
      This strategy differs from :func:`~modAL.uncertainty.uncertainty_sampling` because, although it is supported,
      traditional active learning query strategies suffer from sub-optimal record selection when passing
      `n_instances` > 1. This sampling strategy extends the interactive uncertainty query sampling by allowing for
      batch-mode uncertainty query sampling. Furthermore, it also enforces a ranking -- that is, which records among the
      batch are most important for labeling?
  
      Refer to Cardoso et al.'s "Ranked batch-mode active learning":
          https://www.sciencedirect.com/science/article/pii/S0020025516313949
  
      Args:
          classifier: One of modAL's supported active learning models.
          X: Set of records to be considered for our active learning model.
          n_instances: Number of records to return for labeling from `X`.
          metric: This parameter is passed to :func:`~sklearn.metrics.pairwise.pairwise_distances`
          n_jobs: If not set, :func:`~sklearn.metrics.pairwise.pairwise_distances_argmin_min` is used for calculation of
              distances between samples. Otherwise it is passed to :func:`~sklearn.metrics.pairwise.pairwise_distances`.
          **uncertainty_measure_kwargs: Keyword arguments to be passed for the :meth:`predict_proba` of the classifier.
  
      Returns:
          Indices of the instances from `X` chosen to be labelled
          Records from `X` chosen to be labelled.
          The uncertainty scores of the chosen instances.
  
      """
      uncertainty = classifier_uncertainty(
          classifier, X, **uncertainty_measure_kwargs
      )
      return ranked_batch(
          classifier,
          unlabeled=X,
          uncertainty_scores=uncertainty,
          n_instances=n_instances,
          metric=metric,
          n_jobs=n_jobs,
      )
  
file_path: modAL/modAL/batch.py
imports: from typing import Callable, Optional, Tuple, Union
  import numpy
  import scipy.sparse
  from sklearn.metrics.pairwise import pairwise_distances, pairwise_distances_argmin_min
  from modAL.models.base import BaseCommittee, BaseLearner
  from modAL.uncertainty import classifier_uncertainty
  from modAL.utils.data import data_shape, data_vstack, modALinput
label_desc: Use image node_id 4 for calling a global function with example usage: uncertainty_batch_sampling(classifier, X, n_instances, metric, n_jobs) and returns: ranked_batch