code: def testDoesRegularize(self):
      # Make sure that using regularization makes the final estimate closer to
      # the initial state than the empirical result.
      init_mean = tf.zeros(3)
      init_variance = tf.ones(3)
      initial_running_variance = (
          sample_stats.RunningVariance.from_stats(
              num_samples=10.0, mean=init_mean, variance=init_variance
          )
      )
      results = self._run_hmc(
          num_results=50,
          initial_running_variance=initial_running_variance,
      )
  
      # the `final_mean` should be a weighted average
      self.assertAllClose(
          results.final_mean,
          10.0 / 60.0 * init_mean
          + 50.0 / 60.0 * results.empirical_mean,
      )
  
      # the `final_precision` is not quite a weighted average, since the
      # estimate of the mean also gets updated, but it is close-ish
      self.assertAllClose(
          results.final_precision,
          10.0 / 60.0 * init_variance
          + 50.0 / 60.0 * results.empirical_variance,
          rtol=0.2,
      )
  
imports: import collections
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import joint_distribution_sequential
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import sample
  from tensorflow_probability.python.experimental.mcmc import diagonal_mass_matrix_adaptation
  from tensorflow_probability.python.experimental.mcmc import preconditioned_hmc
  from tensorflow_probability.python.experimental.mcmc import preconditioning_utils
  from tensorflow_probability.python.experimental.stats import sample_stats
  from tensorflow_probability.python.internal import distribute_lib
  from tensorflow_probability.python.internal import distribute_test_lib
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.mcmc import sample
label_desc: Use image node_id 5 for calling the DiagonalMassMatrixAdaptationTest obj's underlying member method code with example usage: obj.testDoesRegularize() without return types