code: def sample_according_to_exp_probs(
      fitness_vals,
      num_samples,
      replace=False,
      scaling_param=None,
      scaling_const=None,
      sample_uniformly_if_fail=False,
  ):
      """Samples after exponentiating the fitness values."""
      exp_probs = get_exp_probs_from_fitness(
          fitness_vals, scaling_param, scaling_const
      )
      if (
          not np.isfinite(exp_probs.sum())
      ) and sample_uniformly_if_fail:
          exp_probs = np.ones((len(fitness_vals),)) / float(
              len(fitness_vals)
          )
      return np.random.choice(
          len(fitness_vals), num_samples, p=exp_probs, replace=replace
      )
  
imports: from __future__ import print_function
  from __future__ import division
  import numpy
  from scipy.sparse import dok_matrix
  from scipy.linalg import solve_triangular
label_desc: Use image node_id 32 for calling a global function with example usage: sample_according_to_exp_probs(fitness_vals, num_samples, replace, scaling_param, scaling_const, sample_uniformly_if_fail) and returns: np