Skip to content

fix: preserve fit_kwargs when copying model for cross-validation - #2764

Open
Roxen-AS wants to merge 1 commit into
meta:mainfrom
Roxen-AS:fix/prophet-copy-fit-kwargs
Open

Roxen-AS wants to merge 1 commit into
meta:mainfrom
Roxen-AS:fix/prophet-copy-fit-kwargs

Conversation

@Roxen-AS

Copy link
Copy Markdown

Summary

When copying a fitted model with \prophet.diagnostics.prophet_copy(), the model's custom fitting kwargs (\m.fit_kwargs, such as optimization options or sampler parameters) were omitted from the copy constructor and remained an empty dictionary on the cloned instance, unlike other model attributes (\extra_regressors, \seasonalities, \country_holidays, \scaling).

Changes

  • In \python/prophet/diagnostics.py: Copy \m.fit_kwargs\ onto \m2.fit_kwargs\ using \deepcopy.
  • In \python/prophet/tests/test_diagnostics.py: Added \ est_prophet_copy_fit_kwargs\ verifying that custom \ it_kwargs\ are preserved and that mutating the copied dictionary does not alter the original.

Validation

  • Syntax and compilation validated with \python -m compileall -q python/prophet/diagnostics.py python/prophet/tests/test_diagnostics.py.
  • Clean diff verified with \git diff --check.

Signed-off-by: Roxen-AS <akash.arjun12@gmail.com>
@meta-cla meta-cla Bot added the CLA Signed label Oct 22, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant