TemporalHoldoutSplitter
Hold out the end of a series: one validation window, then the test.
The model is fitted on everything before the validation window, scored on
its horizon steps, then refitted on everything before the test and
scored on the last horizon steps. Validation and test measure the same
horizon, so the two columns of the results can be compared::
n = 48, horizon = 6
validation fit [0, 36) forecast [36, 42) test fit [0, 42) forecast [42, 48)
It is a backtest with one origin (OriginSplitter), and runs the same
units as the rolling origin. Rows are never sampled, so every step a model
is scored on comes after every step it was fitted on. The windowed route
through TimeSeriesWindowConverter and RegressionTask does not reach
this splitter; use HoldoutSplitter with shuffling turned off there.
Parameters
- horizon : integer, default=
6 - How many steps ahead the model is scored, from every origin and on the test. A step is one period of the series: a month on a monthly series.
Methods
cuts(self, n_steps: 'int') -> 'Dict[str, Any]'
OriginSplitterWhere a series of n_steps steps is cut.
Parameters
- n_steps : int
- How many steps the series has.
Returns
- dict
{"horizon", "validation_origins", "test_origin", "n_steps"}. Originofits on steps[0, o)and forecasts[o, o + h).
explainable_partitions(cls, split_indexes: 'Dict[str, Any]') -> 'Dict'
OriginSplitterNo partition of rows to explain: a backtest's cuts are steps.
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, andgeometry, the shape of the carve.
get_schema(cls) -> dict
ConfigObjectGenerates the component related Json Schema.
Returns
- dict
- Dictionary representing the Json Schema of the component.
needed_steps(self) -> 'int'
OriginSplitterThe fewest steps a series needs for these cuts.
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.
preview(cls, params, dataset, split_type=None, indexes=None)
OriginSplitterOne bar per origin and the test (see BaseSplitter.preview).
split(self, x: "'DashAIDataset'", y: "'DashAIDataset'")
OriginSplitterNot how a backtest is cut: see cuts.
split_indexes(self, x: "'DashAIDataset'", y: "'DashAIDataset'") -> 'List'
OriginSplitterNot how a backtest is cut: see cuts.
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.
validate_size(self, n_rows: 'int') -> 'None'
OriginSplitterRefuse a dataset too short for these cuts (see cuts).