Replies: 8 comments 22 replies
-
@tvwenger A PR would be appreciated! |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
@tvwenger from reading this is just a scaled chi distribution with 3 degrees of freedom? If that's the case you don't need to implement a new standard distribution and should instead use a import pymc as pm
def maxwell_dist(scale, size):
return pm.math.sqrt(pm.ChiSquared.dist(nu=3, size=size)) * scale
with pm.Model():
...
pm.CustomDist("x", scale, dist=maxwell_dist, **kwargs) If you want to implement it in PyMC-Experimental you can make a helper class that returns such CustomDist, something like class Maxwell:
def __new__(name, scale, **kwargs):
if "observed" not in kwargs:
kwargs.set_default("transform", pm.distributions.transforms.log)
return CustomDist(name, scale, dist=maxwell_dist, class_name="Maxwell", **kwargs)
def dist(scale, **kwargs):
return CustomDist.dist(scale, dist=maxwell_dist, class_name="Maxwell", **kwargs) Testing will also be easier, just check the logp matches the same as scipy in one or two points. |
Beta Was this translation helpful? Give feedback.
-
@ricardoV94 I took a stab at an implementation following your suggestion in |
Beta Was this translation helpful? Give feedback.
-
@ricardoV94 I'm starting to wonder if a |
Beta Was this translation helpful? Give feedback.
-
Implemented in pymc-devs/pymc-extras#261 |
Beta Was this translation helpful? Give feedback.
-
I have need of a Maxwell distribution in
pymc
. I don't think any of the existing distributions work for modelling a Maxwell distribution. Unless there is already an implementation, I can work on a PR for it.Beta Was this translation helpful? Give feedback.
All reactions