The SUMO toolbox  2018a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
BlindKriging Class Reference

A blind kriging surrogate model. More...

Inheritance diagram for BlindKriging:
Inheritance graph
[legend]

Public Member Functions

function BlindKriging (var varargin)
 Class constructor. More...
 
function getStatistics ()
 Returns some useful statistics. More...
 
function fit (var samples, var values)
 Fits a blind kriging model. More...
 
function regressionFunction (var varargin)
 Returns the regression function. More...
 
function getProcessVariance ()
 Returns the process variance. More...
 
function getSamples ()
 Returns the input sample matrix. More...
 
function getValues ()
 Returns the output value matrix. More...
 
function predict (var points)
 Predict the mean and/or variance for one or more points x. More...
 
function predictCovarianceMatrix (var points1, var points2, var outputIdx)
 Predict the full posterior covariance matrix. More...
 
function predict_derivatives (var point)
 Predict the derivatives of the mean and/or variance for a points x. More...
 
function getExpression (var outputIndex)
 Returns the Matlab expression of this Gaussian Process model. More...
 
function cvpe ()
 Calculates cross validated prediction error (cvpe) More...
 
function scale (var X, var values)
 Just sets all members to new samples and values. More...
 
function unscale (var X, var values)
 Just sets all members to new samples and values. More...
 
function getHyperparameters ()
 Returns the hyperparameters. More...
 
function getRho ()
 Returns the rho parameter (only valid for CoKriging) More...
 
function getCorrelationMatrix ()
 Returns the full extrinsic correlation matrix. More...
 
function getSigma ()
 Returns the intrinsic covariance matrix. More...
 
function getRegressionMatrix ()
 Returns the model matrix (Vandermonde matrix) More...
 
function setOption (var key, var value)
 Sets a value in the options structure. More...
 
function getOption (var key)
 Gets a value in the options structure. More...
 
function cleanup ()
 Clears some unused variables. More...
 
function display ()
 Returns user-friendly description of the class instance. More...
 
function predict_limit (var points)
 Limit predictor of kriging (EXPERIMENTAL) More...
 
function correlationFunction (var options)
 Returns the internal correlation function handle and a symbolic expression of the the correlation part. More...
 
function marginalLikelihood (var dpsi, var dsigma2)
 Marginal likelihood function. More...
 
function pseudoLikelihood (var dpsi, var dsigma2)
 Leave-one-out predictive log probability (pseudo-likelihood) More...
 
function mseTestset (var testx, var testy)
 Calculates error on holdout set. More...
 
function imse ()
 Calculates the log of the integrated mean squared error. More...
 
function rcValues ()
 Quantifies magnification of noise (lower is better) More...
 
function plotVariogram ()
 Variogram plot (EXPERIMENTAL) More...
 
function getSensitivityIndices (var model, var order, var type, var method)
 Calculate sensitivity indices. More...
 
function extrinsicCorrelationMatrix (var points1, var points2)
 Constructs extrinsic correlation matrix. More...
 
function intrinsicCovarianceMatrix (var points1, var points2)
 Constructs intrinsic covariance matrix (stochastic kriging/regression kriging) More...
 

Static Public Member Functions

static function getDefaultOptions ()
 Returns a default options structure. More...
 

Public Attributes

const var RHO
 index of the rho parameter More...
 
const var LAMBDA
 index of the lambda parameter More...
 
const var SIGMA2
 index of the sigma2 parameter More...
 
const var HP
 index of the correlation function parameters More...
 

Protected Member Functions

function regressionMatrix (var points)
 Constructs regression matrix. More...
 
function setData (var samples, var values)
 Sets samples and values matrix. More...
 
function updateModel (var F, var hp)
 Constructs model. More...
 
function updateRegression (var F, var hp)
 Constructs regression part. More...
 
function updateStochasticProcess (var hp)
 Constructs correlation part. More...
 
function tuneParameters (var F)
 Hyperparameter optimization. More...
 
function generateDegrees (var dj)
 Generate degrees matrix from individual ones. More...
 

Protected Attributes

var options
 
var regressionFcn
 degrees matrix (strings are converted) More...
 
var correlationFcn
 string -> function handle More...
 
var hyperparameters0
 initial hp values OR the real ones (if optimization is done outside the class) More...
 
var dist
 sample inter-distance More...
 
var distIdxPsi
 indexing needed to calculate psi from D More...
 
var optimIdx
 logical indices to parameters that are optimized More...
 
var optimNrParameters
 number of optimization parameter (vector; one entry per type of parameter) More...
 
var alpha
 Regression coefficients. More...
 
var gamma
 'Correlation part' coefficients More...
 
var hyperparameters
 correlation parameters More...
 
var rho
 
