%""" Create an infer states function that implements the math we just discussed"""

%def infer_states(observation_index, A, prior):

  % """ Implement inference here -- NOTE: prior is already passed in, so you don't need to do anything with the B matrix. """
  % """ This function has already been given P(s_t). The conditional expectation that creates "today's prior", using "yesterday's posterior", will happen *before calling* this function"""
  % 
  % log_likelihood = log_stable(A[observation_index,:])
  % 
  % log_prior = log_stable(prior)
  % 
  % qs = softmax(log_likelihood + log_prior)
  % 
  % return qs

function qs = infer_states(observation_index, A, prior,epsilon)

log_likelihood = log(A(observation_index,:)+epsilon)';
log_prior = log(prior+epsilon);
qs = softmax(log_likelihood + log_prior);

