Skip to content

Commit

Permalink
Change returned model in get_model of BATSModel, TBATSModel (#987)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Geekman authored Oct 14, 2022
1 parent c354ceb commit 926982a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
-
### Changed
-
-
- Change returned model in get_model of BATSModel, TBATSModel ([#987](https://github.com/tinkoff-ai/etna/pull/987))
-
-
-
Expand Down
15 changes: 11 additions & 4 deletions etna/models/tbats.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class _TBATSAdapter(BaseAdapter):
def __init__(self, model: Estimator):
self.model = model
self._model = model
self._fitted_model: Optional[Model] = None
self._last_train_timestamp = None
self._freq = None
Expand All @@ -27,7 +27,7 @@ def fit(self, df: pd.DataFrame, regressors: Iterable[str]):
raise ValueError("Can't determine frequency of a given dataframe")

target = df["target"]
self._fitted_model = self.model.fit(target)
self._fitted_model = self._model.fit(target)
self._last_train_timestamp = df["timestamp"].max()
self._freq = freq

Expand Down Expand Up @@ -68,8 +68,15 @@ def predict(self, df: pd.DataFrame, prediction_interval: bool, quantiles: Iterab

return y_pred

def get_model(self) -> Estimator:
return self.model
def get_model(self) -> Model:
"""Get internal :py:class:`tbats.tbats.Model` model that was fitted inside etna class.
Returns
-------
:
Internal model
"""
return self._fitted_model


class BATSModel(PerSegmentPredictionIntervalModel):
Expand Down

1 comment on commit 926982a

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.