class_docstr: Tests for the default SMC kernel
class_docstr_tok: ["Tests","for","the","default","SMC","kernel"]
code: def test_unobserved_bernoulli(self):
      n = 10
      rng = np.random.RandomState(20160911)
      z_true = np.zeros(n, dtype=int)
      z_true[int(n / 2) :] = 1
      y = st.norm(np.array([-1, 1])[z_true], 0.25).rvs(random_state=rng)
  
      with pm.Model() as m:
          z = pm.Bernoulli("z", p=0.5, size=n)
          mu = pm.math.switch(z, 1.0, -1.0)
          like = pm.Normal("like", mu=mu, sigma=0.25, observed=y)
  
          trace = pm.sample_smc(chains=1, return_inferencedata=False)
  
      assert np.all(np.median(trace["z"], axis=0) == z_true)
  
imports: import logging
  import platform
  import warnings
  import numpy
  import pytensor.tensor
  import pytest
  import scipy.stats
  from arviz.data.inference_data import InferenceData
  import pymc
  from pymc.backends.base import MultiTrace
  from pymc.pytensorf import floatX
  from pymc.smc.kernels import IMH, systematic_resampling
  from tests.helpers import assert_random_state_equal
label_desc: Use image node_id 4 for calling the TestSMC obj's underlying member method code with example usage: obj.test_unobserved_bernoulli() without return types