Skip to content

Thoughts on one sided truncations?  #1

@hesenp

Description

@hesenp

Hey there,

Thanks a lot for writing this wonderful module. While it meets most of my modeling needs, I wonder if you have ever considered enabling the module for one sided truncation? I was thinking that using np.inf might solve the problem. But it does not seem to work as I imagined:

import tensorflow as tf 
import numpy as np 
from truncatedDistribution import TruncatedDistribution as TD
import matplotlib.pyplot as plt 

session = tf.Session()

base_normal = tf.distributions.Gamma(100.,2.)
trunc_normal = TD(base_normal, - np.inf, 10.)

plt.hist(trunc_normal.sample(100).eval(session = session))

Here the output is a vector full of Nan.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions