Skip to main content

LeaveOneOutSplitter

Splitter
DashAI.back.splitters.LeaveOneOutSplitter

Splitter that creates one fold per sample by leaving one example out at a time.

This exhaustive strategy is useful for very small datasets where every observation should be tested in turn and the computational cost remains acceptable. It is often used as a reference method in small-sample studies and in settings where a highly thorough estimate of performance is desired.

References

Methods

split_indexes(self, x: 'DashAIDataset', y: 'DashAIDataset') -> 'List[Tuple[List, List]]'

Defined on LeaveOneOutSplitter

Generate train/test index pairs following the leave-one-out scheme.

Parameters

x : DashAIDataset
Input dataset whose length determines the number of available samples.
y : DashAIDataset
Target values associated with x. This argument is accepted for interface consistency but is not used directly by the splitter.

Returns

list[tuple]
A list of train/test index pairs, one for each sample in the dataset.

get_credential(self, name: str)

Defined on ConfigObject

Resolve a registered credential component by name.

Parameters

name : str
Credential component class name (e.g. "HuggingFaceCredential").

Returns

BaseCredential
An instance of the requested credential component.

get_metadata(cls) -> 'dict'

Defined on FoldSplitter

Return metadata describing the splitter's compatibility.

get_schema(cls) -> dict

Defined on ConfigObject

Generates the component related Json Schema.

Returns

dict
Dictionary representing the Json Schema of the component.

prepare_y(self, y)

Defined on BaseSplitter

Encode the target variable for stratified splitting.

Parameters

y : object
Target values to encode. This may be a list, a pandas-like object, or a DashAI dataset that exposes a single target column.

Returns

object
Encoded labels suitable for stratified splitting.

split(self, x: 'DashAIDataset', y: 'DashAIDataset') -> 'Tuple[List[DatasetDict], List[DatasetDict], Dict[str, Any]]'

Defined on FoldSplitter

Create folds and return both the partitioned datasets and the indices.

Parameters

x : DashAIDataset
Input dataset to split.
y : DashAIDataset
Target values associated with x.

Returns

tuple[list, list, dict]
A tuple containing the split datasets for every fold and a mapping from fold names to their corresponding train/test indices.

validate_and_transform(self, raw_data: dict) -> dict

Defined on ConfigObject

It takes the data given by the user to initialize the model and returns it with all the objects that the model needs to work.

Parameters

raw_data : dict
A dictionary with the data provided by the user to initialize the model.

Returns

dict
A validated dictionary with the necessary objects.

Compatible with