示例#1
0
    def testMarkovChainLogprobMatchesOriginal(self):
        model = lorenz_system.ConvectionLorenzBridge(use_markov_chain=False)
        markov_chain_model = lorenz_system.ConvectionLorenzBridge(
            use_markov_chain=True)

        x = self.evaluate(model.prior_distribution().sample(
            20, seed=tfp_test_util.test_seed()))
        self.assertAllClose(model.unnormalized_log_prob(x),
                            markov_chain_model.unnormalized_log_prob(
                                tf.stack(x, axis=-2)),
                            atol=1e-2)
示例#2
0
 def testConvectionLorenzBridge(self):
     """Checks that unconstrained parameters yield finite joint densities."""
     model = lorenz_system.ConvectionLorenzBridge(use_markov_chain=True)
     self.validate_log_prob_and_transforms(
         model,
         sample_transformation_shapes=dict(identity=[30, 3]),
         check_ground_truth_mean_standard_error=True,
         check_ground_truth_mean=True,
         check_ground_truth_standard_deviation=True)
示例#3
0
    def testConvectionLorenzBridgeHMC(self):
        """Checks approximate samples from the model against the ground truth."""
        model = lorenz_system.ConvectionLorenzBridge(use_markov_chain=True)

        self.validate_ground_truth_using_hmc(
            model,
            num_chains=4,
            num_steps=2000,
            num_leapfrog_steps=240,
            step_size=0.03,
        )