pymc4 icon indicating copy to clipboard operation
pymc4 copied to clipboard

PYMC4.Bound not found

Open muunetheus opened this issue 5 years ago • 3 comments

Error received when using pymc4.bound():

AttributeError: module 'pymc4' has no attribute 'bound'

Is bound available for PYMC4?

muunetheus avatar Sep 03 '20 23:09 muunetheus

Not yet - contribution welcome :-)

junpenglao avatar Sep 04 '20 07:09 junpenglao

Do you the the equivalent function in TFP? I'm relatively new to TFP, so if you point me in the right direction I can try to contribute :)

muunetheus avatar Sep 24 '20 07:09 muunetheus

Bound in PyMC3 is not proper - we just cut off the density outside of the bound without normalizing the PDF. To replicate this behavior, we can assign a bijector a Bound super class, something like:

class Bound(BoundedDistribution):
    def _init_transform(self, transform):
        if transform is None:
            if self.lower_limit() is not None and self.upper_limit() is None:
                return transforms.LowerBound(self.lower_limit())
            elif self.lower_limit() is not None and self.upper_limit() is not None:
                return transforms.Interval(self.lower_limit(), self.upper_limit())
            elif ...
        else:
            return transform

    def __init__(self, base_distribution, lower, upper):
        ...

    def upper_limit(self):
        ...

    def lower_limit(self):
        ...

junpenglao avatar Sep 24 '20 08:09 junpenglao