Renamed to Multivariate. Prettified charts.
This commit is contained in:
parent
0d0a6e6793
commit
8884bcdd7d
File diff suppressed because one or more lines are too long
11
stats.py
11
stats.py
@ -126,8 +126,6 @@ def multivariate_gaussian(x, mu, cov):
|
||||
probability for x for the Gaussian (mu,cov)
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
scipy.stats.multivariate_normal
|
||||
# force all to numpy.array type
|
||||
@ -226,7 +224,8 @@ def is_inside_ellipse(x,y, ex, ey, orientation, width, height):
|
||||
|
||||
def plot_covariance_ellipse(mean, cov=None, variance = 1.0,
|
||||
ellipse=None, title=None, axis_equal=True,
|
||||
facecolor='none', edgecolor='#004080'):
|
||||
facecolor='none', edgecolor='#004080',
|
||||
alpha=1.0):
|
||||
""" plots the covariance ellipse where
|
||||
|
||||
mean is a (x,y) tuple for the mean of the covariance (center of ellipse)
|
||||
@ -273,6 +272,7 @@ def plot_covariance_ellipse(mean, cov=None, variance = 1.0,
|
||||
e = Ellipse(xy=mean, width=sd*width, height=sd*height, angle=angle,
|
||||
facecolor=facecolor,
|
||||
edgecolor=edgecolor,
|
||||
alpha=alpha,
|
||||
lw=2)
|
||||
ax.add_patch(e)
|
||||
plt.scatter(mean[0], mean[1], marker='+') # mark the center
|
||||
@ -318,7 +318,8 @@ def do_plot_test():
|
||||
|
||||
plot_covariance_ellipse(mean=(0., 0.),
|
||||
cov = p,
|
||||
variance=sd*sd)
|
||||
variance=sd*sd,
|
||||
facecolor='none')
|
||||
|
||||
print (count / len(x))
|
||||
|
||||
@ -350,7 +351,7 @@ if __name__ == '__main__':
|
||||
|
||||
plt.figure()
|
||||
P = np.array([[2,0],[0,2]])
|
||||
plot_covariance_ellipse((2,7), cov=cov, variance=[1,2], title='my title')
|
||||
plot_covariance_ellipse((2,7), cov=cov, variance=[1,2], facecolor='g', title='my title', alpha=.2)
|
||||
plt.show()
|
||||
|
||||
print("all tests passed")
|
||||
|
80
toc.ipynb
80
toc.ipynb
@ -28,11 +28,6 @@
|
||||
"Introduction to the Kalman filter. Explanation of the idea behind this book.\n",
|
||||
"Yes, it is more or less the preface restated. will edit and delete one or the other.\n",
|
||||
"\n",
|
||||
"[**Chapter 0: Signals and Noise**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/Signals_and_Noise.ipynb)\n",
|
||||
"\n",
|
||||
"A brief introduction to signals and noise. Nomenclature and sample code.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[**Chapter 1: The g-h Filter**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/g-h_filter.ipynb)\n",
|
||||
"\n",
|
||||
@ -42,86 +37,83 @@
|
||||
"[**Chapter 2: The Discrete Bayes Filter**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/discrete_bayes.ipynb)\n",
|
||||
"\n",
|
||||
"Introduces the Discrete Bayes Filter. From this you will learn the probabilistic reasoning that underpins the Kalman filter in an easy to digest form.\n",
|
||||
" \n",
|
||||
"\n",
|
||||
"[**Chapter 3: Gaussian Probabilities**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/Gaussians.ipynb)\n",
|
||||
"\n",
|
||||
"[**Chapter 3: Least Squares Filter**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/Least_Squares_Filters.ipynb)\n",
|
||||
"\n",
|
||||
"Introduces the least squares filter in batch and recursive forms.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[**Chapter 4: Gaussian Probabilities**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/Gaussians.ipynb)\n",
|
||||
"\n",
|
||||
"Introduces using Gaussians to represent beliefs. Gaussians allow us to implement the algorithms used in the Discrete Bayes Filter to work in continuous domains.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[**Chapter 4: One Dimensional Kalman Filters**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/Kalman_Filters.ipynb)\n",
|
||||
"[**Chapter 5: One Dimensional Kalman Filters**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/Kalman_Filters.ipynb)\n",
|
||||
"\n",
|
||||
"Implements a Kalman filter by modifying the Discrete Bayesian Filter to use Gaussians. This is a full featured Kalman filter, albeit only useful for 1D problems. \n",
|
||||
" \n",
|
||||
"\n",
|
||||
"[**Chapter 5: Multidimensional Kalman Filter**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/Multidimensional_Kalman_Filters.ipynb)\n",
|
||||
"\n",
|
||||
"[**Chapter 6: Multivariate Kalman Filter**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/Multivariate_Kalman_Filters.ipynb)\n",
|
||||
"\n",
|
||||
"We extend the Kalman filter developed in the previous chapter to the full, generalized filter. \n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[**Chapter 6: Kalman Filter Math**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/Kalman_Filter_Math.ipynb)\n",
|
||||
"[**Chapter 7: Kalman Filter Math**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/Kalman_Filter_Math.ipynb)\n",
|
||||
"\n",
|
||||
"We gotten about as far as we can without forming a strong mathematical foundation. This chapter is optional, especially the first time, but if you intend to write robust, numerically stable filters, or to read the literature, you will need to know this.\n",
|
||||
" \n",
|
||||
"\n",
|
||||
"[**Chapter 7: Designing Kalman Filters**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/Designing_Kalman_Filters.ipynb)\n",
|
||||
"\n",
|
||||
"Building on material in Chapter 5, walks you through the design of several Kalman filters. Discusses, but does not solve issues like numerical stability.\n",
|
||||
" \n",
|
||||
"[**Chapter 8: Designing Kalman Filters**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/Designing_Kalman_Filters.ipynb)\n",
|
||||
"\n",
|
||||
"Building on material in Chapter 6, walks you through the design of several Kalman filters. Discusses, but does not solve issues like numerical stability.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[**Chapter 9: Extended Kalman Filters**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/Extended_Kalman_Filters.ipynb)\n",
|
||||
"\n",
|
||||
"[**Chapter 8: Extended Kalman Filters**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/Extended_Kalman_Filters.ipynb)\n",
|
||||
" \n",
|
||||
"Kalman filter as covered only work for linear problems. Extended Kalman filters (EKF) are the most common approach to linearizing non-linear problems.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[**Chapter 9: Unscented Kalman Filters**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/Unscented_Kalman_Filter.ipynb)\n",
|
||||
" \n",
|
||||
"[**Chapter 10: Unscented Kalman Filters**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/Unscented_Kalman_Filter.ipynb)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"Unscented Kalman filters (UKF) are a recent development in Kalman filter theory. They allow you to filter nonlinear problems without requiring a closed form solution like the Extended Kalman filter requires.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[**Chapter 10: Numerical Stability**](not implemented)\n",
|
||||
" \n",
|
||||
"EKF and UKF are linear approximations of nonlinear problems. Unless programmed carefully, they are not numerically stable. We discuss some common approaches to this problem.\n",
|
||||
"\n",
|
||||
"[**Chapter 11: Designing Nonlinear Kalman Filters**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/Designing_Nonlinear_Kalman_Filters.ipynb)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[**Chapter ??: Least Squares Filters](not implemented)\n",
|
||||
"\n",
|
||||
"Not sure where in order to put this. \n",
|
||||
"[**Chapter 12: H-Infinity Filters**](not implemented)\n",
|
||||
" \n",
|
||||
"EKF and UKF are linear approximations of nonlinear problems. Unless programmed carefully, they are not numerically stable. We discuss some common approaches to this problem.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[**Chapter 12: Smoothing**](not implemented)\n",
|
||||
"[**Chapter 13: Numerical Stability**](not implemented)\n",
|
||||
" \n",
|
||||
"EKF and UKF are linear approximations of nonlinear problems. Unless programmed carefully, they are not numerically stable. We discuss some common approaches to this problem.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[**Chapter 14: Smoothing**](not implemented)\n",
|
||||
" \n",
|
||||
"Kalman filters are recursive, and thus very suitable for real time filtering. However, they work well for post-processing data. We discuss some common approaches.\n",
|
||||
" \n",
|
||||
" \n",
|
||||
"[**Chapter 13: Control Theory**](not implemented)\n",
|
||||
"\n",
|
||||
"This book focuses on tracking and filtering, but Kalman filters have an input for control. We discuss using Kalman filters to control devices like robots, CNC machinery and so on.\n",
|
||||
" \n",
|
||||
" \n",
|
||||
"[**Chapter 14: Particle Filters**](not implemented)\n",
|
||||
" \n",
|
||||
"[**Chapter 15: Particle Filters**](not implemented)\n",
|
||||
" \n",
|
||||
"Particle filters uses a Monte Carlo technique to \n",
|
||||
" \n",
|
||||
" \n",
|
||||
"[**Chapter 15: Multihypothesis Tracking**](not implemented)\n",
|
||||
"\n",
|
||||
"[**Chapter 16: Multihypothesis Tracking**](not implemented)\n",
|
||||
" \n",
|
||||
"description\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[**Appendix: Python and NumPy**](not implemented)\n",
|
||||
"[**Appendix: Installation, Python, NumPy, and filterpy**](not implemented)\n",
|
||||
"\n",
|
||||
"Brief introduction of Python and how it is used in this book. Explanation of my use of NumPy matrices.\n",
|
||||
"Brief introduction of Python and how it is used in this book. Description of the companion\n",
|
||||
"library filterpy. \n",
|
||||
" \n",
|
||||
"\n",
|
||||
"[**Appendix: Statistics**](not implemented)\n",
|
||||
"\n",
|
||||
"Brief review of statistical math. \n",
|
||||
" \n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[**Appendix: Symbols and Notations**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/Appendix_Symbols_and_Notations.ipynb)\n",
|
||||
"\n",
|
||||
"Symbols and notations used in this book. Comparison with notations used in the literature.\n",
|
||||
|
Loading…
Reference in New Issue
Block a user