code: def _mean_match_multiclass_fast(
      mean_match_candidates, bachelor_preds, random_state, hashed_seeds
  ):
      """
      If mean_match_candidates is 0, choose class with highest probability.
      Otherwise, randomly choose class weighted by class probabilities.
      """
      if mean_match_candidates == 0:
          imp_values = np.argmax(bachelor_preds, axis=1)
  
      else:
          num_bachelors = bachelor_preds.shape[0]
  
          # Turn bachelor_preds into discrete cdf:
          bachelor_preds = bachelor_preds.cumsum(axis=1)
  
          # Randomly choose uniform numbers 0-1
          if hashed_seeds is None:
              # This is the fastest way to adjust for numeric
              # imprecision of float16 dtype. Actually ends up
              # barely taking any time at all.
              bp_dtype = bachelor_preds.dtype
              unif = np.minimum(
                  random_state.uniform(0, 1, size=num_bachelors).astype(
                      bp_dtype
                  ),
                  bachelor_preds[:, -1],
              )
          else:
              unif = []
              for i in range(num_bachelors):
                  np.random.seed(seed=hashed_seeds[i])
                  unif.append(np.random.uniform(0, 1, size=1)[0])
              unif = np.array(unif)
  
          # Choose classes according to their cdf.
          # Distribution will match probabilities
          imp_values = np.array(
              [
                  np.searchsorted(bachelor_preds[i, :], unif[i])
                  for i in range(num_bachelors)
              ]
          )
  
      return imp_values
  
imports: import numpy
label_desc: Use image node_id 5 for calling a global function with example usage: _mean_match_multiclass_fast(mean_match_candidates, bachelor_preds, random_state, hashed_seeds) and returns: imp_values