var C
 Choleski Decomposition of extrinsic + intrinsic matrices. More...
 
var sigma2
 process variance of the GP (extrinsic variance ) More...
 
var tau2
 intrinsic variance More...
 
var Sigma
 intrinsic covariance matrix (amount of regression of stochastic part) More...
 
var Ft
 decorrelated model matrix More...
 
var R
 from QR decomposition of regression part More...
 
var sigma2_reinterp
 Reinterpolation version of sigma2. More...
 
var C_reinterp
 Reinterpolation version of C. More...
 
var Ft_reinterp
 Reinterpolation version of Ft. More...
 
var R_reinterp
 Reinterpolation version of R. More...
 

Detailed Description

A blind kriging surrogate model.

Papers:

Limitations:

Constructor & Destructor Documentation

function BlindKriging ( var  varargin)
inline

Class constructor.

Initializes the Blind kriging model. Takes the same parameters as Kriging

Returns
instance of the blind kriging class

Member Function Documentation

function cleanup ( )
inlineinherited

Clears some unused variables.

function correlationFunction ( var  options)
inherited

Returns the internal correlation function handle and a symbolic expression of the the correlation part.

Example: [correlationFcn expression] = correlationFunction( this,struct( 'latex', true, 'includeCoefficients', false) )

The expression is based on the scaled data

Parameters
optionsOptions struct
Return values
correlationFcnString of correlation function
expressionSymbolic expression
function cvpe ( )
inherited

Calculates cross validated prediction error (cvpe)

Error function used is the Mean Squared Error (MSE)

Return values
outcvpe score
function display ( )
inlineinherited

Returns user-friendly description of the class instance.

function extrinsicCorrelationMatrix ( var  points1,
var  points2 
)
inherited

Constructs extrinsic correlation matrix.

Generate correlation matrix of points1 vs points2 using the current hyperparameters as followed:

Parameters
points1input point matrix (optional)
points2input point matrix (optional)
Return values
psiCorrelation matrix
dpsiDerivative of correlation matrix w.r.t. the hyperparameters
  • extrinsicCorrelationMatrix(this)
    • Assume points1 = points2 = samples
  • extrinsicCorrelationMatrix(this, points1)
    • Assume points2 = samples
  • extrinsicCorrelationMatrix(this, points1, points2)

NOTE: The first case returns derivatives w.r.t. X The latter two cases returns derivatives w.r.t. the hyperparameters

function fit ( var  samples,
var  values 
)

Fits a blind kriging model.

Need to be invoked before calling any of the prediction methods.

Parameters
samplesinput sample matrix
valuesoutput value matrix
Return values
IKThe initial kriging model
function generateDegrees ( var  dj)
protectedinherited

Generate degrees matrix from individual ones.

Generates a (full) degree matrix based on one or more degree matrices for variable j The option 'regressionMaxLevelInteractions' determines the maximum level of interactions (BasicGaussianProcess::getDefaultOptions)

Parameters
djCell array of degree matrices (for each dimension)
Return values
degreesFull degrees matrix
idxCell array of indices (used by blind kriging)
function getCorrelationMatrix ( )
inlineinherited

Returns the full extrinsic correlation matrix.

static function getDefaultOptions ( )
inlinestatic

Returns a default options structure.

Blind kriging specific options:

options.regressionMetric = 'cvpe'; % metric to guide the feature selection phase
options.retuneParameters = false; % retune parameters after every BK step
options.RmatrixThreshold = 250; % when to use full matrix R or when to approximate by using sparse diagonal of R
options.regressionMaxOrder = 2; % maximum order of candidate feature to consider (quadratic)
Return values
optionsOptions structure
function getExpression ( var  outputIndex)
inherited

Returns the Matlab expression of this Gaussian Process model.

Example: expression = getExpression( this )

Parameters
optionsOptions struct
Return values
expressionSymbolic expression
function getHyperparameters ( )
inlineinherited

Returns the hyperparameters.

function getOption ( var  key)
inlineinherited

Gets a value in the options structure.

Parameters
keyoption name
function getProcessVariance ( )
inlineinherited

Returns the process variance.

Return values
sigma2process variance
function getRegressionMatrix ( )
inlineinherited

Returns the model matrix (Vandermonde matrix)

function getRho ( )
inlineinherited

Returns the rho parameter (only valid for CoKriging)

function getSamples ( )
inlineinherited

Returns the input sample matrix.

Return values
samplesunscaled samples (original)
scaledSamplesscaled samples
function getSensitivityIndices ( var  model,
var  order,
var  type,
var  method 
)
inherited

Calculate sensitivity indices.

Calculates sensitivity indices.

Return values
sensitivityIndicesstruct

