Skip to main content

ForecastingTask

Task
DashAI.back.tasks.ForecastingTask

Task for predicting the future values of a single time series.

The input is one Date column and the output is one numeric column: the series to forecast. Nothing else is offered to the model, so the only information it has is the history of the series itself.

That restriction is the point. Models that take a date and nothing more, such as ARIMA or exponential smoothing, are a different family from models that also take explanatory variables.

Two routes lead to a forecast in DashAI, and this is only one of them. The other is TimeSeriesWindowConverter, which reshapes the same data into lag columns and hands it to RegressionTask, making every existing regressor usable. This task exists for the models that read a date column directly and cannot be expressed that way.

Methods

num_labels(self, dataset: 'DashAIDataset', output_column: str) -> int | None

Defined on ForecastingTask

Report that this task has no labels.

Parameters

dataset : DashAIDataset
Dataset used for training.
output_column : str
Output column.

Returns

int | None
Always None: the output is continuous, so there is no class count for a model to size itself against.

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

Defined on ForecastingTask

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.

process_predictions(self, dataset: 'DashAIDataset', predictions: 'ndarray', output_column: str)

Defined on ForecastingTask

Return the forecast values unchanged.

Parameters

dataset : DashAIDataset
Dataset used for training.
predictions : np.ndarray
Predictions from the model.
output_column : str
Output column.

Returns

np.ndarray
The predictions as they were produced. A forecast is already a number on the scale of the series, so there is nothing to decode.

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 "inputs_types", "outputs_types", "inputs_cardinality", and "outputs_cardinality".

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.

validate_dataset_for_task(self, dataset: 'DashAIDataset', dataset_name: str, input_columns: List[str], output_columns: 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