Example #1
0
def test_smoother_ref_traj3_1():
    """ test_smoother_ref_traj3_1 .
  Just check if it can be computed and does not trigger underflow warnings. """
    traj = simple_traj3()
    theta = np.array([-1.0, 1.0])
    smoother_1 = TrajectorySmoother1(traj, theta)
    smoother_1.computeProbs()
def test_smoother_ref_traj3_1():
  """ test_smoother_ref_traj3_1 .
  Just check if it can be computed and does not trigger underflow warnings. """
  traj = simple_traj3()
  theta = np.array([-1.0, 1.0])
  smoother_1 = TrajectorySmoother1(traj, theta)
  smoother_1.computeProbs()
def test_em_1():
  """ Very simple test: we pick some trajectories and verify that
  the LL increases with EM.
  """
  trajs = [simple_traj1(), simple_traj4(), simple_traj3()]
  theta_start = 0.1 * np.ones(2)
  history = learn_em(trajs_estim_obj_fun_1, trajs, theta_start)
#  (ll_end, theta_end) = history[-1]
  # Very simple check here: we verify the progression goes upward 
  # the likelihood:
  for t in range(len(history)-1):
    (ll_1, _) = history[t]
    (ll_2, _) = history[t+1]
    assert ll_1 <= ll_2
def test_em_1():
    """ Very simple test: we pick some trajectories and verify that
  the LL increases with EM.
  """
    trajs = [simple_traj1(), simple_traj4(), simple_traj3()]
    theta_start = 0.1 * np.ones(2)
    history = learn_em(trajs_estim_obj_fun_1, trajs, theta_start)
    #  (ll_end, theta_end) = history[-1]
    # Very simple check here: we verify the progression goes upward
    # the likelihood:
    for t in range(len(history) - 1):
        (ll_1, _) = history[t]
        (ll_2, _) = history[t + 1]
        assert ll_1 <= ll_2