Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/representation of model with DataFrame/Array parameters #1749

Merged
merged 6 commits into from
May 23, 2023

Conversation

madtoinou
Copy link
Collaborator

Fixes #1746.

Summary

Use np.any when trying to compare pd.DataFrame (holidays of Prophet for example) and np.ndarray parameters with the defaults when generating the representation string of a model in _get_model_description_string().

Other Information

Not sure that showing the whole dataframe is the best approach, we could eventually use the .head? Or have a placeholder name such as "CustomDataFrame"?

… representation for pd.DataFrame and np.ndarray to avoid ambiguity when checking equality
@codecov-commenter
Copy link

codecov-commenter commented May 15, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.13 ⚠️

Comparison is base (1efb1f8) 94.19% compared to head (3f33ef1) 94.06%.

❗ 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.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1749      +/-   ##
==========================================
- Coverage   94.19%   94.06%   -0.13%     
==========================================
  Files         125      125              
  Lines       11505    11491      -14     
==========================================
- Hits        10837    10809      -28     
- Misses        668      682      +14     
Impacted Files Coverage Δ
darts/models/forecasting/forecasting_model.py 95.18% <ø> (ø)

... and 11 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Collaborator

@dennisbader dennisbader left a comment

Choose a reason for hiding this comment

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

Looks good, just had a minor suggestion :) 🚀

Comment on lines 1896 to 1901
if include_default_params
or (
isinstance(v, (pd.DataFrame, np.ndarray))
and np.any(v != default_model_params.get(k, None))
)
or v != default_model_params.get(k, None)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can use np in general

Suggested change
if include_default_params
or (
isinstance(v, (pd.DataFrame, np.ndarray))
and np.any(v != default_model_params.get(k, None))
)
or v != default_model_params.get(k, None)
if include_default_params
or np.any(v != default_model_params.get(k, None))

Copy link
Collaborator

@dennisbader dennisbader left a comment

Choose a reason for hiding this comment

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

LGTM, thanks 🚀

@dennisbader dennisbader merged commit b9a6452 into master May 23, 2023
@dennisbader dennisbader deleted the fix/dataframe_model_repr branch May 23, 2023 08:08
alexcolpitts96 pushed a commit to alexcolpitts96/darts that referenced this pull request May 31, 2023
…1749)

* fix: added a test case when comparing the parameters for model string representation for pd.DataFrame and np.ndarray to avoid ambiguity when checking equality

* fix: using the proper operator to detect inequality

* fix: applying reviwer suggestion to simplify test

---------

Co-authored-by: Dennis Bader <dennis.bader@gmx.ch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[BUG] Prophet not being able to use the holidays argument
3 participants