ETIA.AFS.oos

class OOS[source]

Bases: object

Out-of-sample protocols for data splitting.

data_split(oos_protocol, X, y=None, target_type='continuous')[source]

Splits the data according to the specified out-of-sample protocol.

data_split(oos_protocol: Dict[str, Any], X: Any, y: Any | None = None, target_type: str = 'continuous') Tuple[List[ndarray], List[ndarray]][source]

Splits the data according to the specified out-of-sample protocol.

Parameters:
  • oos_protocol (dict) – A dictionary that specifies the out-of-sample protocol. The ‘name’ key should specify the type of protocol (e.g., ‘KFoldCV’, ‘Holdout’). The ‘folds’ or ‘test_size’ key specifies the number of folds or test size (for holdout).

  • X (array-like) – The feature data (input variables).

  • y (array-like, optional) – The target vector (output variables). Required for stratified splits.

  • target_type (str, optional) – Indicates whether the target is ‘continuous’ or ‘categorical’. Default is ‘continuous’.

Returns:

  • train_inds (list of np.ndarray) – A list containing the training indices for each fold or holdout split.

  • test_inds (list of np.ndarray) – A list containing the testing indices for each fold or holdout split.

Raises:

ValueError – If an unsupported protocol name is provided.