Closed jacobnzw closed 5 years ago
Accommodating Different Distributions for Initial Conditions/Noises
Module: utils.py
Create a base class RandomVariable
which will dictate common interface for all RVs. The distribution classes will have the following responsibilities:
Create subclass for each type of random variable. Instances will be fed to TransitionModel
and MeasurementModel
initializers. Local filters propagate mean and covariance only, regardless of the noise/init. distribution. Which means that the random variable should have a method for computing the mean and covariance from its distribution parameters (sufficient statistics). For example: Student's RV is parametrized by mean, scale matrix and dof. Covariance can be computed from scale matrix and dof.
Even though scipy.stats
provide a bunch of random variables, the multivariate t and Gaussian mixtures are missing! Might use them though.
Open Questions
(x, y, z)
. What if my problem is in 2D? This will require separate classes, because of Jacobians. 3D radar model has different Jacobian than 2D.par_fcn()
has no use, probably. Dependence of transition model parameters on time can be coded into dyn_fcn()
anyway.utils.py
as a function.
Additional considerations
This issue started because of the following. Storage and passing of the SSM specifications. For example, currently CoordinatedTurnRadar
class contains definitions of initial conditions and noise statistics in its __init__()
, which I think is rather strange. The class should define both SSM functions and optionally also their Jacobians, and that's it. All the specs and statistics should be passed into the __init__()
in the form of a dictionary (with predefined keys) on case by case basis depending on how each experiment is set up. This, of course, applies to all SSMs!
On the other hand, for ReentryVehicleRadarTracking
it's very sensible to specify default values inside the initializer, because these values are highly specific and must make physical sense.
Solution
Break down the SSM concept into process model and measurement model, which effectively amounts to splitting the StateSpaceModel
class into base classes TransitionModel
and MeasurementModel
.
TransitionModel
class responsibilities
MeasurementModel
class responsibilities:
This division will have the following effects:
TransitionModel
and MeasurementModel
classes passed to the StateSpaceInference
initializer (instead of the StateSpaceModel
object)StateSpaceInference
will have to be reworked; GaussianInference
, will probably still be retaineddynsys.py
module will probably not be necessarymeas_eval()
will have to pickout state dimensions using a optionally supplied list of indices where the relevant components of state vector are. For example: if state if x = [px, vx, py, vy, theta]
and the measurement function is code with the assumption that x[0]=px
and x[1]=py
, then the supplied list should be [0, 2]
, because px
is at x[0]
and py
is at x[2]
. So the real input to MF is then [x[0], x[2]]
.
Problem with
StateSpaceModel
classThe class represents a too coarse a concept, which brings complications. Every time the process or measurement model changes, a new derived class of
StateSpaceModel
needs to be defined, which leads to combinatorial explosion of classes. For example, constant velocity model can be paired with any number of measurement models (range, bearing, range rate, any combination of these or any other).TODO list
TransitionModel
MeasurementModel
RandomVariable
and related sub-classes.TransitionModel
andMeasurementModel
meas_eval()
input,dim_in
independent of the transition model, change indexes ofx
inmeas_fcn()
implementations to reflect these changes.TransitionModel
and its sub-classesMeasurementModel
and its sub-classes