Analytical calculation supported for corr={'corrgauss', 'corrmatern32sep', 'corrmatern32sepsingle'} For other correlation functions Monte carlo will be used type is one of 'variance' (Sobol), 'derivative' method is one of 'analytical', 'montecarlo'

function getSigma ( )
inlineinherited

Returns the intrinsic covariance matrix.

function getStatistics ( )
inline

Returns some useful statistics.

Return values
statsStatistics structure
function getValues ( )
inlineinherited

Returns the output value matrix.

Return values
valuesunscaled values (original)
scaledValuesscaled values
function imse ( )
inherited

Calculates the log of the integrated mean squared error.

Only supported for 1D and 2D problems.

Return values
outlog(imse) score

Papers:

  • See Sacks 1989
  • See pechiny paper...
Todo:
Implement generic monte carlo integration
function intrinsicCovarianceMatrix ( var  points1,
var  points2 
)
inherited

Constructs intrinsic covariance matrix (stochastic kriging/regression kriging)

Generate covariance matrix matrix of points1 vs points2 using the current hyperparameters as followed:

Parameters
points1input point matrix (optional)
points2input point matrix (optional)
Return values
psiCovariance matrix
dpsiDerivative of covariance matrix w.r.t. the hyperparameters OR the input points
  • intrinsicCovarianceMatrix(this)
    • Assume points1 = points2 = samples
  • intrinsicCovarianceMatrix(this, points1)
    • Not used (and not implemented yet)
  • intrinsicCovarianceMatrix(this, points1, points2)
    • Not used (and not implemented yet)
function marginalLikelihood ( var  dpsi,
var  dsigma2 
)
inherited

Marginal likelihood function.

Used for Maximum Likelihood Estimation (MLE)

Parameters
dpsicell array of derivative matrices (optional; for internal use only)
Return values
outscore
doutDerivatives w.r.t. hyperparameters

Papers:

  • "Gaussian Processes for Machine Learning" (Chapter 5), C. E. Rasmussen and C. K. I. Williams, MIT Press, 2006
  • "An adjoint for likelihood maximization" D.J.J. Toal, A.I.J. Forrester, N.W. Bressloff, A.J. Keane, C. Holden, Proc. of the Royal Society, 2009
Todo:
Adjoint derivatives work, but are very slow due to naive implementation
function mseTestset ( var  testx,
var  testy 
)
inherited

Calculates error on holdout set.

Error function used is the Mean Squared Error (MSE) function.

Parameters
testxinput samples of the test set
testyoutput samples of the test set
Return values
outmse error on test set
function plotVariogram ( )
inherited

Variogram plot (EXPERIMENTAL)

Plots the experimental (semi-)variogram (based on the data) as well as the theoretical kriging (semi-)variogram (defined by the correlation function).

Return values
hFigure handle

Empirical variogram:

  • Methods of moments estimator Matheron (Cressie, 1993)
  • More robust estimators: Cressie-Hawkins (1980), Genton (1998) In general: use median instead of mean
function predict ( var  points)
inherited

Predict the mean and/or variance for one or more points x.

Parameters
pointsMatrix of input points to be predicted
Return values
valuespredicted output values
sigma2predicted variance of the output values (optional)
Precondition
The kriging object should be fitted using a dataset (fit)
function predict_derivatives ( var  point)
inherited

Predict the derivatives of the mean and/or variance for a points x.

NOTE:

Parameters
pointinput point to calculate the derivative of
Return values
dvaluesDerivative w.r.t. the output
sigma2Derivative w.r.t. the output variance (optional)
  • limited to one point at a time (x is a row vector)
function predict_limit ( var  x)
inherited

Limit predictor of kriging (EXPERIMENTAL)

Limited to ordinary kriging (prediction variance sigma2 not supported).

Parameters
pointsMatrix of input points to be predicted
Return values
valuespredicted output values
sigma2predicted variance of the output values (optional)

Cancels out the mean. Should reduce the 'spikyness' of the response surface somewhat.

Papers:

  • "Limit Kriging" V. Roshan Joseph (submitted 2005)
function predictCovarianceMatrix ( var  points1,
var  points2,
var  outputIdx 
)
inherited

Predict the full posterior covariance matrix.

The diagonal is the same as the variance of predict

Parameters
pointsMatrix of input points to be predicted
outputIdxthe output to predict for (default is 1)
Return values
sigmaposterior covariance matrix
Precondition
The kriging object should be fitted using a dataset (Kriging::fit)
function pseudoLikelihood ( var  dpsi,
var  dsigma2 
)
inherited

Leave-one-out predictive log probability (pseudo-likelihood)

Calculates the leave-one-out predictive log probability.

Parameters
dpsicell array of derivative matrices (optional; for internal use only)
Return values
outscore
doutDerivatives w.r.t. hyperparameters

