mixup2

mixup2(arr: ndarray, labels: ndarray, obs_axis: int, alpha: float = 1.0, seed: int = None, _isnan=None) None[source][source]

Mixup the data using the labels

Parameters:
  • arr (array) – The data to mixup.

  • labels (array) – The labels to use for mixing.

  • obs_axis (int) – The axis along which to apply func.

  • alpha (float) – The alpha value for the beta distribution.

  • seed (int) – The seed for the random number generator.

Return type:

None

Examples

>>> np.random.seed(0)
>>> arr = np.array([[1, 2], [4, 5], [7, 8],
... [float("nan"), float("nan")]])
>>> labels = np.array([0, 0, 1, 1])
>>> mixup2(arr, labels, 0)
>>> arr
array([[1.        , 2.        ],
       [4.        , 5.        ],
       [7.        , 8.        ],
       [6.03943491, 7.03943491]])