Skip to content

Commit

Permalink
Merge branch 'master' into typing_extensions_version
Browse files Browse the repository at this point in the history
  • Loading branch information
brsnw250 authored Aug 28, 2024
2 parents 35f7822 + abaa870 commit 02bd5c9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- Add lower limit for `typing_extension` versions ([#458](https://github.com/etna-team/etna/pull/458))
- Fix `ModelDecomposeTransform` import without `prophet` module ([#459](https://github.com/etna-team/etna/pull/459))
-
-
-
Expand Down
15 changes: 13 additions & 2 deletions etna/transforms/decomposition/model_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,40 @@

import pandas as pd

from etna import SETTINGS
from etna.datasets import TSDataset
from etna.datasets.utils import determine_num_steps
from etna.models import BATSModel
from etna.models import DeadlineMovingAverageModel
from etna.models import HoltModel
from etna.models import HoltWintersModel
from etna.models import ProphetModel
from etna.models import SARIMAXModel
from etna.models import SeasonalMovingAverageModel
from etna.models import SimpleExpSmoothingModel
from etna.models import TBATSModel
from etna.models.base import ContextRequiredModelType
from etna.models.base import ModelType
from etna.transforms import IrreversibleTransform

_SUPPORTED_MODELS = Union[
HoltWintersModel, # full
ProphetModel, # full
HoltModel, # full
SimpleExpSmoothingModel, # full
SARIMAXModel, # full
DeadlineMovingAverageModel, # need to account context/prediction size
SeasonalMovingAverageModel, # need to account context/prediction size
BATSModel, # dynamic components, not reliable
TBATSModel, # dynamic components, not reliable
]

if SETTINGS.prophet_required:
from etna.models import ProphetModel

_SUPPORTED_MODELS = Union[ # type: ignore
_SUPPORTED_MODELS,
ProphetModel, # full
]


class ModelDecomposeTransform(IrreversibleTransform):
"""Transform that uses ETNA models to estimate series decomposition.
Expand Down
5 changes: 5 additions & 0 deletions tests/test_transforms/test_decomposition/test_model_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
from etna.models import BATSModel
from etna.models import CatBoostPerSegmentModel
from etna.models import DeadlineMovingAverageModel
from etna.models import HoltModel
from etna.models import HoltWintersModel
from etna.models import ProphetModel
from etna.models import SARIMAXModel
from etna.models import SeasonalMovingAverageModel
from etna.models import SimpleExpSmoothingModel
from etna.models import TBATSModel
from etna.pipeline import Pipeline
from etna.transforms import IForestOutlierTransform
Expand Down Expand Up @@ -253,6 +255,9 @@ def test_pipeline_models(ts_name, in_column, decompose_model, forecast_model, re
"decompose_model",
(
HoltWintersModel(),
HoltModel(),
SimpleExpSmoothingModel(),
HoltWintersModel(trend="add", seasonal="add"),
ProphetModel(),
SARIMAXModel(),
DeadlineMovingAverageModel(),
Expand Down

0 comments on commit 02bd5c9

Please sign in to comment.