ertk.train.ValidationSplit

class ertk.train.ValidationSplit(train_idx: List[int] | ndarray, valid_idx: List[int] | ndarray)

Bases: BaseCrossValidator

Validation method that uses a pre-defined validation set.

Parameters:
train_idx: list of int or np.ndarray

Indices of the training set.

valid_idx: list of int or np.ndarray

Indices of the validation set.

__init__(train_idx: List[int] | ndarray, valid_idx: List[int] | ndarray)

Methods

__init__(train_idx, valid_idx)

get_n_splits(X, y, groups)

Returns the number of splitting iterations in the cross-validator

split(X, y, groups)

Generate indices to split data into training and test set.

Inherited Methods

get_n_splits(X, y, groups)

Returns the number of splitting iterations in the cross-validator

split(X, y, groups)

Generate indices to split data into training and test set.

Parameters:
Xarray-like of shape (n_samples, n_features)

Training data, where n_samples is the number of samples and n_features is the number of features.

yarray-like of shape (n_samples,)

The target variable for supervised learning problems.

groupsarray-like of shape (n_samples,), default=None

Group labels for the samples used while splitting the dataset into train/test set.

Yields:
trainndarray

The training set indices for that split.

testndarray

The testing set indices for that split.