AutoMFLES
auto_mfles.AutoMFLES ยท inherits BaseForecaster
Automated MFLES wrapper with parallelized grid-search hyperparameter optimization.
Inherits from BaseForecaster, providing the standard fit() / predict() / forecast() interface. Internally wraps an MFLES base-estimator, automatically selecting optimal hyperparameters via time-series cross-validation.
Attributes:
alias: str (Custom system tracking ID.)
model_: Optional[Dict[str, Any]] (The fitted MFLES model and its state.)
best_params_: Optional[Dict[str, Any]] (The optimal hyperparameters found during cross-validation.)
sigma_: float (The residual standard error calculated during model fit.)
scaling_stats_: Optional[Tuple[jnp.ndarray, jnp.ndarray]] (Mean and standard deviation used for standardizing X.)
prediction_intervals: Optional[Any] (Settings dictating conformal bound output.)
__init__(self, test_size, season_length=None, n_windows=2, config=None, step_size=None, metric='smape', verbose=False, prediction_intervals=None, alias='AutoMFLES', n_jobs=4)
Initializes the AutoMFLES wrapper class.
| Parameter | Type | Default | Description |
|---|---|---|---|
test_size |
int |
- | Primary step horizon to evaluate internal cross validation. |
season_length |
Optional[Union[int, List[int]]] |
None |
Structural repetition frequency. |
n_windows |
int |
2 |
Allowed number of cross validation iterations. |
config |
Optional[List[Dict[str, Any]]] |
None |
Hardcoded overrides. |
step_size |
Optional[int] |
None |
Steps separating CV windows. Defaults to test_size. |
metric |
str |
"smape" |
Assessed target loss metric. |
verbose |
bool |
False |
Reporting status flag. |
prediction_intervals |
Optional[Any] |
None |
Settings dictating conformal bound output. |
alias |
str |
"AutoMFLES" |
Custom system tracking ID. |
n_jobs |
int |
4 |
Authorized CPU Thread limits. |
Raises:
ValueError: If test_size or n_windows are <= 0.
fit(self, y, X=None) -> Self
Fits the AutoMFLES engine to the given time series and regressors.
Accepts training time series data, conducts parallelized grid optimization, applies required structural scaling, and fits the base system.
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
y |
Union[np.ndarray, jnp.ndarray] |
- | Vector array of historical values. |
X |
Optional[jnp.ndarray] |
None |
Structural feature regressor inputs. |
Returns: Self (A reference mapping back to itself to permit operation chaining.)
predict(self, h, X=None, level=None) -> dict
Calculates out-of-sample forward observations utilizing parameterized state mapping.
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
h |
int |
- | Out-of-sample target evaluation step count. |
X |
Optional[jnp.ndarray] |
None |
Expected out-of-sample features array. |
level |
Optional[List[int]] |
None |
Percentage integer bounds (e.g. 90, 95). |
Returns: dict (Dictionary keys mapping "mean", and conditionally bound arrays.)
Keys: {"mean": jnp.ndarray, "lo-{level}": jnp.ndarray, "hi-{level}": jnp.ndarray} (if level is provided).
Raises:
RuntimeError: Tripped if action executed without preceding fit procedure.
ValueError: Tripped if inference attempts feature mapping absent historical features.
forecast(self, y, h, X=None, X_future=None, level=None, fitted=False) -> dict
Stateless fit+predict in one call.
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
y |
jnp.ndarray |
- | Input time series. |
h |
int |
- | Forecast horizon. |
X |
jnp.ndarray or None |
None |
In-sample exogenous variables. |
X_future |
jnp.ndarray or None |
None |
Future exogenous variables. |
level |
list[int \| float] or None |
None |
Confidence levels for prediction intervals. |
fitted |
bool |
False |
Whether to return in-sample fitted values. |
Returns: dict (Keys: 'mean', and optionally 'lo-{lv}', 'hi-{lv}', 'fitted'.)