gp

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GP

type GP struct {
	// Configuration
	NDim         int    // number of dimensions
	Simil, Noise Kernel // kernels

	// Data
	ThetaSimil, ThetaNoise []float64   // kernel parameters
	X                      [][]float64 // inputs
	Y                      []float64   // outputs

	// Optimizations
	Parallel bool // when true, covariances are computed in parallel

	// Cached computations
	L     mat.Cholesky  // Cholesky decomposition of K
	Alpha *mat.VecDense // K^-1 y
	// contains filtered or unexported fields
}

Type GP is the barebone implementation of GP.

func (*GP) Absorb

func (gp *GP) Absorb(x [][]float64, y []float64) (err error)

Absorb absorbs observations into the process.

func (*GP) Gradient

func (gp *GP) Gradient() []float64

Gradient computes the gradient of the log-likelihood with respect to the parameters and the inputs (GPML:5.9):

∇L = ½ tr((α α^⊤ - Σ^−1) ∂Σ/∂θ), where α = Σ^-1 y

func (*GP) LML

func (gp *GP) LML() float64

LML computes log marginal likelihood of the kernel given the absorbed observations (GPML:5.8):

L = −½ log|Σ| − ½ y^⊤ α − n/2 log(2π), where α = Σ^-1 y

func (*GP) Observe

func (gp *GP) Observe(x []float64) float64

Observe computes log marginal likelihood of the parameters given the observations. The argument is the concatenation of log-transformed hyperparameters, inputs, and outputs.

Optionally, the input can be only log-transformed hyperparameters, and then * only hyperparameters are inferred; * inputs must be assigned to fields X, Y of gp.

func (*GP) Produce

func (gp *GP) Produce(x [][]float64) (
	mu, sigma []float64,
	err error,
)

Produce computes predictions. Depends on ThetaSimil, ThetaNoise, X, L, Alpha; this fields must be set if Produce is used on stored results of a call to Absorb.

type Kernel

type Kernel interface {
	model.Model
	NTheta() int
}

Type Kernel is the kernel interface, implemented by both covariance and noise kernels.

type Model

type Model struct {
	*GP                // GP instance
	Priors model.Model // hyperparameter priors
	// contains filtered or unexported fields
}

Type Model is the wrapper model combining a GP instance and priors on the hyperparameters.

func (*Model) Gradient

func (m *Model) Gradient() []float64

func (*Model) Observe

func (m *Model) Observe(x []float64) float64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL