Saltar al contenido principal

TimeResamplerConverter

Converter
DashAI.back.converters.simple_converters.TimeResamplerConverter

Put a dated table on a regular calendar grid, one row per period.

Almost every forecasting model assumes the series it is given is a value per period with no period missing and none repeated. Real data rarely arrives that way: a shop closes on Sunday, a sensor drops out for two days, two readings land on the same afternoon. ARIMA and exponential smoothing read such a table by position, so a missing week silently shortens the calendar and every seasonal claim after it is wrong.

This converter rebuilds the table on the grid the user names. Rows falling in the same period are reduced by the chosen aggregation, periods the data never covered appear as their own rows, and the fill setting decides what those rows hold. Leaving them empty is honest and refused by most models; carrying the previous value forward suits a stock level; interpolating suits a smooth physical measurement; zero suits a count of events that simply did not happen.

The date column keeps its name and its format, so the result is still a dated table that ForecastingTask and the exploration side can read. Columns that are neither the date nor numeric are dropped, since there is no meaningful way to average a piece of text over a week.

Parameters

frequency : string, default=day
The calendar grid to put the rows on: one row per day, week, month, quarter or year.
aggregation : string, default=mean
How several readings falling in the same period are reduced to the single value of that period.
fill : string, default=none
What to write into a period the data never covered: nothing, the previous value, the next value, a straight line between the two, or zero.

Methods

fit(self, x: 'DashAIDataset', y: Optional[ForwardRef('DashAIDataset')] = None) -> 'TimeResamplerConverter'

Defined on TimeResamplerConverter

Identify the date column and the numeric columns to aggregate.

Parameters

x : DashAIDataset
The scoped columns. Exactly one must be a Date.
y : DashAIDataset, optional
Ignored. Defaults to None.

Returns

TimeResamplerConverter
The fitted converter instance (self).

get_output_type(self, column_name: str = None) -> DashAI.back.types.dashai_data_type.DashAIDataType

Defined on TimeResamplerConverter

Return the type of one column of the resampled table.

Parameters

column_name : str, optional
Name of the output column. Defaults to None.

Returns

DashAIDataType
Date for the date column, Integer for an integer column that stayed exact through the aggregation and the fill, and Float for every other numeric column.

transform(self, x: 'DashAIDataset', y: Optional[ForwardRef('DashAIDataset')] = None) -> 'DashAIDataset'

Defined on TimeResamplerConverter

Rebuild the table with one row per period of the chosen grid.

Parameters

x : DashAIDataset
The dataset to transform.
y : DashAIDataset, optional
Ignored. Defaults to None.

Returns

DashAIDataset
The date column followed by the aggregated numeric columns, one row per period from the first date to the last, in chronological order.

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_metadata(cls) -> 'Dict[str, Any]'

Defined on BaseConverter

Get metadata for the converter, used by the DashAI frontend.

Parameters

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

Returns

Dict[str, Any]
Dictionary containing display name, short description, image preview path, category, icon, color, and whether the converter is supervised.

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.