A Particle Filter Implementation
<p>The particle filter runs on a state space model given by
<pre>
X_{t+1} = f(X_t, U_t, t)
Y_{t} = g(X_t, U_t, t)
X(0) = X0
</pre>
where X is the state vector, U is the input vector, Y is the observation
vector, and t is the model time. To use this actor :
<ul>
<li> For each control input in <i>U</i>, create an input port with an arbitrary name.
This actor will automatically create a parameter with the same name as the
input port. That parameter will have its value set during execution to match
the value of the input.
<li> Fill in the <i>stateVariableNames</i> parameter, which is
an array of strings, with the names of the state variables in <i>X</i>.
These names can be arbitrary, since you will refer them to
by name rather than by the symbol <i>X</i>.
<li> Specify an update function (part of <i>f</i> above) for each
state variable by creating a parameter named <i>name</i>_update, where
<i>name</i> is the name of the state variable. The value of this
parameter should be an expression giving the rate of change of
this state variable as a function of any of the state variables,
any input, any other actor parameter, and (possibly), the variable
<i>t</i>, representing current time.
<li> For each measurement input, create an input port with name <i>measurementName</i>_m,
where <i>measurementName</i> is an arbitrary measurement name. Add a parameter to the actor
named <i>measurementName</i>, which is an expression describing the measurement's
correspondence to the state space. Namely, the measurement equation should be a function
of <i>stateVariableNames</i>, <i>U</i> and <i>t</i>.
<li> Fill in the measurement covariance parameter, that should be a square double matrix with
dimension equal to the number of measurement equations defined. In case the measurements are
independent, the matrix should be a scaled identity
<li> Fill in the processNoise parameter, which should be a function that samples from the
(possibly multivariate) distribution the state transition process noise is distributed according
to. The return type should be an array of size equal to the state-space size
<li> Specify the prior distribution as a random function from which the particles will be sampled.
For instance, use the the random() function to draw uniform random variables in [0,1] or use
multivariateGaussian() or gaussian() for Gaussian priors.The return type should be an array of size
equal to the state-space size
<li> It is important to note how multiple measurement inputs are interpreted by the actor.
This implementation interprets multiple measurement inputs to be conditionally
independent given the hidden state. This allows the likelihood (weight) of each particle at time
step t to be computed as a product of its likelihood with respect to each measurement at that time.
<li> For additional parameters that are time varying, add arbitrarily many PortParameters to the actor
and refer to the port parameter by port name within measurement and/or update equations.
</ul>
The preinitialize() method of this actor is based on the ptolemy.domain.ct.lib.DifferentialSystem
actor by Jie Liu.
Ilge Akkaya
$Id: ParticleFilter.java 70402 2014-10-23 00:52:20Z cxh $
Ptolemy II 10.0
Red (ilgea)
Red (ilgea)
The output port that outputs the produced particles at each firing.
State estimate output. A record token with one field per state variable
A boolean parameter that when set to true, implements the so-called
bootstrap particle filter, where particles are resampled at each time step
If this parameter is false, particles are resampled only when the effective
sample size drops below 50% of the total number of particles
Low-variance resampler
Standard deviation of the measurement noise ( assuming Gaussian measurement noise
at the moment)
The expression that specifies the PDF for the measurementNoise. use N(m,s) for
a Gaussian distribution with mean m and standard deviation s. unif (x,y) evaluates
to a uniform distribution in range [x,y]
An expression for the prior distribution from which the samples are drawn.
The process noise. If the system contains multiple state variables, the process noise
should be an expression that returns an ArrayToken. See multivariateGaussian for one such function.
An expression for a prior distribution from which the initial particles are sampled
The names of the state variables, in an array of strings.
The default is an ArrayToken of an empty String.
The value of current time. This parameter is not visible in
the expression screen except in expert mode. Its value initially
is just 0.0, a double, but upon each firing, it is given a
value equal to the current time as reported by the director.
Boolean parameter to determine whether seeds are reset on each run.
The seed to be used for random token generation, to evaluate
probabilistic transitions between states.