New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ENH] Student's t-distribution #5050
Conversation
@fkiraly, my apologies, this is basically a copy paste from the normal currently. I have only changed the |
just posting this here in case you're not aware |
@fkiraly, I couldn't find a formula for energy, if you have one I am happy to implement it. Also, from what I have read it sounds like there isn't an analytic solution for probability point function for the t-distribution. Are you aware of an analytic solution for the ppf? |
Thanks! It's nasty though, so don't do it if it feels to unpleasant. Appendix A.2 of "evaluating forecasts with
The inverse t cdf tends to appear, here's what Wolfram Alpha says: https://www.wolframalpha.com/input/?i=inverse+cdf+student%27s+t+distribution |
Just added the ppf using the Wolfram Alpha link. Thanks for sharing that link. |
Have you checked that it's indeed inverse to the cdf? This should probably be part of the tests, too, note to self. |
Here is an example showing the output of >>> import pandas as pd
>>> from sktime.proba.t import TDistribution
>>> n = TDistribution(mu=0, sigma=1, df=[[1, 1], [1, 1], [1, 1]])
>>> p = pd.DataFrame({"col1": [0.1, 0.3, 0.5], "col2": [0.7, 0.9, 1.0]})
>>> n.cdf(n.ppf(p))
col1 col2
0 0.1 0.7
1 0.3 0.9
2 0.5 NaN |
@fkiraly, I am unsure where to start with the energy function. I see the section for student's t-distribution in A.2 of "evaluating forecasts with scoringRules" but, since there isn't a flashing neon sign saying "this is the energy function!" I am unsure of what needs to be implemented. I assume the continuous ranked probability score (CRPS) is related to energy but it is not obvious to me how. Would it be possible to get a review and perhaps merge in what is currently implemented and leave energy function for a different PR unless you want to take a look at energy on this PR? |
Sure! Have you checked why the tests are failing? |
Yes, the general formula is As said, we can leave it for now - no worries. It's unpleasant as I alluded to above (and in addition, unfortunately, not 100% clear from the reference). |
Btw @Alex-JG3, thanks a lot! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent, really nice!
I haven't checked all the formulae, but I did spot checks and it looked good.
Would you be so kind and also open a PR on skpro
?
See sktime/skpro#22
Just copy-paste this in the appropriate folder and change the BaseDistribution
import location, the test framework will automatically do the rest.
If you're interested, you could:
- implement more distributions - [ENH] roadmap of probability distributions to implement skpro#22
- join on the next phease refinement of the distributions interface [ENH] further improvements on
BaseDistribution
and tests skpro#21 - contribute probabilistic regressors in
skpro
- [ENH] roadmap of probabilistic regressors to implement or to interface skpro#7 - contribute probabilistic forecasters in
sktime
- [ENH] wishlist of interval and probabilistic foreasters #1742
(happy to chat on discord for planning!)
<!-- Thanks for contributing a pull request! Please ensure you have taken a look at our contribution guide: https://skbase.readthedocs.io/en/latest/contribute.html --> #### Reference Issues/PRs <!-- Example: Fixes #1234. See also #3456. Please use keywords (e.g., Fixes) to create link to the issues or pull requests you resolved, so that they will automatically be closed when your pull request is merged. See https://github.com/blog/1506-closing-issues-via-pull-requests --> Mirror of `sktime` sktime/sktime#5050. Towards #22 #### What does this implement/fix? Explain your changes. <!-- A clear and concise description of what you have implemented. Remember to implement unit tests and docstrings if your pull request commits code to the repository. --> Add student's t-distribution.
…encies * origin/main: [BUG] Fix tag to indicate support of exogenous features by `NaiveForecaster` (sktime#5162) [BUG] fix check causing exception in `ConformalIntervals` in `_predict` (sktime#5134) [ENH] empirical distribution (sktime#5094) [MNT] Update versions of pre commit hooks and fix `E721` issues pointed out by `flake8` (sktime#5163) [ENH] `tslearn` distances and kernels including adapter (sktime#5039) [ENH] Student's t-distribution (sktime#5050) [MNT] bound `statsforecast<1.6.0` due to recent failures (sktime#5149) [ENH] widen scope of conditional test execution (sktime#5135) [MNT] [Dependabot](deps-dev): Update sphinx-gallery requirement from <0.14.0 to <0.15.0 (sktime#5124) [MNT] upgrade CI runners to latest stable images (sktime#5031)
Reference Issues/PRs
Related to #4518
What does this implement/fix? Explain your changes.
Add t-distribution to the
proba
subpackage.Does your contribution introduce a new dependency? If yes, which one?
No
What should a reviewer concentrate their feedback on?
Did you add any tests for the change?
Not yet.
Any other comments?
PR checklist
For all contributions
How to: add yourself to the all-contributors file in the
sktime
root directory (not theCONTRIBUTORS.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 pluscode
if you also fixed the bug in the PR).maintenance
- CI, test framework, release.See here for full badge reference
See here for further details on the algorithm maintainer role.