def testBrownianMotionMarkovChainLogprobMatchesOriginal(self): model = (brownian_motion.BrownianMotionMissingMiddleObservations( use_markov_chain=False)) markov_chain_model = ( brownian_motion.BrownianMotionMissingMiddleObservations( use_markov_chain=True)) x = self.evaluate(model.prior_distribution().sample( 400, seed=tfp_test_util.test_seed())) self.assertAllClose(model.unnormalized_log_prob(x), markov_chain_model.unnormalized_log_prob( tf.stack(x, axis=-1)), atol=1e-2)
def testBrownianMotionMissingMiddleObservations(self): """Checks that unconstrained parameters yield finite joint densities.""" model = brownian_motion.BrownianMotionMissingMiddleObservations() self.validate_log_prob_and_transforms( model, sample_transformation_shapes=dict(identity=[30]), check_ground_truth_mean_standard_error=True, check_ground_truth_mean=True, check_ground_truth_standard_deviation=True)
def testBrownianMotionMissingMiddleObservationsHMC(self): """Checks approximate samples from the model against the ground truth.""" model = brownian_motion.BrownianMotionMissingMiddleObservations() self.validate_ground_truth_using_hmc( model, num_chains=4, num_steps=4000, num_leapfrog_steps=18, step_size=0.02, )