code: def expand_dataset(
      X, y_proba, factor=10, random_state=None, extra_arrays=None
  ):
      """
      Convert a dataset with float multiclass probabilities to a dataset
      with indicator probabilities by duplicating X rows and sampling
      true labels.
      """
      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
  
imports: from __future__ import absolute_import
  from typing import List, Any
  import numpy
  from scipy.stats import entropy
  from sklearn.pipeline import Pipeline
  from sklearn.utils import check_random_state, issparse
  from sklearn.utils.metaestimators import if_delegate_has_method
  from sklearn.utils import shuffle
  from eli5.utils import vstack
  from eli5.sklearn.utils import sklearn_version
label_desc: Use image node_id 6 for calling a global function with example usage: expand_dataset(X, y_proba, factor, random_state, extra_arrays) without return types