TransportMaps.Distributions.Examples.StochasticVolatility.StocVolHyperDistributions
¶
Module Contents¶
Classes¶
Abstract class for functions \(f:\mathbb{R}^d\rightarrow\mathbb{R}\). |
|
Abstract class for functions \(f:\mathbb{R}^d\rightarrow\mathbb{R}\). |
|
Distribution \(\pi(\mu, \sigma, \phi)\) |
|
Conditional distribution \(\pi({\bf X}_{t_0}\vert \mu, \sigma, \phi)\) |
|
Transition distribution \(\pi({\bf X}_{t_{k+1}}\vert {\bf X}_{t_{k}}, \mu, \sigma, \phi)\) |
|
Abstract class for log-likelihood \(\log \pi({\bf y}_t \vert {\bf X}_t), \mu, \phi, \sigma\) |
|
Distribution of a Hidden Markov chain model (optionally with hyper-parameters) |
Functions¶
|
|
|
- class TransportMaps.Distributions.Examples.StochasticVolatility.StocVolHyperDistributions.F_phi(mean, std)[source]¶
Bases:
object
- class TransportMaps.Distributions.Examples.StochasticVolatility.StocVolHyperDistributions.F_sigma(k, theta)[source]¶
Bases:
object
- class TransportMaps.Distributions.Examples.StochasticVolatility.StocVolHyperDistributions.ConstantFunction(constant)[source]¶
Bases:
TransportMaps.Maps.Functionals.Functional
Abstract class for functions \(f:\mathbb{R}^d\rightarrow\mathbb{R}\).
- evaluate(x)[source]¶
[Abstract] Evaluate \(f_{\bf a}\) at
x
.- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsprecomp (
dict
) – dictionary of precomputed valuesidxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.cache (
dict
) – cache
- Returns:
(
ndarray
[\(m,1\)]) – function evaluations
- grad_x(x)[source]¶
[Abstract] Evaluate \(\nabla_{\bf x} f_{\bf a}\) at
x
.- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsprecomp (
dict
) – dictionary of precomputed valuesidxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.cache (
dict
) – cache
- Returns:
- (
ndarray
[\(m,1,d\)]) – \(\nabla_{\bf x} f_{\bf a}({\bf x})\)
- (
- hess_x(x)[source]¶
[Abstract] Evaluate the Hessian \(\nabla^2_{\bf x}T\) at the points \({\bf x} \in \mathbb{R}^{m \times d_x}\).
- Parameters:
- Returns:
(
ndarray
[\(m,d_y,d_x,d_x\)]) – transformed points- Raises:
NotImplementedError – to be implemented in sub-classes
- class TransportMaps.Distributions.Examples.StochasticVolatility.StocVolHyperDistributions.IdentityFunction[source]¶
Bases:
TransportMaps.Maps.Functionals.Functional
Abstract class for functions \(f:\mathbb{R}^d\rightarrow\mathbb{R}\).
- evaluate(x)[source]¶
[Abstract] Evaluate \(f_{\bf a}\) at
x
.- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsprecomp (
dict
) – dictionary of precomputed valuesidxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.cache (
dict
) – cache
- Returns:
(
ndarray
[\(m,1\)]) – function evaluations
- grad_x(x)[source]¶
[Abstract] Evaluate \(\nabla_{\bf x} f_{\bf a}\) at
x
.- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsprecomp (
dict
) – dictionary of precomputed valuesidxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.cache (
dict
) – cache
- Returns:
- (
ndarray
[\(m,1,d\)]) – \(\nabla_{\bf x} f_{\bf a}({\bf x})\)
- (
- hess_x(x)[source]¶
[Abstract] Evaluate the Hessian \(\nabla^2_{\bf x}T\) at the points \({\bf x} \in \mathbb{R}^{m \times d_x}\).
- Parameters:
- Returns:
(
ndarray
[\(m,d_y,d_x,d_x\)]) – transformed points- Raises:
NotImplementedError – to be implemented in sub-classes
- class TransportMaps.Distributions.Examples.StochasticVolatility.StocVolHyperDistributions.PriorHyperParameters(is_mu_hyper=False, is_sigma_hyper=False, is_phi_hyper=False, sigma_mu=None)[source]¶
Bases:
TransportMaps.Distributions.FrozenDistributions.NormalDistribution
Distribution \(\pi(\mu, \sigma, \phi)\)
Here \(\mu \sim \mathcal{N}(0,\sigma^2_\mu)\), \(\phi \sim \mathcal{N}(0,1)\) and \(\sigma \sim \mathcal{N}(0,1)\), if they are to be considered hyper-parameters.
- class TransportMaps.Distributions.Examples.StochasticVolatility.StocVolHyperDistributions.PriorDynamicsInitialConditions(is_mu_hyper=False, mu=None, is_sigma_hyper=False, sigma=None, is_phi_hyper=False, phi=None)[source]¶
Bases:
TransportMaps.Distributions.ConditionalDistributionBase.ConditionalDistribution
Conditional distribution \(\pi({\bf X}_{t_0}\vert \mu, \sigma, \phi)\)
- Parameters:
- log_pdf(x, y, cache=None, **kwargs)[source]¶
[Abstract] Evaluate \(\log \pi({\bf x}\vert{\bf y})\)
- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsy (
ndarray
[\(m,d_y\)]) – conditioning values \({\bf Y}={\bf y}\)params (dict) – parameters
idxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.
- Returns:
- (
ndarray
[\(m\)]) – values of \(\log\pi\) at the
x
points.
- (
- Raises:
NotImplementedError – the method needs to be defined in the sub-classes
- grad_x_log_pdf(x, y, cache=None, **kwargs)[source]¶
[Abstract] Evaluate \(\nabla_{\bf x,y} \log \pi({\bf x}\vert{\bf y})\)
- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsy (
ndarray
[\(m,d_y\)]) – conditioning values \({\bf Y}={\bf y}\)params (dict) – parameters
idxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.
- Returns:
- (
ndarray
[\(m,d\)]) – values of \(\nabla_x\log\pi\) at the
x
points.
- (
- Raises:
NotImplementedError – the method needs to be defined in the sub-classes
- hess_x_log_pdf(x, y, cache=None, **kwargs)[source]¶
[Abstract] Evaluate \(\nabla^2_{\bf x,y} \log \pi({\bf x}\vert{\bf y})\)
- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsy (
ndarray
[\(m,d_y\)]) – conditioning values \({\bf Y}={\bf y}\)params (dict) – parameters
idxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.
- Returns:
- (
ndarray
[\(m,d,d\)]) – values of \(\nabla^2_x\log\pi\) at the
x
points.
- (
- Raises:
NotImplementedError – the method needs to be defined in the sub-classes
- class TransportMaps.Distributions.Examples.StochasticVolatility.StocVolHyperDistributions.PriorDynamicsTransition(is_mu_hyper=False, mu=None, is_sigma_hyper=False, sigma=None, is_phi_hyper=False, phi=None)[source]¶
Bases:
TransportMaps.Distributions.ConditionalDistributionBase.ConditionalDistribution
Transition distribution \(\pi({\bf X}_{t_{k+1}}\vert {\bf X}_{t_{k}}, \mu, \sigma, \phi)\)
- Parameters:
- log_pdf(x, y, cache=None, **kwargs)[source]¶
[Abstract] Evaluate \(\log \pi({\bf x}\vert{\bf y})\)
- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsy (
ndarray
[\(m,d_y\)]) – conditioning values \({\bf Y}={\bf y}\)params (dict) – parameters
idxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.
- Returns:
- (
ndarray
[\(m\)]) – values of \(\log\pi\) at the
x
points.
- (
- Raises:
NotImplementedError – the method needs to be defined in the sub-classes
- grad_x_log_pdf(x, y, cache=None, **kwargs)[source]¶
[Abstract] Evaluate \(\nabla_{\bf x,y} \log \pi({\bf x}\vert{\bf y})\)
- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsy (
ndarray
[\(m,d_y\)]) – conditioning values \({\bf Y}={\bf y}\)params (dict) – parameters
idxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.
- Returns:
- (
ndarray
[\(m,d\)]) – values of \(\nabla_x\log\pi\) at the
x
points.
- (
- Raises:
NotImplementedError – the method needs to be defined in the sub-classes
- hess_x_log_pdf(x, y, cache=None, **kwargs)[source]¶
[Abstract] Evaluate \(\nabla^2_{\bf x,y} \log \pi({\bf x}\vert{\bf y})\)
- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsy (
ndarray
[\(m,d_y\)]) – conditioning values \({\bf Y}={\bf y}\)params (dict) – parameters
idxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.
- Returns:
- (
ndarray
[\(m,d,d\)]) – values of \(\nabla^2_x\log\pi\) at the
x
points.
- (
- Raises:
NotImplementedError – the method needs to be defined in the sub-classes
- class TransportMaps.Distributions.Examples.StochasticVolatility.StocVolHyperDistributions.LogLikelihood(y, is_mu_hyper=False, is_sigma_hyper=False, is_phi_hyper=False)[source]¶
Bases:
TransportMaps.Likelihoods.LikelihoodBase.LogLikelihood
Abstract class for log-likelihood \(\log \pi({\bf y}_t \vert {\bf X}_t), \mu, \phi, \sigma\)
where, up to integration constants,
\[\log\pi({\bf y}_t \vert {\bf X}_t, \mu, \phi, \sigma) = - \frac{1}{2}({\bf y}_t^2 \exp(-{\bf X}_t))\]- Parameters:
- class TransportMaps.Distributions.Examples.StochasticVolatility.StocVolHyperDistributions.StocVolHyperDistribution(is_mu_hyper=False, is_sigma_hyper=False, is_phi_hyper=False, mu=None, sigma=None, phi=None, mu_sigma=1.0, sigma_k=1.0, sigma_theta=0.1, phi_mean=3.0, phi_std=1.0)[source]¶
-
Distribution of a Hidden Markov chain model (optionally with hyper-parameters)
For the index sets \(A=[t_0,\ldots,t_k]\) with \(t_0<t_1<\ldots <t_k\), \(B \subseteq A\), the user defined transition densities (
Distribution
) \(\{\pi({\bf Z}_{t_0}\vert\Theta), \pi({\bf Z}_{1}\vert{\bf Z}_{t_{0}},\Theta), \ldots \}\), the prior \(\pi(\Theta)\) and the log-likelihoods (LogLikelihood
) \(\{\log\mathcal{L}({\bf y}_t \vert{\bf Z}_t,\Theta)\}_{t\in B}\), defines the distribution\[\pi(\Theta, {\bf Z}_A \vert {\bf y}_B) = \left( \prod_{t\in B} \mathcal{L}(t; {\bf y}_t \vert {\bf Z}_t, \Theta) \right) \pi({\bf Z}_{t_0},\ldots,{\bf Z}_{t_k},\Theta)\]associated to the process \({\bf Z}_A\), where \(\pi({\bf Z}_{t_0},\ldots,{\bf Z}_{t_k},\Theta)\) is Markov chain distribution.
Note
Each of the log-likelihoods already embed its own data \({\bf y}_t\). The list of log-likelihoods must be of the same length of the list of transitions. Missing data are simulated by setting the corresponding entry in the list of log-likelihood to
None
.- Parameters:
pi_markov (
MarkovChainDistribution
) – Markov chain distribution describing \(\pi({\bf Z}_{t_0},\ldots,{\bf Z}_{t_k},\Theta)\)ll_list (
list
ofLogLikelihood
) – list of log-likelihoods \(\{\log\mathcal{L}({\bf y}_t \vert {\bf Z}_t,\Theta)\}_{t\in B}\)
- action_hess_x_log_pdf(x, dx, cache=None, **kwargs)[source]¶
Evaluate \(\langle\nabla^2_{\bf x} \log \pi({\bf x}\vert{\bf y}), \delta{\bf x}\rangle\)
- Parameters:
x (
ndarray
[\(m,d\)]) – evaluation pointsdx (
ndarray
[\(m,d\)]) – direction on which to evaluate the Hessianidxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by
idxs_slice
must matchx.shape[0]
.cache (dict) – cache
- Returns:
- (
ndarray
[\(m,d\)]) – values of \(\langle\nabla^2_{\bf x} \log \pi({\bf x}\vert{\bf y}), \delta{\bf x}\rangle\) at the
x
points.
- (