skgpuppy.Covariance module¶
-
class
skgpuppy.Covariance.
Covariance
¶ Bases:
object
Superclass for all covariance functions
-
cov_matrix
(x, theta)¶ Parameters: - x – list of d-dimensional vectors of size N
- theta – hyperparameters
Returns: NxN covariance matrix
-
cov_matrix_ij
(xi, xj, theta)¶ Parameters: - xi – list of d-dimensional vectors of size N1
- xj – list of d-dimensional vectors of size N2
- theta – hyperparameters
Returns: N1xN2 covariance matrix between xi and xj
-
get_Hessian
(u, xi, theta)¶ Get the Hessian of the covariance function with respect to u
Parameters: - u – d-dimensional vector
- xi – d-dimensional vector
- theta – hyperparameters
Returns: Hessian
-
get_Jacobian
(u, xi, theta)¶ Get the Jacobian of the covariance function with respect to u
Parameters: - u – d-dimensional vector
- xi – d-dimensional vector
- theta – hyperparameters
Returns: Jacobian
-
get_theta
(x, t)¶ Guesses the initial theta vector for the hyperparameter optimization step
Returns: initial theta vector
-
inv_cov_matrix
(x, theta, cov_matrix=None)¶ Parameters: - x – list of d-dimensional vectors
- theta – hyperparameters
- cov_matrix – invert this precalculated cov matrix for x and theta
Returns: inverse of the covariance matrix
-
ml_estimate
(x, t)¶ Parameters: - x – list of d-dimensional vectors
- t – list of responses
Returns: maximum likelihood estimate for theta
-
-
class
skgpuppy.Covariance.
Dot
¶ Bases:
object
A class to inspect the matrix multiplication complexity
-
reset
()¶ Reset the gathered statistics
-
-
class
skgpuppy.Covariance.
GaussianCovariance
¶ Bases:
skgpuppy.Covariance.Covariance
The classic Gaussian squared exponential covariance function. Suitable to approximate smooth functions.
-
cov_matrix
(x, theta)¶
-
cov_matrix_ij
(xi, xj, theta)¶
-
get_Hessian
(u, xi, theta)¶
-
get_Jacobian
(u, xi, theta)¶
-
get_theta
(x, t)¶
-
inv_cov_matrix
(x, theta, cov_matrix=None)¶ Parameters: - x – list of d-dimensional vectors
- theta – hyperparameters
- cov_matrix – invert this precalculated cov matrix for x and theta
Returns: inverse of the covariance matrix
-
ml_estimate
(x, t)¶ Parameters: - x – list of d-dimensional vectors
- t – list of responses
Returns: maximum likelihood estimate for theta
-
-
class
skgpuppy.Covariance.
PeriodicCovariance
¶ Bases:
skgpuppy.Covariance.Covariance
A class to represent a mixed Gaussian and periodic covariance.
Warning
No derivatives for uncertainty propagation and faster hyperparameter optimization implemented yet.
-
cov_matrix
(x, theta)¶ Parameters: - x – list of d-dimensional vectors of size N
- theta – hyperparameters
Returns: NxN covariance matrix
-
cov_matrix_ij
(xi, xj, theta)¶ Parameters: - xi – list of d-dimensional vectors of size N1
- xj – list of d-dimensional vectors of size N2
- theta – hyperparameters
Returns: N1xN2 covariance matrix between xi and xj
-
get_Hessian
(u, xi, theta)¶ Get the Hessian of the covariance function with respect to u
Parameters: - u – d-dimensional vector
- xi – d-dimensional vector
- theta – hyperparameters
Returns: Hessian
-
get_Jacobian
(u, xi, theta)¶ Get the Jacobian of the covariance function with respect to u
Parameters: - u – d-dimensional vector
- xi – d-dimensional vector
- theta – hyperparameters
Returns: Jacobian
-
get_theta
(x, t)¶
-
inv_cov_matrix
(x, theta, cov_matrix=None)¶ Parameters: - x – list of d-dimensional vectors
- theta – hyperparameters
- cov_matrix – invert this precalculated cov matrix for x and theta
Returns: inverse of the covariance matrix
-
ml_estimate
(x, t)¶ Parameters: - x – list of d-dimensional vectors
- t – list of responses
Returns: maximum likelihood estimate for theta
-
-
class
skgpuppy.Covariance.
SPGPCovariance
(m)¶ Bases:
skgpuppy.Covariance.Covariance
A covariance function for fast matrix inversion on large datasets based on Snelsons thesis.
Snelson, E. L. Flexible and efficient Gaussian process models for machine learning, Gatsby Computational Neuroscience Unit, University College London, 2007
Warning
No derivatives for uncertainty propagation implemented yet.
Warning
Not as efficient as it should be.
-
cov_matrix
(x, theta)¶
-
cov_matrix_ij
(xi, xj, theta)¶
-
get_Hessian
(u, xi, theta)¶ Get the Hessian of the covariance function with respect to u
Parameters: - u – d-dimensional vector
- xi – d-dimensional vector
- theta – hyperparameters
Returns: Hessian
-
get_Jacobian
(u, xi, theta)¶ Get the Jacobian of the covariance function with respect to u
Parameters: - u – d-dimensional vector
- xi – d-dimensional vector
- theta – hyperparameters
Returns: Jacobian
-
get_theta
(x, t)¶
-
inv_cov_matrix
(x, theta, cov_matrix=None)¶
-
ml_estimate
(x, t)¶ Parameters: - x – list of d-dimensional vectors
- t – list of responses
Returns: maximum likelihood estimate for theta
-
-
skgpuppy.Covariance.
dldot
(a, B)¶ Parameters: - a – diagonal of a diagonal matrix
- B – Matrix
-
skgpuppy.Covariance.
drdot
(A, b)¶ Parameters: - A – Matrix
- b – diagonal of a diagonal matrix
-
skgpuppy.Covariance.
tracedot
(A, B)¶ Parameters: - A – Matrix
- B – Matrix
Returns: trace(dot(A,B))