def __condjumpprobability(self, expstate, observation):
# Note that scipy.stats.norm.pdf takes the standard deviation (rather
# than variance) as one of its arguments
if self.__params.jumpintensity < np.finfo(float).eps:
return np.zeros(np.shape(expstate))
if self.__oneminusjumpintensity < np.finfo(float).eps:
return np.ones(np.shape(expstate))
numerator = scipy.stats.norm.pdf(observation, 0., np.sqrt(expstate + self.__jumpvar)) * self.__params.jumpintensity
denominator = numerator + scipy.stats.norm.pdf(observation, 0., np.sqrt(expstate)) * self.__oneminusjumpintensity
return numerator / denominator
评论列表
文章目录