code: def find_most_distant(self, input_sample, num_samples,
                            num_params, k_choices, num_groups=None):
          
          # Now evaluate the (N choose k_choices) possible combinations
          if nchoosek(num_samples, k_choices) >= sys.maxsize:
              raise ValueError("Number of combinations is too large")
          number_of_combinations = int(nchoosek(num_samples, k_choices))
  
          # First compute the distance matrix for each possible pairing
          # of trajectories and store in a shared-memory array
          distance_matrix = self.compute_distance_matrix(input_sample,
                                                         num_samples,
                                                         num_params,
                                                         num_groups)
  
          # Initialise the output array
          chunk = int(1e6)
          if chunk > number_of_combinations:
              chunk = number_of_combinations
  
          counter = 0
          # Generate a list of all the possible combinations
          combo_gen = combinations(list(range(num_samples)), k_choices)
          scores = np.zeros(number_of_combinations, dtype=np.float32)
          # Generate the pairwise indices once
          pairwise = np.array(
              [y for y in combinations(list(range(k_choices)), 2)])
  
          for combos in self.grouper(chunk, combo_gen):
              scores[(counter * chunk):((counter + 1) * chunk)] \
                  = self.mappable(combos, pairwise, distance_matrix)
              counter += 1
          return scores
docs: Finds the 'k_choices' most distant choices from the
          'num_samples' trajectories contained in 'input_sample'
  
          Arguments
          ---------
          input_sample : numpy.ndarray
          num_samples : int
              The number of samples to generate
          num_params : int
              The number of parameters
          k_choices : int
              The number of optimal trajectories
          num_groups : int, default=None
              The number of groups
  
          Returns
          -------
          numpy.ndarray