Skip to main content

SingleSeriesForecastingTask

Task
DashAI.back.tasks.SingleSeriesForecastingTask

Forecast the future values of a single time series.

The session names the time index, a Date, and the series, a number. Both are protected from the session's preprocessing. A third role takes the exogenous variables: any number of columns known ahead of time, such as the calendar, holidays or planned promotions. The session's preprocessing may transform them, and the model reads them as numbers. Every step of that preprocessing has to keep the rows, because the cuts of a backtest are counted in steps (PREPROCESSING_KEEPS_ROWS).

The name says the axis on which the kinds of forecasting differ: one series here, several in a panel task that would sit beside this one under ForecastingTask.

Methods​

io_columns(self, roles: Mapping[str, Sequence]) -> DashAI.back.tasks.column_roles.IOColumns

Defined on SingleSeriesForecastingTask

The time index first, then the exogenous variables, as the inputs.

io_roles(cls) -> Dict[str, List[str]]

Defined on SingleSeriesForecastingTask

The time index and the exogenous variables feed a model's inputs.

prepare_for_task(self, dataset: Union[ForwardRef('DatasetDict'), ForwardRef('DashAIDataset')], input_columns: List[str], output_columns: List[str]) -> 'DashAIDataset'

Defined on SingleSeriesForecastingTask

Convert the dataset to a DashAIDataset and validate its types.

Parameters

dataset : DatasetDict or DashAIDataset
Dataset to prepare.
input_columns : list of str
The single date column.
output_columns : list of str
The single numeric column holding the series.

Returns

DashAIDataset
Dataset with validated types, in date order, on a regular grid.

prepare_series(self, dataset: Union[ForwardRef('DatasetDict'), ForwardRef('DashAIDataset')], input_columns: List[str], output_columns: List[str]) -> DashAI.back.tasks.single_series_forecasting_task.PreparedSeries

Defined on SingleSeriesForecastingTask

Validate the columns, put the rows in date order and check the grid.

Parameters

dataset : DatasetDict or DashAIDataset
Dataset to prepare.
input_columns : list of str
The single date column.
output_columns : list of str
The single numeric column holding the series.

Returns

PreparedSeries
The ordered dataset, the series' values in time order, and the grid they sit on.

roles_from_io(self, input_columns: Sequence, output_columns: Sequence) -> Dict[str, list]

Defined on SingleSeriesForecastingTask

The roles that a model's input and output came from.

split_inputs(inputs: Sequence) -> Tuple[list, list]

Defined on SingleSeriesForecastingTask

The time index and the exogenous variables, out of a model's inputs.

check_role_names(self, roles: Mapping[str, Any]) -> None

Defined on BaseTask

Refuse columns for a role this task does not declare.

column_roles(cls) -> Tuple[DashAI.back.tasks.column_roles.ColumnRole, ...]

Defined on BaseTask

The roles this task's columns can play, in the order it declares.

Returns

tuple of ColumnRole
The declared roles.

get_metadata(cls) -> Dict[str, Any]

Defined on BaseTask

Return serialisable metadata for the current task.

Parameters

cls : type
The task class (injected automatically by Python for classmethods).

Returns

Dict[str, Any]
Dictionary with keys "column_roles", "io_roles", "prediction_mode", "requires_target", "takes_preprocessing", "requires_input_columns" and "icon".

inputs_cardinality(cls) -> Any

Defined on BaseTask

How many columns a model of this task reads, as the roles say.

Returns

int or str
The exact total when every input role is exact, otherwise "n".

process_manual_input(self, manual_input: List[dict], dataset_path: str) -> 'DashAIDataset'

Defined on BaseTask

Process manual input data into a DashAIDataset with type validation.

Parameters

manual_input : List[dict]
List of dictionaries representing manual input data.
dataset_path : str
Path to the training dataset (used to get column specs for validation)

Returns

DashAIDataset
Processed DashAIDataset from manual input.

takes_preprocessing(cls) -> bool

Defined on BaseTask

Whether a session of this task may preprocess its columns.

Returns

bool
True when at least one role is transformable.

validate_dataset_for_task(self, dataset: 'DashAIDataset', dataset_name: str, input_columns: List[str], output_columns: Optional[List[str]]) -> None

Defined on BaseTask

Validate a dataset for the current task.

Parameters

dataset : DashAIDataset
Dataset to be validated
dataset_name : str
Dataset name
input_columns : list of str
Names of the columns selected as inputs.
output_columns : list of str
Names of the columns selected as outputs.

validate_estimated_role(self, role_name: str, columns: Sequence[Tuple[Optional[str], Optional[int]]]) -> None

Defined on BaseTask

Check one role against the columns a preprocessing chain will give it.

Parameters

role_name : str
A declared role.
columns : sequence of (type name, count)
One entry per estimated output: the name of its type, or None when unknown, and how many columns it holds, or None when unknown. An unknown count is taken as at least one, and only the role's minimum is checked then.

validate_inputs_given(self, roles: Mapping[str, Sequence]) -> None

Defined on BaseTask

Check that the input roles, together, get at least one column.

Parameters

roles : mapping
Role name to the role's columns, as names or as column refs. A role the mapping leaves out counts as given no columns.

validate_role(self, role_name: str, columns: Sequence[str], types: Mapping[str, Any]) -> None

Defined on BaseTask

Check one role's columns against its types and cardinality.

Parameters

role_name : str
A declared role.
columns : sequence of str
The names of the role's columns.
types : mapping
The dataset's column types, keyed by column name.

validate_roles(self, roles: Mapping[str, Sequence[str]], types: Mapping[str, Any]) -> None

Defined on BaseTask

Check a session's columns, role by role, against the declaration.

Parameters

roles : mapping
Role name to the names of the role's columns.
types : mapping
The dataset's column types, keyed by column name.

Compatible with​