RandomProcess

class probnum.randprocs.RandomProcess(input_shape, output_shape, dtype, mean=None, cov=None)

Bases: Generic[InputType, OutputType], ABC

Random processes represent uncertainty about a function.

Random processes generalize functions by encoding uncertainty over function values in their covariance function. They can be used to model (deterministic) functions which are not fully known or to define functions with stochastic output.

Parameters:
  • input_shape – Input shape of the random process.

  • output_shape – Output shape of the random process.

  • dtype – Data type of the random process evaluated at an input. If object will be converted to numpy.dtype.

  • mean – Mean function of the random process.

  • cov – Covariance function of the random process.

See also

RandomVariable

Random variables.

GaussianProcess

Gaussian processes.

MarkovProcess

Random processes with the Markov property.

Notes

Random processes are assumed to have an (un-/countably) infinite domain. Random processes with a finite index set are represented by RandomVariable.

Attributes Summary

cov

Covariance function \(k(x_0, x_1)\) of the random process.

dtype

Data type of (elements of) the random process evaluated at an input.

input_ndim

Syntactic sugar for len(input_shape).

input_shape

Shape of inputs to the random process.

mean

Mean function \(m(x) := \mathbb{E}[f(x)]\) of the random process.

output_ndim

Syntactic sugar for len(output_shape).

output_shape

Shape of the random process evaluated at an input.

Methods Summary

__call__(args)

Evaluate the random process at a set of input arguments.

marginal(args)

Batch of random variables defining the marginal distributions at the inputs.

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

cov

Covariance function \(k(x_0, x_1)\) of the random process.

\begin{equation} k(x_0, x_1) := \mathbb{E} \left[ (f(x_0) - \mathbb{E}[f(x_0)]) (f(x_1) - \mathbb{E}[f(x_1)])^\top \right] \end{equation}
Raises:

NotImplementedError – If no covariance function was assigned to the random process.

dtype

Data type of (elements of) the random process evaluated at an input.

input_ndim

Syntactic sugar for len(input_shape).

input_shape

Shape of inputs to the random process.

mean

Mean function \(m(x) := \mathbb{E}[f(x)]\) of the random process.

Raises:

NotImplementedError – If no mean function was assigned to the random process.

output_ndim

Syntactic sugar for len(output_shape).

output_shape

Shape of the random process evaluated at an input.

Methods Documentation

abstract __call__(args)[source]

Evaluate the random process at a set of input arguments.

Parameters:

args (InputType) – shape= batch_shape + input_shape – (Batch of) input(s) at which to evaluate the random process. Currently, we require batch_shape to have at most one dimension.

Returns:

shape= batch_shape + output_shape – Random process evaluated at the input(s).

Return type:

randvars.RandomVariable

marginal(args)[source]

Batch of random variables defining the marginal distributions at the inputs.

Parameters:

args (InputType) – shape= batch_shape + input_shape – (Batch of) input(s) at which to evaluate the random process. Currently, we require batch_shape to have at most one dimension.

Return type:

randvars._RandomVariableList

push_forward(args, base_measure, sample)[source]

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.

Parameters:
  • args (InputType) – Input arguments.

  • base_measure (Type[RandomVariable]) – Base measure. Given as a type of random variable.

  • sample (ndarray) – shape= sample_shape + input_shape – (Batch of) input(s) at which to evaluate the random process. Currently, we require sample_shape to have at most one dimension.

Return type:

ndarray

sample(rng, args=None, size=())[source]

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 (InputType | None) – shape= size + input_shape – (Batch of) input(s) at which the sample paths will be evaluated. Currently, we require size to have at most one dimension. If None, sample paths, i.e. callables are returned.

  • size (ShapeLike) – Size of the sample.

Raises:

NotImplementedError – General path sampling is currently not supported.

Return type:

Callable[[InputType], OutputType] | OutputType

std(args)[source]

Standard deviation function.

Parameters:

args (InputType) – shape= batch_shape + input_shape – (Batch of) input(s) at which to evaluate the standard deviation function.

Returns:

shape= batch_shape + output_shape – Standard deviation of the process at args.

Return type:

OutputType

var(args)[source]

Variance function.

Returns the variance function which is the value of the covariance function evaluated elementwise at args for each output dimension separately.

Parameters:

args (InputType) – shape= batch_shape + input_shape – (Batch of) input(s) at which to evaluate the variance function.

Returns:

shape= batch_shape + output_shape – Variance of the process at args.

Return type:

OutputType