TemporalHoldoutSplitter
Split a series in time order: train first, then validation, then test.
Rows are cut where they lie rather than sampled, so every row a model is scored on comes after every row it was fitted on. That is the only honest way to estimate how a model will do on data it has not seen yet, because the alternative lets it learn from the future.
Shuffling is not merely discouraged here, it is impossible: a request to shuffle is overruled. Two ways of getting it wrong are worth naming, since neither reports an error, they just return a score that is too good.
- A random split of a series lets the model interpolate between rows it has already seen instead of extrapolating past them.
- On the output of
TimeSeriesWindowConverterit is worse still, because consecutive rows sharewindow_size - 1of their values, so a random split puts near duplicates of the training rows into the test set. That route goes throughRegressionTask, which this splitter is not offered for; useHoldoutSplitterwith shuffling turned off there.
Row order is taken as time order. This splitter receives the selected input columns, which for a windowed dataset no longer include a date, so it cannot re-sort and does not try.
Parameters
- train : number, default=
0.6 - Proportion of the earliest rows used for training.
- validation : number, default=
0.2 - Proportion of the rows after training used for validation.
- test : number, default=
0.2 - Proportion of the most recent rows used for testing.
Methods
split_indexes(self, x: "'DashAIDataset'", y: "'DashAIDataset'") -> 'Tuple[List, List, List]'
TemporalHoldoutSplitterCut the rows into three consecutive blocks in time order.
Parameters
- x : DashAIDataset
- Input dataset to partition.
- y : DashAIDataset
- Target values associated with
x. Unused: nothing here depends on the target, unlike a stratified split.
Returns
- tuple[List, List, List]
- Train, test and validation indexes. Note the return order matches the holdout contract, while the partitions themselves run train, validation, test along the timeline.
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.
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.