How create a not normal prior and posterior ?

29 views
Skip to first unread message

Guilherme Namen Pimenta

unread,
Oct 28, 2022, 1:53:37 PM10/28/22
to TensorFlow Probability
To create a normal prior and posterior I use this code:

def prior(kernel_size, bias_size, dtype=None):
    n = kernel_size + bias_size
    # Independent Normal Distribution
    return lambda t: tfd.Independent(tfd.StudentT(loc=tf.zeros(n, dtype=dtype),
                                                scale=1, df=2),
                                     reinterpreted_batch_ndims=1)

def posterior(kernel_size, bias_size, dtype=None):
    n = kernel_size + bias_size
    return tf.keras.Sequential([
        tfpl.VariableLayer(tfpl.IndependentNormal.params_size(n), dtype=dtype),
        tfpl.IndependentNormal(n)
    ])

But I want to create a StudentT prior and posterio. Could someone help me?
Reply all
Reply to author
Forward
0 new messages