code: def select_cold_start_instance(
      X: modALinput,
      metric: Union[str, Callable],
      n_jobs: Union[int, None],
  ) -> Tuple[int, modALinput]:
      """
      Define what to do if our batch-mode sampling doesn't have any labeled data -- a cold start.
  
      If our ranked batch sampling algorithm doesn't have any labeled data to determine similarity among the uncertainty
      set, this function finds the element with highest average similarity to cold-start the batch selection.
  
      TODO:
          - Figure out how to test this! E.g. how to create modAL model without training data.
          - Think of optimizing pairwise_distance call for large matrix.
  
      Refer to Cardoso et al.'s "Ranked batch-mode active learning":
          https://www.sciencedirect.com/science/article/pii/S0020025516313949
  
      Args:
          X: The set of unlabeled records.
          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:
          Index of the best cold-start instance from `X` chosen to be labelled; record of the best cold-start instance
          from `X` chosen to be labelled.
      """
      # Compute all pairwise distances in our unlabeled data and obtain the row-wise average for each of our records in X.
      n_jobs = n_jobs if n_jobs else 1
      average_distances = np.mean(
          pairwise_distances(X, metric=metric, n_jobs=n_jobs), axis=0
      )
  
      # Isolate and return our best instance for labeling as the record with the least average distance.
      best_coldstart_instance_index = np.argmin(average_distances)
      return best_coldstart_instance_index, X[
          best_coldstart_instance_index
      ].reshape(1, -1)
  
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 1 for calling a global function with example usage: select_cold_start_instance(X, metric, n_jobs) and returns: best_coldstart_instance_index,  X