class_docstr: Handles softmax weights which need to be turned into probabilities and sampled
  This class is expected to evolve to be more usable and include more features (like
  conversion from probabilities to weights?)
  It will replace most of the code above if possible
  
  Parameters
  ----------
  weights: array
      the weights of size samples x options, that will be turned to probabilities
      using softmax.
  rng: RandomState
      random number generator for sampling following the probabilities
  
  Notes
  -----
  - if one or several inf values are present in a row, only those are considered
  - in case of tie, the deterministic value is the first one (lowest) of the tie
  - nans and -infs are ignored, except if all are (then uniform random choice)
docstr: Creates the probability matrix from the weights
code: def probabilities(self) -> np.ndarray:
      """Creates the probability matrix from the weights"""
      axis = 1
      maxv = np.max(self.weights, axis=1, keepdims=True)
      hasposinf = np.isposinf(maxv)
      maxv[np.isinf(maxv)] = 0  # avoid indeterminations
      exp: np.ndarray = np.exp(self.weights - maxv)
      # deal with infinite positives special case
      # by ignoring (0 proba) non-infinte on same row
      if np.any(hasposinf):
          is_inf = np.isposinf(self.weights)
          is_ignored = np.logical_and(np.logical_not(is_inf), hasposinf)
          exp[is_inf] = 1
          exp[is_ignored] = 0
      # random choice if sums to 0
      sums0 = np.sum(exp, axis=axis) == 0
      exp[sums0, :] = 1
      exp /= np.sum(exp, axis=axis, keepdims=True)  # normalize
      return exp
  
file_path: nevergrad/nevergrad/parametrization/discretization.py
imports: import warnings
  import numpy
  import scipy.stats
  import nevergrad.common.typing
label_desc: Use image node_id 2 for calling the Encoder obj's underlying member method code with example usage: obj.probabilities() and returns: exp