Papers:

  • "Predictive Approaches for Choosing Hyperparameters in Gaussian Process", S. Sundararajan, S.S. Keerthu, 1999
function rcValues ( )
inherited

Quantifies magnification of noise (lower is better)

Robustness-criterion (In theory useful only for ordinary kriging).

Return values
rcrobustness-criterion

Returns a 2xn matrix:

  • the first row contains the absolute robustness
  • the second row contains the relative robustness Papers:
  • "Kriging models that are robust w.r.t. simulation errors" A.Y.D. Siem, D. den Hertog (tech report)
function regressionFunction ( var  varargin)

Returns the regression function.

Example: [regressionFcn expression terms] = regressionFunction( this, struct('latex', true, 'precision', '%.5g') )

Parameters
vararginOptions
Return values
regressionFcnDegree matrix representing the regression function
expressionSymbolic expression
termsCell array of the individual terms
Note
Symbolic expression does not support maxorder greater than two
function regressionMatrix ( var  points)
protected

Constructs regression matrix.

Regression matrix (model matrix, Vandermonde matrix, ...) for a set of points Based on this.regressionFcn.

Parameters
pointspoints matrix (optional)
Return values
Fmodel matrix
dFderivative of the model matrix w.r.t. points or the hyperparameters

Uses coded sample matrix!

function scale ( var  X,
var  values 
)
inherited

Just sets all members to new samples and values.

function setData ( var  samples,
var  values 
)
protectedinherited

Sets samples and values matrix.

Scales samples and values, passing the scaled dataset to the underlying base method.

Parameters
samplesinput sample matrix
valuesoutput value matrix
function setOption ( var  key,
var  value 
)
inlineinherited

Sets a value in the options structure.

Parameters
keyoption name
valueoption value
function tuneParameters ( var  F)
protectedinherited

Hyperparameter optimization.

Setups and invokes the optimizer.

Parameters
Fmodel matrix
Return values
optimHpoptimized hyperparameters
perfPerformance score (likelihood score)
function unscale ( var  X,
var  values 
)
inherited

Just sets all members to new samples and values.

function updateModel ( var  F,
var  hp 
)
protectedinherited

Constructs model.

Full update of the model (regression + correlation part)

Parameters
Fmodel matrix
hpnew hyperparameters
function updateRegression ( var  F,
var  hp 
)
protectedinherited

Constructs regression part.

Updates regression part of the model.

Parameters
Fmodel matrix
hpnew hyperparameters
Return values
errerror string (if any)
Todo:
Rho is only used by co-kriging, can we abstract this somehow ?
function updateStochasticProcess ( var  hp)
protectedinherited

Constructs correlation part.

Updates correlation part of the model.

Parameters
hphyperparameters
Return values
errerror string (if any)
dpsiDerivative of correlation matrix w.r.t. the hyperparameters

Member Data Documentation

var alpha
protectedinherited

Regression coefficients.

var C
protectedinherited

Choleski Decomposition of extrinsic + intrinsic matrices.

var C_reinterp
protectedinherited

Reinterpolation version of C.

var correlationFcn
protectedinherited

string -> function handle

var dist
protectedinherited

sample inter-distance

var distIdxPsi
protectedinherited

indexing needed to calculate psi from D

var Ft
protectedinherited

decorrelated model matrix

var Ft_reinterp
protectedinherited

Reinterpolation version of Ft.

var gamma
protectedinherited

'Correlation part' coefficients

const var HP
inherited

index of the correlation function parameters

var hyperparameters
protectedinherited

correlation parameters

var hyperparameters0
protectedinherited

initial hp values OR the real ones (if optimization is done outside the class)

const var LAMBDA
inherited

index of the lambda parameter

var optimIdx
protectedinherited

logical indices to parameters that are optimized

var optimNrParameters
protectedinherited

number of optimization parameter (vector; one entry per type of parameter)

var options
protectedinherited
var R
protectedinherited

from QR decomposition of regression part

var R_reinterp
protectedinherited

Reinterpolation version of R.

var regressionFcn
protectedinherited

degrees matrix (strings are converted)

const var RHO
inherited

index of the rho parameter

var rho
protectedinherited
var Sigma
protectedinherited

intrinsic covariance matrix (amount of regression of stochastic part)

const var SIGMA2
inherited

index of the sigma2 parameter

var sigma2
protectedinherited

process variance of the GP (extrinsic variance )

var sigma2_reinterp
protectedinherited

Reinterpolation version of sigma2.

Note
reinterpolation: might be nicer to just construct and keep a sub-GP... takes more space, some calculations are done twice but performance shouldn't take a very big hit...
var tau2
protectedinherited

intrinsic variance


The documentation for this class was generated from the following files: