Skip to content

Conversation

shchur
Copy link
Collaborator

@shchur shchur commented May 20, 2025

Issue #, if available:

Description of changes:

  • Prior to v1.3.0, users could set the scaler hyperparameter to choose the scaling option in MLForecast models. In v1.3.0, we renamed this hyperparameter to target_scaler for consistency with other models. We intended to support the scaler hyperparameter as well for backwards compatibility. However, because of a bug in the logic, scaler was always shadowed by the default value of the target_scaler, so the old parameter name got effectively deprecated. This can result in unexpected performance changes to the users. This PR fixes this problem.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@shchur shchur added this to the 1.3.1 milestone May 20, 2025
@shchur shchur requested a review from canerturkmen May 20, 2025 09:13
@shchur shchur added bug Something isn't working module: timeseries related to the timeseries module labels May 20, 2025
@shchur shchur requested a review from abdulfatir May 20, 2025 09:18
@@ -191,7 +191,10 @@ def _get_mlforecast_init_args(
self._sum_of_differences = sum(differences)

# Support "scaler" for backward compatibility
scaler_type = model_params.get("target_scaler", model_params.get("scaler"))
if "scaler" in model_params:
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens if user provides both scaler and target_scaler? Should we raise or warn?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, does this imply any documentation changes?

Copy link
Collaborator Author

@shchur shchur May 20, 2025

Choose a reason for hiding this comment

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

Before this PR: scaler is always ignored, only target_scaler matters.
This PR (at the time of review): scaler takes precedence over target_scaler (probably not ideal)

I have updated the PR so that target_scaler takes precedence over scaler - that seems more reasonable to me.

We don't need to update the docs - they already only reference the new name target_scaler.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've also added a warning to avoid introducing a potentially breaking change in a hotfix release.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@abdulfatir, regarding the warnings category, DeprecationWarnings are often silenced by the default warning filters (see #3463 or PEP565), so I would prefer to keep the UserWarning here to ensure that it's displayed.

Copy link
Collaborator

@abdulfatir abdulfatir 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 to me, but at this stage maybe it's better to just make it a deprecation warning for future clarity. I'll let you decide.

Copy link

Job PR-5131-dacc27c is done.
Docs are uploaded to http://autogluon-staging.s3-website-us-west-2.amazonaws.com/PR-5131/dacc27c/index.html

@shchur shchur merged commit 59de89e into autogluon:master May 20, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working module: timeseries related to the timeseries module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants