HasGP-0.1: A Haskell library for inference using Gaussian processes

HasGP.Classification.EP.ClassificationEP

Description

ClassificationEP is a module in the HasGP Gaussian Process library. It implements basic Gaussian Process Classification for two classes using the EP approximation. Targets should be +1/-1.

Copyright (C) 2011 Sean Holden. sbh11@cl.cam.ac.uk.

Synopsis

# Documentation

data EPValue

A convergence test for EP usually depends on the evidence and the number of iterations so far. This allows us to specify completely arbitrary convergence tests.

type EPConvergenceTest = EPValue -> EPValue -> Bool

By passing a function with this type we can specify arbitrary convergence tests.

data EPSiteState

When updating a single site at a time you keep track of var, tauTilde, mu, nuTilde, TauMinus, and MuMinus.

type EPState = (EPSiteState, StdGen, Int)

We hide the state used in performing EP using the state monad. We need to include a random number generator and the number of iterations.

type SiteOrder = State EPState [Int]

If we're updating sites in a random order then we need access to the random number generator.

We're often going to want to update sites in a random order. So we need a state transformer that takes the current state (which includes a random number generator) and produces a random permutation.

For completeness: just in case you want to update sites in a non-random manner, this state transformer does exactly that.

gpClassifierEPEvidence

Arguments

 :: CovarianceMatrix -> Targets -> DMatrix L matrix -> EPSiteState -> Double log marginal likelihood.

Compute the approximation to the log marginal likelihood.

The learning algorithm. Takes an arbitrary function for convergence testing.

gpClassifierEPPredict

Arguments

 :: CovarianceFunction c => EPSiteState -> Inputs -> Targets Inputs in training set -> CovarianceMatrix -> c Covariance Function -> Inputs New inputs -> DVector

Prediction with GP classifiers based on EP learning. Takes a matrix in which each row is an example to be classified.

gpClassifierEPLogEvidence

Arguments

 :: CovarianceFunction c => c Covariance -> Inputs -> Targets -> SiteOrder -> EPConvergenceTest -> (Double, DVector)

Compute the log evidence and its first derivative for the EP approximation for GP classification. Targets should be +1/-1. Outputs the -log marginal likelihood and a vector of its derivatives.

gpClassifierEPLogEvidenceList

Arguments

 :: CovarianceFunction c => Inputs -> Targets -> c Covariance -> SiteOrder -> EPConvergenceTest -> [Double] -> (Double, DVector)

Essentially the same as gpClassifierEPLogEvidence, but makes a covariance function using the hyperparameters supplied in a list and passes it on.

gpClassifierEPLogEvidenceVec

Arguments

 :: CovarianceFunction c => Inputs -> Targets -> c Covariance -> SiteOrder -> EPConvergenceTest -> DVector -> (Double, DVector)

Essentially the same as gpClassifierEPLogEvidence, but makes a covariance function using the hyperparameters supplied in a vector and passes it on.