SeasonalDecompositionExplorer
Split a series into the trend, the season and what is left over.
A line plot shows a series moving, not why. Decomposition answers that by
pulling the three apart: the slow level the series drifts along, the
shape it repeats every season, and the residual neither explains. Each
one leads somewhere different. A trend means differencing or a model with
a trend term. A season standing clearly above the residual is the m
that SeasonalNaive and the seasonal part of SARIMAX need. A residual
that still holds structure means the split is wrong, usually the wrong
season length.
The season length is read from the spacing of the dates when it is left at 0, so monthly dates give 12 and daily dates 7. Naming it directly is the way to check a season the calendar does not imply, such as a fortnight of 14 days on daily data.
STL and the moving average disagree in a way worth knowing. STL lets the seasonal shape drift from year to year and is not thrown by an outlier, which suits real series. The moving average fits one fixed seasonal shape and repeats it unchanged, which is stricter and shows more plainly when a season is not stable. Only the moving average reads the multiplicative setting, for series whose swings grow with their level.
Parameters
- method : string, default=
stl - How the series is split. STL fits a season that is allowed to change shape over the years and shrugs off outliers. The moving average is the classic split, faster and stricter: one fixed seasonal shape repeated unchanged.
- period : integer, default=
0 - How many periods one season lasts: 12 for months in a year, 7 for days in a week. Leave it at 0 to read it from the spacing of the dates.
- model : string, default=
additive - Whether the season adds a fixed amount to the trend or multiplies it. Use multiplicative when the swings grow with the level of the series. Only the moving average reads this.
Methods
get_results(self, exploration_path: str, options: Dict[str, Any]) -> List[DashAI.back.core.artifacts.Artifact]
SeasonalDecompositionExplorerLoad 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)
SeasonalDecompositionExplorerDecompose the selected series and draw its parts.
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
- Four panels sharing a time axis: the series as given, its trend, its season and the residual.
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
SeasonalDecompositionExplorerSave 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
SeasonalDecompositionExplorerCheck 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)
ConfigObjectResolve 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]
BaseExplorerGet 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
ConfigObjectGenerates 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'
BaseExplorerPrepare 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
ConfigObjectIt 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
BaseExplorerValidate 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.