Skip to content

Unification of errors, warnings and checks in models #1312

Merged
merged 9 commits into from
Jul 17, 2023

Conversation

Mr-Geekman
Copy link
Contributor

@Mr-Geekman Mr-Geekman commented Jul 10, 2023

Before submitting (must do checklist)

  • Did you read the contribution guide?
  • Did you update the docs? We use Numpy format for all the methods and classes.
  • Did you write any new necessary tests?
  • Did you update the CHANGELOG?

Proposed Changes

Unify errors, warnings and checks in multiple models.

Closing issues

@Mr-Geekman Mr-Geekman self-assigned this Jul 10, 2023
@@ -57,7 +57,10 @@ class AutoARIMAModel(
"""
Class for holding auto arima model.

Method ``predict`` can use true target values only on train data on future data autoregression
Method ``forecast`` can be used on ouf-of-sample data that goes after training data with a gap.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not really sure about adding this clarifications into documentation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should specify all cases in one place for all models.
And to be clear we should make illustrations because current docs really hard to understand

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, let's do this in some other task. May be it better fits the documentation track.

@@ -112,10 +112,11 @@ def fit(self, ts: TSDataset) -> "DeadlineMovingAverageModel":
self._freq = freq

columns = set(ts.columns.get_level_values("feature"))
if columns != {"target"}:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

May be some common blocks should be extracted somewhere for all models.

@github-actions
Copy link

github-actions bot commented Jul 10, 2023

@github-actions github-actions bot temporarily deployed to pull request July 10, 2023 18:10 Inactive
@codecov-commenter
Copy link

codecov-commenter commented Jul 10, 2023

Codecov Report

Merging #1312 (4f7f2ad) into master (6a9b6a8) will decrease coverage by 82.25%.
The diff coverage is 0.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master   #1312       +/-   ##
==========================================
- Coverage   88.94%   6.69%   -82.25%     
==========================================
  Files         203     203               
  Lines       12466   12498       +32     
==========================================
- Hits        11088     837    -10251     
- Misses       1378   11661    +10283     
Impacted Files Coverage Δ
etna/models/deadline_ma.py 0.00% <0.00%> (-98.72%) ⬇️
etna/models/holt_winters.py 0.00% <0.00%> (-99.47%) ⬇️
etna/models/nn/utils.py 0.00% <ø> (-85.22%) ⬇️
etna/models/prophet.py 0.00% <0.00%> (-100.00%) ⬇️
etna/models/sarimax.py 0.00% <0.00%> (-97.25%) ⬇️
etna/models/seasonal_ma.py 0.00% <0.00%> (-100.00%) ⬇️
etna/models/sklearn.py 0.00% <0.00%> (-92.50%) ⬇️
etna/models/statsforecast.py 0.00% <0.00%> (-98.67%) ⬇️
etna/models/tbats.py 0.00% <0.00%> (-95.11%) ⬇️

... and 177 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@martins0n martins0n self-requested a review July 11, 2023 07:39
@@ -57,7 +57,10 @@ class AutoARIMAModel(
"""
Class for holding auto arima model.

Method ``predict`` can use true target values only on train data on future data autoregression
Method ``forecast`` can be used on ouf-of-sample data that goes after training data with a gap.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should specify all cases in one place for all models.
And to be clear we should make illustrations because current docs really hard to understand

@@ -156,7 +172,10 @@ def predict_components(self, df: pd.DataFrame) -> pd.DataFrame:
raise ValueError("Model is not fitted! Fit the model before estimating forecast components!")

if self._last_train_timestamp < df["timestamp"].max() or self._first_train_timestamp > df["timestamp"].min():
raise ValueError("To estimate out-of-sample prediction decomposition use `forecast` method.")
raise NotImplementedError(
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about module with common Exceptions and warnings?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it is a reasonable way to go.

Do we want to do this in this task? Or it is better to do this in some other task? Because it can require more planning than changing error messages like we do in this task.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can make it in another task if some research is needed

martins0n
martins0n previously approved these changes Jul 16, 2023
@github-actions github-actions bot temporarily deployed to pull request July 17, 2023 06:58 Inactive
@Mr-Geekman Mr-Geekman enabled auto-merge (squash) July 17, 2023 08:18
@github-actions github-actions bot temporarily deployed to pull request July 17, 2023 08:23 Inactive
@Mr-Geekman Mr-Geekman merged commit 7e54706 into master Jul 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants