runlmc.mean.constant module

class runlmc.mean.constant.Constant(input_dim, output_dim, c0=None, name='constant')[source]

Bases: runlmc.mean.mean_function.MeanFunction

The constant mapping (constant for each output).

This mean function is not useful with normalization activated.

It may be useful if you would like to have no normalization and want to impose priors on the mean adjustment.

Parameters:
  • input_dim
  • output_dim
  • c0 – optional vector of length output_dim for the initial offsets that the constant takes on.
f(Xs)[source]

Evaluation of the mean function \(f\).

Returns:
mean_gradient(Xs)[source]

Let this mean be parameterized by some parameters \(\boldsymbol\theta\in\mathbb{R}^p\). For every \(\theta_j\in\boldsymbol\theta\), at each input point \(\textbf{x}^{(i)}\) (for a certain output index \(i\)), we can compute the derivative \(\partial_{\theta_j}f(\textbf{x}^{(i)})\). For the evaluation of this partial derivative at multiple places, \(\textbf{X}\), we call the list of vectors of partial derivatives \(\partial_{\theta_j}f(\textbf{X})\) (a list with one vector per output index).

Parameters:Xs – inputs to evaluate at
Returns:A list of parameter gradients; the \(j\)-th entry of this list is \(\partial_{\theta_j}f(\textbf{X})\). Each \(\partial_{\theta_j}f(\textbf{X})\) in turn is another list with one entry per output \(i\); the \(i\)-th entry is a one-dimensional numpy array with \(k\)-th entry the derivative of the \(j\)-th mean parameter at the \(k\)-th input for the \(i\)-th output, \(\partial_{\theta_j}f(\textbf{x}^{(i)}_k)\).
update_gradient(grad)[source]
Parameters:grad – a one-dimensional array, representing the gradient vector \(\nabla_{\boldsymbol\theta}L\) for the likelihood with respect to this mean’s parameters, in the same order of parameters as the row order returned by mean_gradient().