I want to use a Jeffreys Prior on the scale parameter for a Gaussian latent variable or a Gaussian likelihood.
I used a Uniform
distribution and then TransformedDistribution
for the exp
transformation. When I use that in the scale
parameter, and use MetropolisHasting
I end up getting 0 acceptance rate. However, when I set the scale to 1.0 I do end up with an acceptance rate of ~.50 so I assume I’m probably doing something wrong here.
Below is a snippet of the code:
T = 10000
# Latent variables
K = Normal(loc=tf.zeros((len(n_np), len(to_optimize))), scale=1.0)
log_sigma = Uniform(low=[-4.6052], high=[3.453])
sigma = TransformedDistribution(distribution=log_sigma, bijector=ds.bijectors.Exp(), name='sigma')
# Observed
Fourier_sum = tf.reduce_sum(tf.reduce_sum(tf.multiply(phis, K), axis=1), axis=1)
Fourier_sum_rel = Fourier_sum - tf.reduce_min(Fourier_sum)
# Proposal distributions
proposal_K = Normal(loc=K, scale=0.02)
qK = Empirical(tf.Variable(tf.zeros([T, 6, 3])))
proposal_sigma = Normal(loc=sigma, scale=0.02)
qsigma = Empirical(tf.Variable(tf.zeros([T, 1])))
# Likelihood
likelihood = Normal(loc=Fourier_sum, scale=sigma)
# MH inference
inference = ed.MetropolisHastings(latent_vars={K: qK, sigma: qsigma},
proposal_vars={K: proposal_K, sigma: proposal_sigma},
data={likelihood: residual_data})
This works when I use a scale = 1.0 in the likelihood and remove the sigma from the latent and proposal variable.