-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-Architecture of Layered Models & Ensembles (#47)
* Fix some AutoSarima bugs. * Harden models to granularities like MS * Correct import path. * Fix save/load behavior for layered models. * Implement generic LayeredModel class. * More helpful model config __init__ docstrings. Create a new metaclass which allows model configs to 1. Inherit params from superclass __init__, and have those params included in the signature for the subclass __init__. 2. Inherit param docstrings from superclass __init__, which means that users don't have to rewrite lots of docstrings for superclass params. * Various minor fixes. Also suppresses output from Prophet while the model is training. * Update gson from 2.8.6 to 2.8.9. Addresses security risk. * Order docstring params according to fn signature. * Fix failing tests. * Allow None models in LayeredModel. * Make Merlion default models subclass LayeredModel. * Allow bubbling of callable attributes in Layers. * Simplify AutoSARIMA implementation. * Minor fixes to default model. * Move LayeredModel to a new file. * Add dynamic inheritance to LayeredModel's. * Allow AutoSarima to use a SarimaDetector. * Add more docstrings & reduce code duplication. * Add auto-seasonality to AutoSarima. * Update AutoSARIMA example. * Update tests to avoid segfault. * Actually use approx_iter in AutoSARIMA * Implement __reduce__ for Config & LayeredModel. This ensures that everything is usable by multiprocessing code. The use of _original_cls for LayeredModel.__reduce__ ensures that the right class object is used when attempting to initialize the object, not a dynamically defined subclass. * change p value to 0.1 * change default regression method to c in KPSS test * Better defined periodicity strategies. * Add distinct AutoProphet model. * Add AutoETS model. * Various updates to make serialization work. - Override setstate/getstate for ensembles - Use a more refined method to check for unused kwargs in config init * Remove depth field & fix _save_state() bug. * Add comment on _original_cls * Add example for ModelConfigMeta. * Various AutoProphet bug fixes. * Fix from_dict() implementations * Simplify LayeredModel._save_state() * Move ensemble.models from model to config. This mirrors the changes to LayeredModel, and it greatly simplifies a number of implementation details. * Fix Sphinx errors & handle docstring suffixes. * Add p-value to SeasonalityConfig. * Move AutoETS & AutoProphet to models.automl * Update benchmark_forecast.json * Implement bubbling for LayeredModel.__setattr__ * Add robustness to None models in serialization. Co-authored-by: Chenghao Liu <[email protected]>
- Loading branch information
1 parent
0a7c0b4
commit 273dc04
Showing
46 changed files
with
1,424 additions
and
1,130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
222 changes: 130 additions & 92 deletions
222
examples/advanced/1_AutoSARIMA_forecasting_tutorial.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# | ||
# Copyright (c) 2021 salesforce.com, inc. | ||
# All rights reserved. | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
# | ||
""" | ||
Automatic seasonality detection for ETS. | ||
""" | ||
|
||
from typing import Union | ||
|
||
from merlion.models.forecast.ets import ETS | ||
from merlion.models.automl.seasonality import SeasonalityConfig, SeasonalityLayer | ||
|
||
|
||
class AutoETSConfig(SeasonalityConfig): | ||
""" | ||
Config class for ETS with automatic seasonality detection. | ||
""" | ||
|
||
def __init__(self, model: Union[ETS, dict] = None, **kwargs): | ||
model = dict(name="ETS") if model is None else model | ||
super().__init__(model=model, **kwargs) | ||
|
||
|
||
class AutoETS(SeasonalityLayer): | ||
""" | ||
ETS with automatic seasonality detection. | ||
""" | ||
|
||
config_class = AutoETSConfig |
Oops, something went wrong.