00001 namespace indii { 00002 namespace ml { 00003 namespace filter { 00004 00005 /** 00006 * @namespace indii::ml::filter Filters and smoothers. 00007 * 00008 * @section estimator_usage Usage 00009 * 00010 * All the filters and smoothers provided have the same usage 00011 * idiom. This requires two objects: 00012 * 00013 * @li A @em %method object, which implements the particular 00014 * filtering or smoothing algorithm and stores the predicted system 00015 * state \f$\mathbf{x}\f$. 00016 00017 * @li A @em model object, which defines the transition and 00018 * measurement functions \f$f\f$ and \f$g\f$ and system and 00019 * measurement noise \f$\mathbf{w}\f$ and \f$\mathbf{v}\f$. 00020 * 00021 * Start by choosing the method to use (e.g. a particle %filter), and 00022 * reading the documentation for the associated class 00023 * (e.g. ParticleFilter). Each method has a corresponding virtual 00024 * model class (e.g. ParticleFilterModel). Implement your model by 00025 * writing a new class that derives from this virtual class. The 00026 * virtual class provides the functions that must be implemented in 00027 * order that the model be compatible with your chosen method. 00028 * 00029 * Now, instantiate an object of your model class: 00030 * 00031 * @code 00032 * MyParticleFilterModel model; 00033 * @endcode 00034 * 00035 * and a prior distribution over the state of the system: 00036 * 00037 * @code 00038 * indii::ml::aux::vector mu(5); 00039 * indii::ml::aux::symmetric_matrix sigma(5); 00040 * 00041 * mu.clear(); 00042 * mu(0) = -1.0; 00043 * mu(1) = 1.0; 00044 * mu(2) = 0.8; 00045 * mu(3) = 0.1; 00046 * mu(4) = 5e-3; 00047 * 00048 * sigma.clear(); 00049 * sigma(0,0) = 1.0; 00050 * sigma(1,1) = 1.0; 00051 * sigma(2,2) = 0.01; 00052 * sigma(3,3) = 1e-6; 00053 * sigma(4,4) = 1e-6; 00054 * 00055 * indii::ml::aux::GaussianPdf tmp(mu, sigma); 00056 * indii::ml::aux::DiracMixturePdf x0(tmp, 500); 00057 * @endcode 00058 * 00059 * Pass both of these to the constructor of your chosen method to 00060 * instantiate it: 00061 * 00062 * @code 00063 * ParticleFilter filter(&model, x0); 00064 * @endcode 00065 * 00066 * Apply the method by using its step functions to advance it forwards 00067 * or backwards through time, passing in the relevant measurement at 00068 * each step. After each step, retrieve the estimated system state. 00069 * 00070 * @code 00071 * unsigned int T = 100; 00072 * unsigned int t; 00073 * double y[T] = { ... }; // measurements, perhaps read in from a file 00074 * 00075 * for (t = 1; t <= T; t++) { 00076 * filter.filter(t, y[t]); 00077 * std::cout << t << '='; 00078 * std::cout << filter.getFilteredState().getExpectation() << std::endl; 00079 * } 00080 * @endcode 00081 * 00082 * Smoothers have a similar usage idiom. First filter the data, then 00083 * initialise a smoother, such as ParticleSmoother, with the last 00084 * state of the filter, and use the smoother's stepping function to 00085 * proceed backward through time. 00086 * 00087 * See the test suite for more elaborate example code. 00088 * 00089 * @par Tip: 00090 * For the KalmanFilter, KalmanSmoother and RauchTungStriebelSmoother 00091 * methods, you may instantiate an object of the LinearModel class as 00092 * your model, rather than deriving your own model class. 00093 */ 00094 00095 } 00096 } 00097 }
1.5.3