class_docstr: Related to minibatch training
class_docstr_tok: ["Related","to","minibatch","training"]
code: def test_minibatch_parameter_and_value(self):
      rng = np.random.default_rng(161)
      total_size = 1000
  
      with pm.Model(check_bounds=False) as m:
          AD = pm.MutableData(
              "AD", np.arange(total_size, dtype="float64")
          )
          TD = pm.MutableData(
              "TD", np.arange(total_size, dtype="float64")
          )
  
          minibatch_idx = minibatch_index(0, 10, size=(9,))
          AD_mt = AD[minibatch_idx]
          TD_mt = TD[minibatch_idx]
  
          pm.Normal(
              "AD_predicted",
              mu=TD_mt,
              observed=AD_mt,
              total_size=1000,
          )
  
      logp_fn = m.compile_logp()
  
      ip = m.initial_point()
      np.testing.assert_allclose(logp_fn(ip), st.norm.logpdf(0) * 1000)
  
      with m:
          pm.set_data({"AD": np.arange(total_size) + 1})
      np.testing.assert_allclose(logp_fn(ip), st.norm.logpdf(1) * 1000)
  
      with m:
          pm.set_data({"AD": rng.normal(size=1000)})
      assert logp_fn(ip) != logp_fn(ip)
  
file_path: pymc/tests/variational/test_minibatch_rv.py
imports: import numpy
  import pytensor
  import pytest
  from scipy import stats
  import pymc
  from pymc import Normal, draw
  from pymc.data import minibatch_index
  from pymc.testing import select_by_precision
  from pymc.variational.minibatch_rv import create_minibatch_rv
  from tests.test_data import gen1, gen2
label_desc: Use image node_id 8 for calling the TestMinibatchRandomVariable obj's underlying member method code with example usage: obj.test_minibatch_parameter_and_value() without return types