You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds foundationforecast.prophet.FoundationProphet, a prophet.Prophet subclass that runs any foundation model instead of the Stan model, so existing Prophet pipelines can swap models in one line:
fromfoundationforecast.modelsimportChronosfromfoundationforecast.prophetimportFoundationProphetm=FoundationProphet(model=Chronos()) # instead of Prophet()m.fit(df) # ds, y (+ regressors)future=m.make_future_dataframe(periods=30)
forecast=m.predict(future) # ds, yhat, yhat_lower, yhat_upper
fit stores the history (zero-shot models need no training); predict calls model.forecast with level=[interval_width * 100] and maps the output to yhat, yhat_lower, yhat_upper.
Historical rows (make_future_dataframe(include_history=True)) are filled with rolling-origin backtests from model.cross_validation (insample="cv", default) and a message is logged explaining the cost and how to skip it. insample="none" leaves them NaN. insample_h / insample_n_windows tune the windows.
add_regressor columns are passed as known-future exog (X_df), so they work with models that support native exog.
Prophet's diagnostics.cross_validation / performance_metrics, plot, make_future_dataframe, deepcopy and pickle work. plot_components and posterior sampling raise NotImplementedError.
Takes any single Forecaster; it never inspects the concrete model, so a future ensemble forecaster can be passed as model=.
prophet is an optional extra (foundationforecast[prophet]) and is also in the dev group so CI runs the tests. foundationforecast.prophet is not imported by the package __init__.
Docs
New guide docs/prophet-adapter.md, API page docs/api/prophet.md, example notebook docs/examples/prophet-adapter.ipynb, plus README, installation and examples index entries.
Test plan
uv run pytest tests/test_prophet_adapter.py (34 unit tests with a fake Forecaster + 2 models tests with Chronos-Bolt and Chronos-2 regressors)
The flamegraph wasn't generated: the symbols of the profiling trace could not be resolved, because no information about the language frames was collected.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved issues can distort historical time spacing, cause conformal backtests and Prophet diagnostics to fail, and produce intervals inconsistent with the current interval width.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Integer dates are misparsed as 1970 timestamps and silently yield NaN predictions, while numeric-string targets break diagnostics and adapter clones can evaluate the wrong model.
Rebind adapter class when constructed with a different model
foundationforecast/prophet.py:185
When a bound adapter is reconstructed with a different explicit model, such as other = type(m)(model=another_model), this guard leaves its class bound to the original model. Subsequent Prophet-style clones (type(other)(...)) silently revert to that original model, so diagnostics evaluate a different model from other.model. Rebind whenever the bound model differs from the requested model, using the unbound base class.
Convert retained target values to numeric before storing history
foundationforecast/prophet.py:229
Numeric strings in y remain strings in the stored history, so Prophet's performance_metrics(cross_validation(m, ...)) fails when it computes errors against those actuals. Convert retained targets with pd.to_numeric before storing the history, matching Prophet's input handling.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
foundationforecast.prophet.FoundationProphet, aprophet.Prophetsubclass that runs any foundation model instead of the Stan model, so existing Prophet pipelines can swap models in one line:fitstores the history (zero-shot models need no training);predictcallsmodel.forecastwithlevel=[interval_width * 100]and maps the output toyhat,yhat_lower,yhat_upper.make_future_dataframe(include_history=True)) are filled with rolling-origin backtests frommodel.cross_validation(insample="cv", default) and a message is logged explaining the cost and how to skip it.insample="none"leaves themNaN.insample_h/insample_n_windowstune the windows.add_regressorcolumns are passed as known-future exog (X_df), so they work with models that support native exog.diagnostics.cross_validation/performance_metrics,plot,make_future_dataframe, deepcopy and pickle work.plot_componentsand posterior sampling raiseNotImplementedError.Forecaster; it never inspects the concrete model, so a future ensemble forecaster can be passed asmodel=.prophetis an optional extra (foundationforecast[prophet]) and is also in thedevgroup so CI runs the tests.foundationforecast.prophetis not imported by the package__init__.Docs
docs/prophet-adapter.md, API pagedocs/api/prophet.md, example notebookdocs/examples/prophet-adapter.ipynb, plus README, installation and examples index entries.Test plan
uv run pytest tests/test_prophet_adapter.py(34 unit tests with a fakeForecaster+ 2modelstests with Chronos-Bolt and Chronos-2 regressors)uv run pytest -m docs -o addopts= -n 0 tests/docs/test_docs.py -k prophetuv run --group docs zensical builduv run pre-commit run --all-filesMade with Cursor