spleaf.cov.Cov#
- class spleaf.cov.Cov(t, **kwargs)#
Covariance matrix class.
The covariance is modeled as the sum of different components (or terms), which split into two categories: noise terms and kernel terms (gaussian processes). See the API reference for a list of available terms.
Each component is provided in **kwargs, where the key is user-defined and is used to refer to the term parameters.
The covariance matrix is represented internally as a S+LEAF matrix (see
spleaf.Spleaf).- Parameters:
- t(n,) ndarray
Time of the measurements. This array must be in increasing order.
- **kwargs
Components of the covariance matrix.
- Attributes:
- t(n,) ndarray
See parameters.
- nint
Number of measurements.
- dt(n-1,) ndarray
time between two measurements.
- paramlist,
List of all covariance parameters.
- termdict,
Dictionary of all covariance terms.
- noisedict,
Dictionary of noise terms.
- kerneldict,
Dictionary of kernel terms.
- r, A, U, V, phi, offsetrow, b, F, D, W, G
S+LEAF representation of the covariance matrix (see
spleaf.Spleaf).
Methods
chi2(y)Compute \(\chi^2 = y^T C^{-1} y\) for a given vector of residuals \(y\).
chi2_grad(*args, **kwargs)Compute the gradient of the \(\chi^2\) (
chi2()) with respect to the residuals and to the initial parameters (seegrad_param()).Backward propagation of the gradient for the Cholesky decomposition.
conditional(y, t2[, calc_cov, kernel])Conditional mean and covariance of the kernel part, or a subset of kernel terms, at new times \(t_2\), knowning the observed values \(y\).
conditional_derivative(y, t2[, calc_cov, kernel])Conditional mean and covariance of the derivative of the kernel part, or a subset of kernel terms, at new times \(t_2\), knowning the observed values \(y\).
dotL(x[, copy])Compute \(y = L x\).
dotLT(x[, copy])Compute \(y = L^T x\).
dotLT_back(grad_y)Backward propagation of the gradient for
dotLT().dotL_back(grad_y)Backward propagation of the gradient for
dotL().eval(dt[, kernel])Direct evaluation of the kernel part at lag \(\delta t\).
expand()Expand the matrix as a full (n x n) matrix.
Expand the inverse of the matrix as a full (n x n) matrix.
Expand \(L^{-1}\) as a full (n x n) matrix.
expandL()Expand \(L\) as a full (n x n) matrix.
get_param([param])Get the values of the parameters.
grad_param([param])Gradient of a function with respect to the parameters, after a call to
cholesky_back().Initialize (or reinitialize) the backward propagation of the gradient.
logdet()Compute the (natural) logarithm of the determinant of the matrix.
loglike(y)Compute the (natural) logarithm of the likelihood for a given vector of residuals \(y\).
loglike_grad(*args, **kwargs)Compute the gradient of the log-likelihood (
loglike()) with respect to the residuals and to the initial parameters (seegrad_param()).sample([nreal])Generate random samples from the covariance matrix.
self_conditional(y[, calc_cov, kernel])Conditional mean and covariance of the kernel part, or a subset of kernel terms, knowning the observed values \(y\).
self_conditional_derivative(y[, calc_cov, ...])Conditional mean and covariance of the derivative of the kernel part, or a subset of kernel terms, knowning the observed values \(y\).
set_param(value[, param])Set the values of the parameters.
solveL(y[, copy])Solve for \(x = L^{-1} y\).
solveLT(y[, copy])Solve for \(x = L^{-T} y\).
solveLT_back(grad_x)Backward propagation of the gradient for
solveLT().solveL_back(grad_x)Backward propagation of the gradient for
solveL().sqD()Compute the square-root of D.