Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@tpvasconcelos
Copy link
Contributor

@tpvasconcelos tpvasconcelos commented Dec 2, 2023

Reference Issues/PRs

Fixes #2344

What does this implement/fix? Explain your changes.

Adds a dict fit_kwargs parameter to the Prophet forecaster constructor. This dictionary is then passed down to the prophet.forecaster.Prophet.fit method.

Does your contribution introduce a new dependency? If yes, which one?

No

Did you add any tests for the change?

Added a test that checks whether the correct kwargs are passed down to the prophet.forecaster.Prophet.fit method.

Any other comments?

No

PR checklist

For all contributions
  • I've added myself to the list of contributors with any new badges I've earned :-)
    How to: add yourself to the all-contributors file in the sktime root directory (not the CONTRIBUTORS.md). Common badges: code - fixing a bug, or adding code logic. doc - writing or improving documentation or docstrings. bug - reporting or diagnosing a bug (get this plus code if you also fixed the bug in the PR).maintenance - CI, test framework, release.
    See here for full badge reference
  • Optionally, I've added myself and possibly others to the CODEOWNERS file - do this if you want to become the owner or maintainer of an estimator you added.
    See here for further details on the algorithm maintainer role.
  • The PR title starts with either [ENH], [MNT], [DOC], or [BUG]. [BUG] - bugfix, [MNT] - CI, test framework, [ENH] - adding or improving code, [DOC] - writing or improving documentation or docstrings.
For new estimators
  • I've added the estimator to the API reference - in docs/source/api_reference/taskname.rst, follow the pattern.
  • I've added one or more illustrative usage examples to the docstring, in a pydocstyle compliant Examples section.
  • If the estimator relies on a soft dependency, I've set the python_dependencies tag and ensured
    dependency isolation, see the estimator dependencies guide.

@tpvasconcelos tpvasconcelos changed the title Add fit_kwargs to Prophet [ENH] Add fit_kwargs to Prophet Dec 2, 2023
@fkiraly fkiraly added interfacing algorithms Interfacing existing algorithms/estimators from third party packages module:forecasting forecasting module: forecasting, incl probabilistic and hierarchical forecasting enhancement Adding new functionality labels Dec 2, 2023
Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

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

Thanks!

Two requests:

  • the sklearn interface specification requires not mutating params after writing to self, see above
  • could you add a get_test_params parameter set that involves fit_params?

@tpvasconcelos
Copy link
Contributor Author

tpvasconcelos commented Dec 2, 2023

  • could you add a get_test_params parameter set that involves fit_params?

@fkiraly Prophet does not document which parameters are accepted here. These could also change depending on the selected Stan backend. In this case, I would say that there are no interesting cases to add to get_test_params. WDYT?

For reference see my comment here: #2344 (comment)

@fkiraly
Copy link
Collaborator

fkiraly commented Dec 2, 2023

I would say that there are no interesting cases to add to get_test_params. WDYT?

Well, that's odd - if we do not know a single example, are we sure it makes sense to add this as a parameter of the estimator?

@tpvasconcelos
Copy link
Contributor Author

Well, that's odd - if we do not know a single example, are we sure it makes sense to add this as a parameter of the estimator?

An example would be prophet_forecaster.fit(df, seed=1234, algorithm="Newton"). My point is that I don't think this is a relevant example, for the reasons I shared above and in my other comment.

But maybe you can help me better understand what get_test_params is used for.

@fkiraly
Copy link
Collaborator

fkiraly commented Dec 2, 2023

But maybe you can help me better understand what get_test_params is used for.

this is used purely in testing, to generate a set of instances so that the estimator - or the interface code - receives good coverage, see last points in
https://www.sktime.net/en/latest/developer_guide/add_estimators.html#how-to-use-sktime-extension-templates

So, if we add the forward dict, we should add an arbitrary example where it is not None, so we test its forwarding.

@tpvasconcelos
Copy link
Contributor Author

Got it! Then we can assume that the default stan backend will be used by prophet (cmdstanpy) and that these parameters will be passed down to cmdstanpy.CmdStanModel.optimize and cmdstanpy.CmdStanModel.sample

@tpvasconcelos
Copy link
Contributor Author

@fkiraly Could you take a look at the current changes and let me know if there's anything that you'd still like me to address? Thanks in advance!

Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

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

Yes, I think my change requests are addressed.

@tpvasconcelos
Copy link
Contributor Author

@fkiraly @yarnabrina thanks again for all the valuable input, attention to detail, and promptness in reviewing this! It's highly appreciated ❤️

@fkiraly fkiraly merged commit e4c98a5 into sktime:main Dec 9, 2023
fkiraly pushed a commit that referenced this pull request Dec 15, 2023
This makes a minor change to code introduced in #5597 that prevents
breakeage if `self.fit_kwargs` are not available in a descendant of the
`_ProphetAdapter`, such as in the piecewise linear trend forecaster, in
#5592
@tpvasconcelos tpvasconcelos deleted the prophet-fit-kwargs branch September 5, 2024 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Adding new functionality interfacing algorithms Interfacing existing algorithms/estimators from third party packages module:forecasting forecasting module: forecasting, incl probabilistic and hierarchical forecasting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENH] Pass pmdarima and prophet models' fit_params to constructor

3 participants