Skip to content

Conversation

ngupta23
Copy link
Collaborator

Related Issuse or bug

  • Improved the defaults in create_model for time series.

Fixes:

  • Set default trend to "add" (most models have None). Rationale: If trend is not present, "slope" equivalent in model will be small
  • If seasonality is detected, Set default seasonal model to multiplicative. Rationale: If seasonality is additive, then the multiplicative component will be small

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, local variables)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Unit test pass

Checklist:

  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • Any dependent changes have been merged and published in downstream modules.

Copy link
Member

@Yard1 Yard1 left a comment

Choose a reason for hiding this comment

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

Just small nitpicks

# TODO: Check if there is a formal test for type of seasonality
args = {"sp": sp, "seasonal": "mul"} if seasonality_present else {}
# Add irrespective of whether seasonality is present or not
args.update({"trend": "add"})
Copy link
Member

@Yard1 Yard1 May 11, 2021

Choose a reason for hiding this comment

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

We can just do args["trend"] = "add"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is this faster than update?

Copy link
Member

Choose a reason for hiding this comment

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

Yes - though of course here it would not make any difference. Update has you create a new dictionary, which is extra overhead

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, I have updated it now.

tune_distributions = {}
if seasonality_present:
tune_grid = {
"error": ["add", "mul"],
Copy link
Member

Choose a reason for hiding this comment

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

can we have the common part outside? btw. you can merge two dicts with dict_merge = {**dict_a, **dict_b} - the second dict will overwrite the first one in case of same keys

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Yard1, @TremaMiguel also recommended to have class methods to get the tune_grid and tune_distributions. I think we can combine it with that improvement.

#1209

Copy link
Collaborator Author

@ngupta23 ngupta23 May 11, 2021

Choose a reason for hiding this comment

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

Plus I prefer it to be explicit so it is easier to read :). Let's discuss in the next meeting.

Copy link
Member

Choose a reason for hiding this comment

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

Sure thing, breaking it up is a good idea. We can leave it like that for now then

@TremaMiguel
Copy link
Contributor

Just one thing, next meeting I will like to discuss if there's a better way to test the tuning methods, currently the CI takes more than an hour and most of the time testing the time_series module. Here is an image of test_tune_model_random durations.

test_random

@ngupta23 ngupta23 merged commit e1b1e43 into time_series May 12, 2021
@ngupta23 ngupta23 deleted the improve_create_model branch May 13, 2021 01:01
@ngupta23 ngupta23 added time_series Topics related to the time series and removed time_series_dev labels Sep 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
time_series Topics related to the time series
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants