Saltar al contenido principal

ApplyCutPreprocessingUnit

Unit
DashAI.back.units.ApplyCutPreprocessingUnit

Publish the exogenous variables each cut of a backtest reads.

PreprocessingJob fits the session's preprocessing once per cut, on the steps before it: origin_{i}.pkl for each validation origin, test.pkl for the test and final.pkl for the final fit on the whole series. This applies each one, without fitting, to the rows of the series in date order (the dataset that PrepareSeriesUnit publishes), and resolves the exogenous refs against what that same fit resolved, since a step may produce other columns on other steps.

What comes out, under exogenous, is one matrix per cut, with a row per step the cut reads (cut_lengths), from the first step of the series: a forecaster fitted on the steps before origin o reads its rows [:o] and forecasts with [o:o + h], and the test and the final fit read every step. Without artifacts the raw columns are read once and every cut shares them, whole. Each cut carries its name, the artifact it came from, and declared says whether the role has columns at all: that, and not the columns one cut resolved, is what decides whether a run reads them (exogenous_for).

It always runs, as ApplySessionPreprocessingUnit does on the prediction side. Without artifacts every cut reads the raw columns, and without the role every cut reads none; the graph is one shape either way.

Every step keeps the rows (PREPROCESSING_KEEPS_ROWS), and the dataset goes under the "predict" key of transform_dataset, where no step may add or remove rows. A cut that comes back with another number of rows is a broken contract, and is reported as one.

A gap is refused after the preprocessing, on the steps the cut reads, so an imputer in the session fills what it should. The message names the column and the dates.

Parameters​

exogenous_column_refs, default=None
The exogenous variables, as column references: {'kind': 'raw', 'name': ...} for a column of the dataset, {'kind': 'group', 'step': n} for what preprocessing step n produces.

Methods​

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

Defined on ApplyCutPreprocessingUnit

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 ApplyCutPreprocessingUnit

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.