code: def test_likelihood_ratio():
      model = HarmonicModel()
      guide = HarmonicGuide()
  
      smc = SMCFilter(
          model, guide, num_particles=100, max_plate_nesting=0
      )
  
      zs, ys = generate_data()
      zs_true, ys_true = generate_data()
      smc.init()
      for y in ys_true[1:]:
          smc.step(y)
      i = smc.state._log_weights.max(0)[1]
      values = {k: v[i] for k, v in smc.state.items()}
  
      zs_pred = [torch.tensor([1.0, 0.0])]
      zs_pred += [values["z_{}".format(t)] for t in range(1, 51)]
  
      assert score_latent(zs_true, ys_true) > score_latent(zs, ys_true)
      assert score_latent(zs_pred, ys_true) > score_latent(zs_pred, ys)
      assert score_latent(zs_pred, ys_true) > score_latent(zs, ys_true)
  
imports: import pytest
  import torch
  import pyro
  import pyro.distributions
  import pyro.poutine
  from pyro.infer import SMCFilter
  from pyro.infer.smcfilter import _systematic_sample
  from tests.common import assert_close
label_desc: Use image node_id 5 for calling a global function with example usage: test_likelihood_ratio() without return types