sample_fold

sample_fold(train_idx: Any, test_idx: Any, x_data: Any, labels: Any, unique: Any, axis: int, oversample: bool, xp) tuple[Any, Any, Any][source][source]

Sample a fold of data for cross-validation.

Parameters:
  • train_idx (Array) – Indices of the training data.

  • test_idx (Array) – Indices of the test data.

  • x_data (Array) – The data to be sampled.

  • labels (Array) – Labels corresponding to the data.

  • unique (Array) – Unique labels to be used for oversampling.

  • axis (int) – Axis along which to stack the data.

  • oversample (bool) – Whether to oversample the training data.

  • xp (module) – The array namespace (numpy or cupy).

Returns:

Stacked data, training labels, and test labels.

Return type:

tuple[Array, Array, Array]