HoldoutSplitter
Split the dataset into train, test and validation partitions at random.
The ordinary holdout split: rows are sampled into three partitions, with optional shuffling, stratification and a seed to make the sample reproducible.
Not offered for ForecastingTask. Sampling rows out of a series lets a
model train on its own future and report a score it could never reproduce
in use, and nothing about that failure raises an error. Forecasting uses
TemporalHoldoutSplitter, which cuts the rows where they lie.
Parameters
- train : number, default=
0.6 - Proportion of the dataset assigned to the training partition.
- test : number, default=
0.2 - Proportion of the dataset assigned to the test partition.
- validation : number, default=
0.2 - Proportion of the dataset assigned to the validation partition.
- stratify : boolean, default=
False - Whether to preserve the class distribution across the splits.
- shuffle : boolean, default=
True - Whether to shuffle the data before splitting it.
- random_state : integer, default=
42 - Seed used to make the split reproducible.
Methods
explainable_partitions(cls, split_indexes)
PartitionSplitterReturn the train, test and validation partitions of a holdout run.
Parameters
- split_indexes : dict
- The
Run.split_indexespayload, already parsed.
Returns
- dict
- Row indexes for the
train,testandvalpartitions.
explainable_splits(cls, split_indexes: 'Dict[str, Any]') -> 'List[Dict[str, Any]]'
BaseSplitterDescribe the partitions of a run that an explainer may target.
Parameters
- split_indexes : dict
- The
Run.split_indexespayload, already parsed.
Returns
- list[dict]
- One
{"name", "rows"}entry per non-empty partition, followed by anallentry. Empty when the run has no data to explain.
get_credential(self, name: str)
ConfigObjectResolve 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[str, Any]'
BaseSplitterReturn metadata describing how this splitter carves the dataset.
Returns
- Dict[str, Any]
- Mapping with
partitioning, which the frontend uses to decide whether the splitter belongs to the holdout or the cross-validation strategy.
get_schema(cls) -> dict
ConfigObjectGenerates the component related Json Schema.
Returns
- dict
- Dictionary representing the Json Schema of the component.
prepare_y(self, y)
BaseSplitterEncode 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[DatasetDict, DatasetDict, Dict[str, Any]]'
PartitionSplitterSplit the input data into holdout partitions and return the resulting datasets.
Parameters
- x : DashAIDataset
- Input dataset to partition.
- y : DashAIDataset
- Target values associated with
x.
Returns
- tuple
- A tuple containing the partitioned input and output datasets, along with the indices used for each split.
split_indexes(self, x: 'DashAIDataset', y: 'DashAIDataset') -> 'Tuple[List, List, List]'
PartitionSplitterGenerate lists with train, test and validation indexes.
Parameters
- x: DashAIDataset
- Input dataset to partition.
- y: DashAIDataset
- Target values associated with
x.
Returns
- tuple[List, List, List]
- Lists of indices for the training, test, and validation partitions.
validate_and_transform(self, raw_data: dict) -> dict
ConfigObjectIt 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.