IntegratedWienerProcess¶
- class probnum.randprocs.markov.integrator.IntegratedWienerProcess(initarg, num_derivatives=1, wiener_process_dimension=1, initrv=None, diffuse=False, forward_implementation='classic', backward_implementation='classic')¶
Bases:
probnum.randprocs.markov.MarkovProcess
Integrated Wiener process.
Convenience access to \(\nu\) times integrated (\(d\) dimensional) Wiener processes.
- Parameters
initarg – Initial time point.
num_derivatives – Number of modelled derivatives of the integrated process (‘’order’’, ‘’number of integrations’’). Optional. Default is \(\nu=1\).
wiener_process_dimension – Dimension of the underlying Wiener process. Optional. Default is \(d=1\). The dimension of the integrated Wiener process itself is \(d(\nu + 1)\).
initrv – Law of the integrated Wiener process at the initial time point. Optional. Default is a \(d(\nu + 1)\) dimensional standard-normal distribution.
diffuse – Whether to instantiate a diffuse prior. A diffuse prior has large initial variances. Optional. Default is False. If True, and if an initial random variable is not passed, an initial random variable is created, where the initial covariance is of the form \(\kappa I_{d(\nu + 1)}\) with \(\kappa=10^6\). Diffuse priors are used when initial distributions are not known. They are common for filtering-based probabilistic ODE solvers.
forward_implementation – Implementation of the forward-propagation in the underlying transitions. Optional. Default is classic. sqrt implementation is more computationally expensive, but also more stable.
backward_implementation – Implementation of the backward-conditioning in the underlying transitions. Optional. Default is classic. sqrt implementation is more computationally expensive, but also more stable.
- Raises
Warning – If initrv is not None and diffuse is True.
Examples
>>> iwp1 = IntegratedWienerProcess(initarg=0.) >>> print(iwp1) <IntegratedWienerProcess with input_dim=1, output_dim=2, dtype=float64>
>>> iwp2 = IntegratedWienerProcess(initarg=0., num_derivatives=2) >>> print(iwp2) <IntegratedWienerProcess with input_dim=1, output_dim=3, dtype=float64>
>>> iwp3 = IntegratedWienerProcess(initarg=0., wiener_process_dimension=10) >>> print(iwp3) <IntegratedWienerProcess with input_dim=1, output_dim=20, dtype=float64>
>>> iwp4 = IntegratedWienerProcess(initarg=0., num_derivatives=4, wiener_process_dimension=1) >>> print(iwp4) <IntegratedWienerProcess with input_dim=1, output_dim=5, dtype=float64>
Attributes Summary
Data type of (elements of) the random process evaluated at an input.
Shape of inputs to the random process.
Shape of the random process evaluated at an input.
Methods Summary
__call__
(args)Evaluate the random process at a set of input arguments.
cov
(args0[, args1])Covariance function or kernel.
covmatrix
(args0[, args1])A convenience function for the covariance matrix of two sets of inputs.
marginal
(args)Batch of random variables defining the marginal distributions at the inputs.
mean
(args)Mean function.
push_forward
(args, base_measure, sample)Transform samples from a base measure into samples from the random process.
sample
(rng[, args, size])Sample paths from the random process.
std
(args)Standard deviation function.
var
(args)Variance function.
Attributes Documentation
Methods Documentation
- __call__(args)¶
Evaluate the random process at a set of input arguments.
- cov(args0, args1=None)¶
Covariance function or kernel.
Returns the covariance function \(\operatorname{Cov}(f(x_0), f(x_1)) = \mathbb{E}[(f(x_0) - \mathbb{E}[f(x_0)])(f(x_0) - \mathbb{E}[f( x_0)])^\top]\) of the process evaluated at \(x_0\) and \(x_1\). If only
args0
is given the covariance among the components of the random process at the inputs defined byargs0
is computed.- Parameters
- Returns
shape=(), (output_dim, output_dim), (n0, n1) or (n0, n1, output_dim, output_dim) – Covariance of the process at
args0
andargs1
. If onlyargs0
is given the kernel matrix \(K=k(x_0, x_0)\) is computed.- Return type
_OutputType
- covmatrix(args0, args1=None)¶
A convenience function for the covariance matrix of two sets of inputs.
This is syntactic sugar for
proc.cov(x0[:, None, :], x1[None, :, :])
. Hence, it computes the matrix of pairwise covariances between two sets of input points.- Parameters
x0 (array-like) – First set of inputs to the covariance function as an array of shape
(M, D)
, whereD
is either 1 orinput_dim
.x1 (array-like) – Optional second set of inputs to the covariance function as an array of shape
(N, D)
, whereD
is either 1 orinput_dim
. Ifx1
is not specified, the function behaves as ifx1 = x0
.
- Returns
kernmat – The matrix / stack of matrices containing the pairwise evaluations of the covariance function(s) on
x0
andx1
as an array of shape(M, N)
ifshape
is()
or(S[l - 1], ..., S[1], S[0], M, N)
, whereS
isshape
ifshape
is non-empty.- Return type
- Raises
ValueError – If the shapes of the inputs don’t match the specification.
See also
RandomProcess.cov
Evaluate the kernel more flexibly.
Examples
See documentation of class
Kernel
.
- marginal(args)¶
Batch of random variables defining the marginal distributions at the inputs.
- Parameters
args (~InputType) – shape=(input_dim,) or (n, input_dim) – Input(s) to evaluate random process at.
- Return type
- mean(args)¶
Mean function.
Returns the mean function evaluated at the given input(s).
- push_forward(args, base_measure, sample)¶
Transform samples from a base measure into samples from the random process.
This function can be used to control sampling from the random process by explicitly passing samples from a base measure evaluated at the input arguments.
- sample(rng, args=None, size=())¶
Sample paths from the random process.
If no inputs are provided this function returns sample paths which are callables, otherwise random variables corresponding to the input locations are returned.
- Parameters
rng (
Generator
) – Random number generator.args (
Optional
[~InputType]) – shape=(input_dim,) or (n, input_dim) – Evaluation input(s) of the sample paths of the process. IfNone
, sample paths, i.e. callables are returned.size (
Union
[int
,Integral
,integer
,Iterable
[Union
[int
,Integral
,integer
]]]) – Size of the sample.
- Return type
- std(args)¶
Standard deviation function.
- Parameters
args (~InputType) – shape=(input_dim,) or (n, input_dim) – Input(s) to the standard deviation function.
- Returns
shape=(), (output_dim,) or (n, output_dim) – Standard deviation of the process at
args
.- Return type
_OutputType
- var(args)¶
Variance function.
Returns the variance function which is the value of the covariance or kernel evaluated elementwise at
args
for each output dimension separately.- Parameters
args (~InputType) – shape=(input_dim,) or (n, input_dim) – Input(s) to the variance function.
- Returns
shape=(), (output_dim,) or (n, output_dim) – Variance of the process at
args
.- Return type
_OutputType