bayespy.nodes.SwitchingGaussianMarkovChain
-
class bayespy.nodes.SwitchingGaussianMarkovChain(mu, Lambda, B, Z, nu, n=None, **kwargs)[source]
Node for Gaussian Markov chain random variables with switching dynamics.
The node models a sequence of Gaussian variables
:math:`mathbf{x}_0,ldots,mathbf{x}_{N-1}$ with linear Markovian dynamics.
The dynamics may change in time, which is obtained by having a set of
matrices and at each time selecting one of them as the state dynamics
matrix. The graphical model can be presented as:
where and are the mean and
the precision matrix of the initial state, is the
precision of the innovation noise, and are the state
dynamics matrix obtained by selecting one of the matrices
at each time. The selections are
provided by . The probability distribution is
where
- Parameters:
mu (Gaussian-like node or (...,D)-array) – , mean of , -dimensional
with plates (…)
Lambda (Wishart-like node or (...,D,D)-array) – , precision matrix of ,
-dimensional with plates (…)
B (Gaussian-like node or (...,D,D,K)-array) – , a set of state dynamics matrix,
-dimensional with plates (…,D)
Z (categorical-like node or (...,N-1)-array) – , time-dependent selection,
-categorical with plates (…,N-1)
nu (gamma-like node or (...,D)-array) – , diagonal elements of the precision of the
innovation process, plates (…,D)
n (int, optional) – , the length of the chain. Must be given if
does not have plates over the time domain (which would not make sense).
Notes
Equivalent model block can be constructed with GaussianMarkovChain
by explicitly using Gate
to select the state dynamics matrix.
However, that approach is not very efficient for large datasets because it
does not utilize the structure of , thus it explicitly
computes huge moment arrays.
-
__init__(mu, Lambda, B, Z, nu, n=None, **kwargs)[source]
Create SwitchingGaussianMarkovChain node.
Methods
__init__ (mu, Lambda, B, Z, nu[, n])
|
Create SwitchingGaussianMarkovChain node. |
add_plate_axis (to_plate)
|
|
broadcasting_multiplier (plates, *args)
|
|
delete ()
|
Delete this node and the children |
get_gradient (rg)
|
Computes gradient with respect to the natural parameters. |
get_mask ()
|
|
get_moments ()
|
|
get_parameters ()
|
Return parameters of the VB distribution. |
get_pdf_nodes ()
|
|
get_riemannian_gradient ()
|
Computes the Riemannian/natural gradient. |
get_shape (ind)
|
|
has_plotter ()
|
Return True if the node has a plotter |
initialize_from_parameters (*args)
|
|
initialize_from_prior ()
|
|
initialize_from_random ()
|
Set the variable to a random sample from the current distribution. |
initialize_from_value (x, *args)
|
|
load (filename)
|
|
logpdf (X[, mask])
|
Compute the log probability density function Q(X) of this node. |
lower_bound_contribution ([gradient, ...])
|
Compute E[ log p(X|parents) - log q(X) ] |
lowerbound ()
|
|
move_plates (from_plate, to_plate)
|
|
observe (x, *args[, mask])
|
Fix moments, compute f and propagate mask. |
pdf (X[, mask])
|
Compute the probability density function of this node. |
plot ([fig])
|
Plot the node distribution using the plotter of the node |
random (*phi[, plates])
|
Draw a random sample from the distribution. |
save (filename)
|
|
set_parameters (x)
|
Set the parameters of the VB distribution. |
set_plotter (plotter)
|
|
show ()
|
Print the distribution using standard parameterization. |
unobserve ()
|
|
update ([annealing])
|
|
Attributes