Skip to main content

BacktestForecasterUnit

Unit
DashAI.back.units.BacktestForecasterUnit

Forecast every origin of a backtest, searching first if there is a search.

One unit for the holdout and the rolling origin alike: a holdout is a backtest with one validation origin (RECONCILING_FORECASTING §2.13).

The search, when the model declares something to tune and the run names an optimizer, measures a trial by the mean of the goal metric over the validation origins, each fitted on the steps before it. The test origin is never part of it.

The forecasts come after, with the best parameters, or the ones given when there was no search: every validation origin and then the test, each one a fresh model fitted on the steps before its origin and asked for the horizon after it, with intervals when the model gives them. They are published as forecasts, in the shape the forecasts file holds, and ScoreForecastsUnit and SaveForecastsUnit read them.

The exogenous variables come from ApplyCutPreprocessingUnit, one matrix per cut: validation origin i reads its own, the test its own, and so does every trial of the search. A model reads them only when exogenous_usage says the run does (exogenous_for).

best_parameters is published whether or not there was a search, so the final fit can require it rather than check for it (ATOMIZING §5.4).

Parameters​

optimizer : object
Optimizer used to search for hyperparameters, along with its own configuration. Only used when the model declares optimizable parameters.
goal_metric : string, default=Accuracy
Metric the hyperparameter search optimizes.

Methods​

execute(self, ctx: DashAI.back.units.context.ExecutionContext) -> None

Defined on BacktestForecasterUnit

Do the unit's work, reading from and writing to the context.

Parameters

ctx : ExecutionContext
The shared execution context.

validate(self, ctx: DashAI.back.units.context.ExecutionContext) -> None

Defined on BacktestForecasterUnit

Check preconditions without executing the unit.

Parameters

ctx : ExecutionContext
The shared execution context.

get_credential(self, name: str)

Defined on ConfigObject

Resolve 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_schema(cls) -> dict

Defined on ConfigObject

Generates the component related Json Schema.

Returns

dict
Dictionary representing the Json Schema of the component.

validate_and_transform(self, raw_data: dict) -> dict

Defined on ConfigObject

It 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.