Generalized discrete Bayes with likelihood.
All my code in this chapter hard coded the computation of the likelihood inside the update() function, where it had no business. Also, my treatment of the likelihood was rather hand wavey. By pulling it out of update() and maing it explicit I have created a firm foundation for the rest of the book.
This commit is contained in:
@@ -100,11 +100,13 @@ def show_residual_chart():
|
||||
plt.scatter ([0,1], [158.0,est_y], c='k',s=128)
|
||||
plt.scatter ([1], [164.2], c='b',s=128)
|
||||
plt.scatter ([1], [159], c='r', s=128)
|
||||
plt.text (1.0, 158.8, "prediction ($x_t)$", ha='center',va='top',fontsize=18,color='red')
|
||||
plt.text (1.0, 164.4, "measurement ($z$)",ha='center',va='bottom',fontsize=18,color='blue')
|
||||
plt.text (0, 157.8, "prior estimate ($\hat{x}_{t-1}$)", ha='center', va='top',fontsize=18)
|
||||
plt.text (1.05, 158.8, r"prior $(\bar{x}_t)$", ha='center',va='top',fontsize=18,color='red')
|
||||
plt.text (0.5, 159.6, "prediction", ha='center',va='top',fontsize=18,color='red')
|
||||
plt.text (1.0, 164.4, r"measurement ($z$)",ha='center',va='bottom',fontsize=18,color='blue')
|
||||
plt.text (0, 157.8, r"posterior ($x_{t-1}$)", ha='center', va='top',fontsize=18)
|
||||
plt.text (1.02, est_y-1.5, "residual", ha='left', va='center',fontsize=18)
|
||||
plt.text (0.9, est_y, "new estimate ($\hat{x}_{t}$)", ha='right', va='center',fontsize=18)
|
||||
plt.text (0.9, est_y, "new estimate ($x_t$)", ha='right', va='center',fontsize=18)
|
||||
plt.text (0.8, est_y-0.5, "(posterior)", ha='right', va='center',fontsize=18)
|
||||
plt.xlabel('time')
|
||||
ax.yaxis.set_label_position("right")
|
||||
plt.ylabel('state')
|
||||
|
||||
Reference in New Issue
Block a user