code: def ranked_batch(
      classifier: Union[BaseLearner, BaseCommittee],
      unlabeled: modALinput,
      uncertainty_scores: np.ndarray,
      n_instances: int,
      metric: Union[str, Callable],
      n_jobs: Union[int, None],
  ) -> np.ndarray:
      """
      Query our top :n_instances: to request 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.
          unlabeled: Set of records to be considered for our active learning model.
          uncertainty_scores: Our classifier's predictions over the response variable.
          n_instances: Limit on the number of records to query from our unlabeled set.
          metric: This parameter is passed to :func:`~sklearn.metrics.pairwise.pairwise_distances`.
          n_jobs: This parameter is passed to :func:`~sklearn.metrics.pairwise.pairwise_distances`.
  
      Returns:
          The indices of the top n_instances ranked unlabelled samples.
          The uncertainty scores of the chosen instances.
  
      """
      # Make a local copy of our classifier's training data.
      # Define our record container and record the best cold start instance in the case of cold start.
  
      # transform unlabeled data if needed
      if classifier.on_transformed:
          unlabeled = classifier.transform_without_estimating(unlabeled)
  
      if classifier.X_training is None:
          (
              best_coldstart_instance_index,
              labeled,
          ) = select_cold_start_instance(
              X=unlabeled, metric=metric, n_jobs=n_jobs
          )
          instance_index_ranking = [best_coldstart_instance_index]
      elif data_shape(classifier.X_training)[0] > 0:
          labeled = (
              classifier.transform_without_estimating(
                  classifier.X_training
              )
              if classifier.on_transformed
              else classifier.X_training[:]
          )
          instance_index_ranking = []
  
      # The maximum number of records to sample.
      ceiling = np.minimum(unlabeled.shape[0], n_instances) - len(
          instance_index_ranking
      )
  
      # mask for unlabeled initialized as transparent
      mask = np.ones(unlabeled.shape[0], bool)
  
      for _ in range(ceiling):
          # Receive the instance and corresponding index from our unlabeled copy that scores highest.
          instance_index, instance, mask = select_instance(
              X_training=labeled,
              X_pool=unlabeled,
              X_uncertainty=uncertainty_scores,
              mask=mask,
              metric=metric,
              n_jobs=n_jobs,
          )
  
          # Add our instance we've considered for labeling to our labeled set. Although we don't
          # know it's label, we want further iterations to consider the newly-added instance so
          # that we don't query the same instance redundantly.
          labeled = data_vstack((labeled, instance))
  
          # Finally, append our instance's index to the bottom of our ranking.
          instance_index_ranking.append(instance_index)
  
      # Return numpy array, not a list.
      return (
          np.array(instance_index_ranking),
          uncertainty_scores[np.array(instance_index_ranking)],
      )
  
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 3 for calling a global function with example usage: ranked_batch(classifier, unlabeled, uncertainty_scores, n_instances, metric, n_jobs) and returns: np,  uncertainty_scores