code: def expand_dataset(X, y_proba, factor=10, random_state=None, extra_arrays=None):
      
      rng = check_random_state(random_state)
      extra_arrays = extra_arrays or []
      n_classes = y_proba.shape[1]
      classes = np.arange(n_classes, dtype=int)
      for el in zip(X, y_proba, *extra_arrays):
          x, probs = el[0:2]
          rest = el[2:]
          for label in rng.choice(classes, size=factor, p=probs):
              yield (x, label) + rest
docs: Convert a dataset with float multiclass probabilities to a dataset
      with indicator probabilities by duplicating X rows and sampling
      true labels.