dislib.utils.base.shuffle(x, y=None, random_state=None)[source]

Randomly shuffles the rows of data.

  • x (ds-array) – Data to be shuffled.
  • y (ds-array, optional (default=None)) – Additional array to shuffle using the same permutation, usually for labels or values. It is required that y.shape[0] == x.shape[0].
  • random_state (int or RandomState, optional (default=None)) – Seed or numpy.random.RandomState instance to use in the generation of random numbers.

  • x_shuffled (ds-array) – A new ds-array containing the rows of x shuffled.
  • y_shuffled (ds-array, optional) – A new ds-array containing the rows of y shuffled using the same permutation. Only provided if y is not None.