-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Skewed Student-T distribution #7252
Conversation
Add in pymc-experimental first? |
If something like this goes in experimental, there should be a clear roadmap to go from there back to the main repo. This is a straight-forward distribution that (I guess?) can't be easily implemented as a generative graph using only existing distributions via |
I don't think this one has a straightforward generative graph |
I assumed something "according to x and y" was a bit experimental, hence my suggestion |
The "Following Jones and Faddy 2003" was to distinguish it from the range of available skewed Student T implementations (there are 3 or 4). I chose this one because it is available in SciPy and relatively straightforward to implement. I think it will be a useful distribution because it allows one to specify a likelihood that is both skewed and overdispersed and converges to normal when a and b are both large and equal. |
Jax failure does not seem to be related to this PR |
It's not. Has been failing since the last scipy |
But this one is: https://github.com/pymc-devs/pymc/actions/runs/8682226852/job/23806440256?pr=7252#step:7:616 You should try running those logp/logcdf/icdf with |
You're missing the tests for the RV itself. That's also where we cover alternative parametrizations. Something like these pymc/tests/distributions/test_continuous.py Lines 2179 to 2200 in 34c2d31
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7252 +/- ##
==========================================
+ Coverage 91.67% 92.35% +0.68%
==========================================
Files 102 102
Lines 17017 17069 +52
==========================================
+ Hits 15600 15764 +164
+ Misses 1417 1305 -112
|
pymc/distributions/continuous.py
Outdated
|
||
@classmethod | ||
def rng_fn(cls, rng, a, b, mu, sigma, size=None) -> np.ndarray: | ||
return np.asarray(stats.jf_skew_t.rvs(a=a, b=b, size=size, random_state=rng)) * sigma + mu |
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.
Can't sigma and mu be passed as arguments to the rvs?
The way you wrote it has a similar bug that was addressed by this recent bugfix, when there are batched sigma and mu and size is None: #7288
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.
You marked as resolved but I still see the old code?
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.
Sorry, I had forgotten to push.
Looks like |
These tests run a random subset of 100 combinations. We should set CC @fonnesbeck |
Running float64 this gives:
|
Which underflows? PyMC or Scipy? |
SciPy produces the What's the fix? I have it open and can push a branch real quick (if it's simple) |
Try slightly less extreme parameter domains |
Description
Added skewed Student T distribution (Jones and Faddy implementation).
Checklist
Type of change
📚 Documentation preview 📚: https://pymc--7252.org.readthedocs.build/en/7252/