docs: def expanded_X_y_sample_weights(X, y_proba, expand_factor=10,
                                  sample_weight=None, shuffle=True,
                                  random_state=None):
      """
      scikit-learn can't optimize cross-entropy directly if target
      probability values are not indicator vectors.
      As a workaround this function expands the dataset according to
      target probabilities. ``expand_factor=None`` means no dataset
      expansion.
      """
      rng = check_random_state(random_state)
      if expand_factor:
          if sample_weight is not None:
              X, y, sample_weight = zip(*expand_dataset(X, y_proba,
                                                        factor=expand_factor,
                                                        random_state=rng,
                                                        extra_arrays=[
                                                            sample_weight
                                                        ]))
          else:
              X, y = zip(*expand_dataset(X, y_proba,
                                         factor=expand_factor,
                                         random_state=rng))
      else:
          y = y_proba.argmax(axis=1)
  
      if isinstance(X, (list, tuple)) and len(X) and issparse(X[0]):
          X = vstack(X)
  
      if shuffle:
          if sample_weight is not None:
              X, y, sample_weight = _shuffle(X, y, sample_weight,
                                             random_state=rng)
          else:
              X, y = _shuffle(X, y, random_state=rng)
      return X, y, sample_weight