Error in Bayesian Gaussian Mixture Model Example in Colab

41 views
Skip to first unread message

Siva Rajesh

unread,
Oct 5, 2021, 10:11:23 AM10/5/21
to TensorFlow Probability
Hi, 
I am trying to run the Bayesian Gaussian Mixture Model example in Colab. 

Question 1) 
In the sampling step "[mix_probs, loc, chol_precision], is_accepted = sample()" , I run into a warning and execution gets stuck there with the following message: "WARNING: Nested component "transform_diagonal" in composition "chain_of_transform_diagonal_of_fill_triangular" operates on inputs with increased degrees of freedom. This may result in an incorrect log_det_jacobian."

Question 2) 
In this example, Hamiltonian Monte Carlo sampling was used. Instead, I am trying to use randomwalk metropolis with a Normal proposal distribution. 

This is the modified sampling function I use:

#################################

mh_normal_unconstrained = tfp.mcmc.TransformedTransitionKernel(
tfp.mcmc.RandomWalkMetropolis(
target_log_prob_fn=unnormalized_posterior_log_prob),
bijector = unconstraining_bijectors)



@tf.function(autograph=False)
def sample():
return tfp.mcmc.sample_chain(
num_results=2000,
num_burnin_steps=500,
current_state=initial_state,
kernel=mh_normal_unconstrained,
trace_fn=lambda _, kernel_results: kernel_results)

#################################

However, the results are pretty off from the true values. Can you please check if this is the correct code or any corrections are required. 

Thanks in advance,
Siva
Reply all
Reply to author
Forward
0 new messages