Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions python/prophet/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ def prophet_copy(m: _ModelT, cutoff: pd.Timestamp | None = None) -> _ModelT:
m2.extra_regressors = deepcopy(m.extra_regressors)
m2.seasonalities = deepcopy(m.seasonalities)
m2.country_holidays = deepcopy(m.country_holidays)
m2.fit_kwargs = deepcopy(m.fit_kwargs)
return m2


Expand Down
9 changes: 9 additions & 0 deletions python/prophet/tests/test_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,15 @@ def test_prophet_copy_scaling(self, data, backend):
m2 = diagnostics.prophet_copy(m1)
assert m2.scaling == "minmax"

def test_prophet_copy_fit_kwargs(self, data, backend):
m1 = Prophet(stan_backend=backend)
m1.history = m1.setup_dataframe(data.copy(), initialize_scales=True)
m1.fit_kwargs = {"iter": 500, "algorithm": "Newton"}
m2 = diagnostics.prophet_copy(m1)
assert m2.fit_kwargs == {"iter": 500, "algorithm": "Newton"}
m2.fit_kwargs["iter"] = 1000
assert m1.fit_kwargs["iter"] == 500

def test_prophet_copy_custom(self, data, backend):
changepoints = pd.date_range("2012-06-15", "2012-09-15")
cutoff = pd.Timestamp("2012-07-25")
Expand Down