Models
- class stonesoup.models.base.Model[source]
Bases:
BaseModel type
Base/Abstract class for all models.
- abstract function(state: State, noise: bool | ndarray = False, **kwargs) StateVector | StateVectors[source]
Model function \(f_k(x(k),w(k))\)
- Parameters:
state (State) – An input state
noise (
numpy.ndarrayor bool) – An externally generated random process noise sample (the default is False, in which case no noise will be added if ‘True’, the output ofrvs()is used)
- Returns:
The StateVector(s) with the model function evaluated.
- Return type:
StateVectororStateVectors
- jacobian(state, **kwargs)[source]
Model jacobian matrix \(H_{jac}\)
- Parameters:
state (
State) – An input state- Returns:
The model jacobian matrix evaluated around the given state vector.
- Return type:
numpy.ndarrayof shape (ndim_meas,ndim_state)
- abstract rvs(num_samples: int = 1, **kwargs) StateVector | StateVectors[source]
Model noise/sample generation function
Generates noise samples from the model.
- Parameters:
num_samples (scalar, optional) – The number of samples to be generated (the default is 1)
- Returns:
noise – A set of Np samples, generated from the model’s noise distribution.
- Return type:
2-D array of shape (
ndim,num_samples)
- abstract pdf(state1: State, state2: State, **kwargs) Probability | ndarray[source]
Model pdf/likelihood evaluation function
Evaluates the pdf/likelihood of
state1, given the statestate2which is passed tofunction().- Parameters:
- Returns:
The likelihood of
state1, givenstate2- Return type:
ProbabilityorndarrayofProbability
- class stonesoup.models.base.LinearModel[source]
Bases:
ModelLinearModel class
Base/Abstract class for all linear models
- function(state: State, noise: bool | ndarray = False, **kwargs) StateVector | StateVectors[source]
Model linear function \(f_k(x(k),w(k)) = F_k(x_k) + w_k\)
- Parameters:
state (State) – An input state
noise (
numpy.ndarrayor bool) – An externally generated random process noise sample (the default is False, in which case no noise will be added if ‘True’, the output ofrvs()is added)
- Returns:
The StateVector(s) with the model function evaluated.
- Return type:
StateVectororStateVectors
- class stonesoup.models.base.ReversibleModel[source]
Bases:
ModelNon-linear model containing sufficient co-ordinate information such that the linear co-ordinate conversions can be calculated from the non-linear counterparts.
Contains an inverse function which computes the reverse of the relevant linear-to-non-linear function
- abstract inverse_function(detection: Detection, **kwargs) StateVector[source]
Takes in the result of the function and computes the inverse function, returning the initial input of the function.
- Parameters:
detection (
Detection) – Input state (non-linear format)- Returns:
The linear co-ordinates
- Return type:
- class stonesoup.models.base.TimeVariantModel[source]
Bases:
ModelTimeVariantModel class
Base/Abstract class for all time-variant models
- class stonesoup.models.base.TimeInvariantModel[source]
Bases:
ModelTimeInvariantModel class
Base/Abstract class for all time-invariant models
- class stonesoup.models.base.GaussianModel(seed: int | None = None)[source]
Bases:
ModelGaussianModel class
Base/Abstract class for all Gaussian models
- Parameters:
seed (
Optional[int], optional) – Seed for random number generation
- rvs(num_samples: int = 1, random_state=None, **kwargs) StateVector | StateVectors[source]
Model noise/sample generation function
Generates noise samples from the model.
In mathematical terms, this can be written as:
\[v_t \sim \mathcal{N}(0,Q)\]where \(v_t =\)
noiseand \(Q\) =covar.- Parameters:
num_samples (scalar, optional) – The number of samples to be generated (the default is 1)
- Returns:
noise – A set of Np samples, generated from the model’s noise distribution.
- Return type:
2-D array of shape (
ndim,num_samples)
- pdf(state1: State, state2: State, **kwargs) Probability | ndarray[source]
Model pdf/likelihood evaluation function
Evaluates the pdf/likelihood of
state1, given the statestate2which is passed tofunction().In mathematical terms, this can be written as:
\[p = p(y_t | x_t) = \mathcal{N}(y_t; x_t, Q)\]where \(y_t\) =
state_vector1, \(x_t\) =state_vector2and \(Q\) =covar.- Parameters:
- Returns:
The likelihood of
state1, givenstate2- Return type:
ProbabilityorndarrayofProbability
- logpdf(state1: State, state2: State, **kwargs) float | ndarray[source]
Model log pdf/likelihood evaluation function
Evaluates the pdf/likelihood of
state1, given the statestate2which is passed tofunction().In mathematical terms, this can be written as:
\[p = p(y_t | x_t) = \mathcal{N}(y_t; x_t, Q)\]where \(y_t\) =
state_vector1, \(x_t\) =state_vector2and \(Q\) =covar.
- abstract covar(**kwargs) CovarianceMatrix[source]
Model covariance