Skip to main content

AutocorrelationExplorer

Explorer
DashAI.back.exploration.explorers.AutocorrelationExplorer

Show how a series relates to its own past, one lag at a time.

Forecasting a series from its own history only works when the history says something about the present, and a correlogram is where that shows up. A bar reaching out of the confidence band at lag 12 on monthly data is a year long season; a slow decay across every lag is a trend; bars that stay inside the band throughout mean the series is noise and no amount of model tuning will forecast it.

The two functions answer different questions. The autocorrelation counts every route from one period to another, so a strong lag 1 echoes into lag 2 and lag 3 whether or not those lags carry anything of their own. The partial autocorrelation removes the shorter routes and shows what each lag adds by itself, which is why ARIMA orders are read off it: the last lag standing out of the band on the PACF is a candidate for p, and on the ACF for q.

The same reading sets window_size for TimeSeriesWindowConverter, which is otherwise a guess: a window shorter than the last useful lag throws away the information the correlogram just found.

Parameters

n_lags : integer, default=20
How many lags to draw. A lag is one step back along the series, so 20 asks how today relates to each of the last 20 periods. More lags than the series can answer are trimmed.
function : string, default=both
Which correlogram to draw. The ACF counts every route from one period to another, so a strong lag 1 echoes into lag 2. The PACF removes the shorter routes and shows what each lag adds on its own.
confidence : number, default=0.95
The confidence level of the band drawn around the bars. A bar inside the band is not distinguishable from noise.

Methods

get_results(self, exploration_path: str, options: Dict[str, Any]) -> List[DashAI.back.core.artifacts.Artifact]

Defined on AutocorrelationExplorer

Load and return the saved figure for the frontend.

Parameters

exploration_path : str
Path to the JSON file saved by save_notebook.
options : Dict[str, Any]
Rendering options from the frontend (unused).

Returns

List[Artifact]
A single element list with the plotly artifact of the saved figure.

launch_exploration(self, dataset: 'DashAIDataset', explorer_info: DashAI.back.dependencies.database.models.Explorer)

Defined on AutocorrelationExplorer

Draw the correlogram of the selected series.

Parameters

dataset : DashAIDataset
The prepared dataset holding the selected columns.
explorer_info : Explorer
Explorer record with the column names and optional display name.

Returns

plotly.graph_objects.Figure
One correlogram per requested function, drawn as bars per lag inside a confidence band.

save_notebook(self, notebook_info: DashAI.back.dependencies.database.models.Notebook, explorer_info: DashAI.back.dependencies.database.models.Explorer, save_path: 'Path', result: Any) -> str

Defined on AutocorrelationExplorer

Save the figure to disk (JSON content, .pickle extension).

Parameters

notebook_info : Notebook
The notebook database record (unused).
explorer_info : Explorer
The explorer record used for filename generation.
save_path : Path
Directory where the file will be saved.
result : Any
The Plotly figure returned by launch_exploration.

Returns

str
The path of the saved file as a POSIX string.

validate_columns(cls, explorer_info: DashAI.back.dependencies.database.models.Explorer, column_spec: Dict[str, Dict[str, str]]) -> bool

Defined on AutocorrelationExplorer

Check the selection is one date column plus one series.

Parameters

explorer_info : Explorer
The database record for the explorer instance, including the selected columns.
column_spec : Dict[str, Dict[str, str]]
A mapping from column name to a dict with at least "type" and "dtype".

Returns

bool
True if the selection holds exactly one Date column and exactly one numeric column, and the inherited checks also pass.

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 BaseExplorer

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

Returns

Dict[str, Any]
Dictionary containing display name, description, image preview path, category, icon, color, allowed semantic types, allowed dtypes, and input cardinality constraints.

get_schema(cls) -> dict

Defined on ConfigObject

Generates the component related Json Schema.

Returns

dict
Dictionary representing the Json Schema of the component.

prepare_dataset(self, loaded_dataset: 'DashAIDataset', columns: List[Dict[str, Any]]) -> 'DashAIDataset'

Defined on BaseExplorer

Prepare the dataset by selecting only the columns needed for this exploration.

Parameters

loaded_dataset : DashAIDataset
The full dataset loaded from storage.
columns : List[Dict[str, Any]]
List of column descriptor dicts, each containing at least "columnName". Optional keys: "id", "valueType", "dataType".

Returns

DashAIDataset
Dataset restricted to the requested columns.

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.

validate_parameters(cls, params: Dict[str, Any]) -> bool

Defined on BaseExplorer

Validate explorer parameters against the explorer's schema.

Parameters

params : Dict[str, Any]
The configuration parameters to validate.

Returns

BaseExplorerSchema
The validated and parsed schema instance. Subclasses that override this method may return a bool to indicate pass/fail without returning the model instance.