gaussproc

package module
v0.0.0-...-fbc8bdf Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2018 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

gaussproc implements a lot of things to help with Gaussian processes.

Index

Constants

This section is empty.

Variables

View Source
var (
	NotPosDef = errors.New("gaussproc: error not positive definite")
)

Functions

func ExpectedImprovementGaussian

func ExpectedImprovementGaussian(best float64, n distuv.Normal) float64

ExpectedImprovementGaussian returns the expected improvement over the current best. This assumes the function is being minimized. Higher expected improvement is better. If math.IsInf(best,1), then it assumes no samples have been observed and so the expected improvement is just the negative mean.

func ExpectedImprovementStudentsT

func ExpectedImprovementStudentsT(best float64, s distuv.StudentsT) float64

func MeanStdMat

func MeanStdMat(x mat.Matrix) (mean, std []float64)

MeanStdMat returns the mean and standard deviations of the columns of the data matrix. If all of the elements of the column have the same value, a standard deviation of 1 is returned. If x == nil, MeanStd panics.

Types

type GP

type GP struct {
	// contains filtered or unexported fields
}

func NewGP

func NewGP(ker kernel.Kerneler, x mat.Matrix, y []float64, noise float64, normalized bool) (*GP, error)

NewGP constructs a new Gaussian process with the given input and output data. If normalized is true, the data is scaled to have mean 0 variance 1 before being passed to the kernel. If x and y are both nil, normalized has no effect

func (*GP) ExpectedImprovement

func (gp *GP) ExpectedImprovement(x []float64, best float64) float64

func (*GP) InputScaling

func (gp *GP) InputScaling() (mean, std []float64)

func (*GP) MeanCov

func (gp *GP) MeanCov(x mat.Matrix) (means []float64, cov *mat.SymDense)

func (*GP) MeanStd

func (gp *GP) MeanStd(x []float64) (mean, std float64)

func (*GP) MeansStds

func (gp *GP) MeansStds(x mat.Matrix) (mean, std []float64)

MeanStd returns the mean and standard deviation for the input locations.

func (*GP) Observe

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

Observe updates the Gaussian process with the observation that f(x) = y. This does not update the variable scaling or anything involving the Kernel.

func (*GP) OutputScaling

func (gp *GP) OutputScaling() (mean, std float64)

type LikelihoodGP

type LikelihoodGP struct {
	Kernel kernel.LogKernelHyperer
	Noise  float64
	X      mat.Matrix
	Y      []float64
	MeanX  []float64
	StdX   []float64
	MeanY  float64
	StdY   float64
}

MarginalLikelihoodGP is a type for computing the marginal likelihood as a function of Kernel hyperparameters for a Gaussian Process.

TODO(btracey): Have an OptNoise term.

func (LikelihoodGP) NegativeLikelihood

func (m LikelihoodGP) NegativeLikelihood(hyper []float64) float64

NegativeLikelihood computes the negative marginal likelihood of the data with the given hyperparameters. The negative likelihood is returned so the best value is the minimum of the function.

func (LikelihoodGP) Normalize

func (m LikelihoodGP) Normalize()

Normalize normalizes the X and Y data, overwriting the existing X and Y data.

type LikelihoodStudentsT

type LikelihoodStudentsT struct {
	Kernel kernel.LogKernelHyperer
	Noise  float64
	Nu     float64
	X      mat.Matrix
	Y      []float64
	MeanX  []float64
	StdX   []float64
	MeanY  float64
	StdY   float64
}

LikelihoodStudentsT is a type for computing the marginal likelihood as a function of Kernel hyperparameters for a Student's T Process.

TODO(btracey): Have an OptNoise term and a nu term.

func (*LikelihoodStudentsT) NegativeLikelihood

func (m *LikelihoodStudentsT) NegativeLikelihood(hyper []float64) float64

NegativeLikelihood computes the negative marginal likelihood of the data with the given hyperparameters. The negative likelihood is returned so the best value is the minimum of the function.

func (*LikelihoodStudentsT) Normalize

func (m *LikelihoodStudentsT) Normalize()

Normalize normalizes the X and Y data, overwriting the existing X and Y data.

type StudentsT

type StudentsT struct {
	// contains filtered or unexported fields
}

StudentsT implements a Student's T process

func NewStudentsT

func NewStudentsT(nu float64, ker kernel.Kerneler, x mat.Matrix, y []float64, noise float64, normalized bool) (*StudentsT, error)

func (*StudentsT) ExpectedImprovement

func (s *StudentsT) ExpectedImprovement(x []float64, best float64) float64

func (*StudentsT) InputScaling

func (s *StudentsT) InputScaling() (mean, std []float64)

func (*StudentsT) MarginalStudentsT

func (s *StudentsT) MarginalStudentsT(x []float64) distuv.StudentsT

func (*StudentsT) MeanStd

func (s *StudentsT) MeanStd(x []float64) (float64, float64)

func (*StudentsT) Observe

func (s *StudentsT) Observe(x []float64, y float64) error

func (*StudentsT) OutputScaling

func (s *StudentsT) OutputScaling() (mean, std float64)

Jump to

Keyboard shortcuts

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