我编辑了答案,因为我误解了这个问题。我认为问题是你缺少关键词
n_iter
请参阅此代码:
kf1 = KalmanFilter()
kf1 = kf1.em(pri_mean, n_iter=10, em_vars='all')
print(kf1.transition_matrices, kf1.transition_offsets, kf1.transition_covariance)
kf1 = kf1.em(pri_mean, n_iter=10, em_vars='all')
print(kf1.transition_matrices, kf1.transition_offsets, kf1.transition_covariance)
kf1 = KalmanFilter()
kf1 = kf1.em(pri_mean, n_iter=20, em_vars='all')
print(kf1.transition_matrices, kf1.transition_offsets, kf1.transition_covariance)
我创建了一个过滤器
KalmanFilter()
,循环10次迭代并打印,然后再循环10次并打印。
这相当于调用
.em()
直接进行20次迭代。
将产生以下输出
[[ 0.95500561]] [ 113.29118228] [[ 6431.66262464]]
[[ 0.93636512]] [ 119.32378005] [[ 249.67547612]]
[[ 0.93636512]] [ 119.32378005] [[ 249.67547612]]