We implemented several different covariance functions (CFs) you can work with. To use GP-regression with these covariance functions it is highly recommended to model the noise of the data in one extra covariance function (pygp.covar.noise.NoiseISOCF) and add this noise CF to the CF you are calculating by putting them all together in one pygp.covar.combinators.SumCF.
For example to use the squared exponential CF with noise:
from pygp.covar import se, noise, combinators
#Feature dimension of the covariance:
dimensions = 1
SECF = se.SEARDCF(dim)
noise = noise.NoiseISOCF()
covariance = combinators.SumCF((SECF,noise))
Each combinator is a covariance function (CF) itself. It combines one or several covariance function(s) into another. For instance, pygp.covar.combinators.SumCF combines all given CFs into one sum; use this class to add noise.
Bases: pygp.covar.covar_base.CovarianceFunction
Sum Covariance function. This function adds up the given CFs and returns the resulting sum.
covars : [pygp.covar.CovarianceFunction]
Covariance functions to sum up.
Get Covariance matrix K with given hyperparameters theta and inputs x1 and x2. The result will be the sum covariance of all covariance functions combined in this sum covariance.
Parameters: See pygp.covar.CovarianceFunction
The partial derivative of the covariance matrix with respect to i-th hyperparameter.
Parameters: See pygp.covar.CovarianceFunction
returns list of dimension indices for covariance functions
return the names of hyperparameters to make identification easier
Bases: pygp.covar.covar_base.CovarianceFunction
Product Covariance function. This function multiplies the given CFs and returns the resulting product.
Parameters:
covars : [CFs of type pygp.covar.CovarianceFunction]
Covariance functions to be multiplied.
Get Covariance matrix K with given hyperparameters theta and inputs x1 and x2. The result will be the product covariance of all covariance functions combined in this product covariance.
Parameters: See pygp.covar.CovarianceFunction
The derivatives of the covariance matrix for the i-th hyperparameter.
Parameters: See pygp.covar.CovarianceFunction
return the names of hyperparameters to make identificatio neasier
Bases: pygp.covar.covar_base.CovarianceFunction
Time Shift Covariance function. This covariance function depicts the time shifts induced by the data and covariance function given and passes the shifted inputs to the covariance function given. To calculate the shifts of the inputs make shure the covariance function passed implements the derivative after the input Kd_dx(theta, x).
covar : CF of type pygp.covar.CovarianceFunction
Covariance function to be used to depict the time shifts.
replicate_indices : [int]
The indices of the respective replicates, corresponding to the inputs. For instance: An input with three replicates:
/ rep1 rep2 rep3 input = [ -1,0,1,2, -1,0,1,2, -1,0,1,2] replicate_indices = [ 0,0,0,0, 1,1,1,1, 2,2,2,2] Thus, the replicate indices represent which inputs correspond to which replicate.
Get Covariance matrix K with given hyperparameters theta and inputs x1 and x2. The result will be the covariance of the covariance function given, calculated on the shifted inputs x1,x2. The shift is determined by the last n_replicate parameters of theta, where n_replicate is the number of replicates this CF conducts.
Parameters:
Others see pygp.covar.CovarianceFunction
Get Covariance matrix K with given hyperparameters theta and inputs x1 and x2. The result will be the covariance of the covariance function given, calculated on the shifted inputs x1,x2. The shift is determined by the last n_replicate parameters of theta, where n_replicate is the number of replicates this CF conducts.
Parameters:
return the names of hyperparameters to make identificatio neasier
This class provides some ready-to-use implemented squared exponential covariance functions (SEs). These SEs do not model noise, so combine them by a pygp.covar.combinators.SumCF or pygp.covar.combinators.ProductCF with the pygp.covar.noise.NoiseISOCF, if you want noise to be modelled by this GP.
Bases: pygp.covar.covar_base.CovarianceFunction
Standart Squared Exponential Covariance function.
Parameters:
The dimension of this SE. For instance a 2D SE has hyperparameters like:
covar_hyper = [Amplitude,1stD Length-Scale, 2ndD Length-Scale]
Optional: The indices of the get_n_dimensions() in the input. For instance the get_n_dimensions() of inputs are in 2nd and 4th dimension dimension_indices would have to be [1,3].
Get Covariance matrix K with given hyperparameters and inputs X=x1 and X`*`=x2.
Parameters: See pygp.covar.CovarianceFunction
Get diagonal of the (squared) covariance matrix.
Parameters: See pygp.covar.CovarianceFunction
The derivatives of the covariance matrix for each hyperparameter, respectively.
Parameters: See pygp.covar.CovarianceFunction
The partial derivative of the covariance matrix with respect to x, given hyperparameters theta.
Parameters: See pygp.covar.CovarianceFunction
return the names of hyperparameters to make identification easier
Return the number of hyperparameters this CF holds.
NoiseCFISO NoiseCFReplicates
Bases: pygp.covar.covar_base.CovarianceFunction
Covariance function for Gaussian observation noise for all datapoints as a whole.
Get Covariance matrix K with given hyperparameters theta and inputs args = X[, X’]. Note that this covariance function will only get noise as hyperparameter!
Parameters: See pygp.covar.CovarianceFunction
The derivative of the covariance matrix with respect to i-th hyperparameter.
Parameters: See pygp.covar.CovarianceFunction
fixed covariance functions Classes for fixed covarinace functions ====================================== FixedCF