A kriging surrogate model.
More...
|
function | Kriging (var varargin) |
| Class constructor.
|
|
function | getProcessVariance () |
| Returns the process variance.
|
|
function | getSamples () |
| Returns the input sample matrix.
|
|
function | getValues () |
| Returns the output value matrix.
|
|
function | predict (var points) |
| Predict the mean and/or variance for one or more points x.
|
|
function | predict_derivatives (var point) |
| Predict the derivatives of the mean and/or variance for a points x.
|
|
function | getExpression (var outputIndex) |
| Returns the Matlab expression of this Gaussian Process model.
|
|
function | cvpe () |
| Calculates cross validated prediction error (cvpe)
|
|
function | getHyperparameters () |
| Returns the hyperparameters.
|
|
function | getRho () |
| Returns the rho parameter (only valid for CoKriging )
|
|
function | getCorrelationMatrix () |
| Returns the full extrinsic correlation matrix.
|
|
function | getSigma () |
| Returns the intrinsic covariance matrix.
|
|
function | getRegressionMatrix () |
| Returns the model matrix (Vandermonde matrix)
|
|
function | setOption (var key, var value) |
| Sets a value in the options structure.
|
|
function | cleanup () |
| Clears some unused variables.
|
|
function | display () |
| Returns user-friendly description of the class instance.
|
|
function | fit (var samples, var values) |
| Fits a gaussian process for a dataset.
|
|
function | predict_limit (var points) |
| Limit predictor of kriging (EXPERIMENTAL)
|
|
function | regressionFunction (var options) |
| Returns the regression function.
|
|
function | correlationFunction (var options) |
| Returns the internal correlation function handle and a symbolic expression of the the correlation part.
|
|
function | marginalLikelihood (var dpsi, var dsigma2) |
| Marginal likelihood function.
|
|
function | pseudoLikelihood (var dpsi, var dsigma2) |
| Leave-one-out predictive log probability (pseudo-likelihood)
|
|
function | mseTestset (var testx, var testy) |
| Calculates error on holdout set.
|
|
function | imse () |
| Calculates the log of the integrated mean squared error.
|
|
function | rcValues () |
| Quantifies magnification of noise (lower is better)
|
|
function | plotVariogram () |
| Variogram plot (EXPERIMENTAL)
|
|
|
const var | RHO |
| index of the rho parameter
|
|
const var | LAMBDA |
| index of the lambda parameter
|
|
const var | SIGMA2 |
| index of the sigma2 parameter
|
|
const var | HP |
| index of the correlation function parameters
|
|
|
var | options |
|
var | regressionFcn |
| degrees matrix (strings are converted)
|
|
var | correlationFcn |
| string -> function handle
|
|
var | hyperparameters0 |
| initial hp values OR the real ones (if optimization is done outside the class)
|
|
var | dist |
| sample inter-distance
|
|
var | distIdxPsi |
| indexing needed to calculate psi from D
|
|
var | optimIdx |
| logical indices to parameters that are optimized
|
|
var | optimNrParameters |
| number of optimization parameter (vector; one entry per type of parameter)
|
|
var | alpha |
| Regression coefficients.
|
|
var | gamma |
| 'Correlation part' coefficients
|
|
var | hyperparameters |
| correlation parameters
|
|
var | rho |
|
var | C |
| Choleski Decomposition of extrinsic + intrinsic matrices.
|
|
var | sigma2 |
| process variance of the GP (extrinsic variance )
|
|
var | tau2 |
| intrinsic variance
|
|
var | Sigma |
| intrinsic covariance matrix (amount of regression of stochastic part)
|
|
var | Ft |
| decorrelated model matrix
|
|
var | R |
| from QR decomposition of regression part
|
|
var | sigma2_reinterp |
| Reinterpolation version of sigma2 .
|
|
var | C_reinterp |
| Reinterpolation version of C .
|
|
var | Ft_reinterp |
| Reinterpolation version of Ft .
|
|
var | R_reinterp |
| Reinterpolation version of R .
|
|
A kriging surrogate model.
Is basically the same as the base class BasicGaussianProcess besides the scaling of the samples/values
This class is derived by KrigingModel, a class in the SUMO-Toolbox that works like an interface between SUMO and the actual kriging implementation
Class constructor.
Initializes the kriging model. Takes the same parameters as BasicGaussianProcess
- Returns
- instance of the kriging class
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
-
- Return values
-
correlationFcn | String of correlation function |
expression | Symbolic expression |
Calculates cross validated prediction error (cvpe)
Error function used is the Mean Squared Error (MSE)
- Return values
-
Returns user-friendly description of the class instance.
function extrinsicCorrelationMatrix |
( |
var |
points1, |
|
|
var |
points2 |
|
) |
| |
|
protectedinherited |
Constructs extrinsic correlation matrix.
Generate correlation matrix of points1 vs points2 using the current hyperparameters as followed:
- Parameters
-
points1 | input point matrix (optional) |
points2 | input point matrix (optional) |
- Return values
-
psi | Correlation matrix |
dpsi | Derivative of correlation matrix w.r.t. the hyperparameters |
- extrinsicCorrelationMatrix(this)
- Assume points1 = points2 = samples
- extrinsicCorrelationMatrix(this, points1)
- 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 |
|
) |
| |
|
inherited |
Fits a gaussian process for a dataset.
Need to be invoked before calling any of the prediction methods.
- Parameters
-
samples | input sample matrix |
values | output value matrix |
- Note
- Kriging can't do a cleanup automatically, if needed cleanup() can be called manually.
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
-
dj | Cell array of degree matrices (for each dimension) |
- Return values
-
degrees | Full degrees matrix |
idx | Cell array of indices (used by blind kriging) |
function getCorrelationMatrix |
( |
| ) |
|
|
inlineinherited |
Returns the full extrinsic correlation matrix.
static function getDefaultOptions |
( |
| ) |
|
|
inlinestatic |
function getExpression |
( |
var |
outputIndex | ) |
|
Returns the Matlab expression of this Gaussian Process model.
Example: expression = getExpression( this )
- Parameters
-
- Return values
-
expression | Symbolic expression |
function getHyperparameters |
( |
| ) |
|
|
inlineinherited |
Returns the hyperparameters.
function getProcessVariance |
( |
| ) |
|
|
inline |
Returns the process variance.
- Return values
-
function getRegressionMatrix |
( |
| ) |
|
|
inlineinherited |
Returns the model matrix (Vandermonde matrix)
Returns the rho parameter (only valid for CoKriging
)
Returns the input sample matrix.
- Return values
-
samples | unscaled samples (original) |
scaledSamples | scaled samples |
Returns the intrinsic covariance matrix.
Returns the output value matrix.
- Return values
-
values | unscaled values (original) |
scaledValues | scaled values |
Calculates the log of the integrated mean squared error.
Only supported for 1D and 2D problems.
- Return values
-
Papers:
- See Sacks 1989
- See pechiny paper...
- Todo:
- Implement generic monte carlo integration
function intrinsicCovarianceMatrix |
( |
var |
points1, |
|
|
var |
points2 |
|
) |
| |
|
protectedinherited |
Constructs intrinsic covariance matrix (stochastic kriging/regression kriging)
Generate covariance matrix matrix of points1 vs points2 using the current hyperparameters as followed:
- Parameters
-
points1 | input point matrix (optional) |
points2 | input point matrix (optional) |
- Return values
-
psi | Covariance matrix |
dpsi | Derivative 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
-
dpsi | cell array of derivative matrices (optional; for internal use only) |
- Return values
-
out | score |
dout | Derivatives 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
-
testx | input samples of the test set |
testy | output samples of the test set |
- Return values
-
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
-
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 | ) |
|
Predict the mean and/or variance for one or more points x.
- Parameters
-
points | Matrix of input points to be predicted |
- Return values
-
values | predicted output values |
sigma2 | predicted variance of the output values (optional) |
- Precondition
- The kriging object should be fitted using a dataset (
fit
)
function predict_derivatives |
( |
var |
point | ) |
|
Predict the derivatives of the mean and/or variance for a points x.
NOTE:
- Parameters
-
point | input point to calculate the derivative of |
- Return values
-
dvalues | Derivative w.r.t. the output |
sigma2 | Derivative w.r.t. the output variance (optional) |
- limited to one point at a time (x is a row vector)
function predict_limit |
( |
var |
points | ) |
|
|
inherited |
Limit predictor of kriging (EXPERIMENTAL)
- Parameters
-
points | Matrix of input points to be predicted |
- Return values
-
values | predicted output values |
sigma2 | predicted variance of the output values (optional) |
function pseudoLikelihood |
( |
var |
dpsi, |
|
|
var |
dsigma2 |
|
) |
| |
|
inherited |
Leave-one-out predictive log probability (pseudo-likelihood)
Calculates the leave-one-out predictive log probability.
- Parameters
-
dpsi | cell array of derivative matrices (optional; for internal use only) |
- Return values
-
out | score |
dout | Derivatives w.r.t. hyperparameters |
Papers:
- "Predictive Approaches for Choosing Hyperparameters in Gaussian Process", S. Sundararajan, S.S. Keerthu, 1999
Quantifies magnification of noise (lower is better)
Robustness-criterion (In theory useful only for ordinary kriging).
- Return values
-
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 |
options | ) |
|
|
inherited |
Returns the regression function.
Example: [regressionFcn expression terms] = regressionFunction( this, struct('latex', true, 'precision', '%.5g') )
The expression is based on the scaled data
- Parameters
-
- Return values
-
regressionFcn | Degree matrix representing the regression function |
expression | Symbolic expression |
terms | Cell array of the individual terms |
function regressionMatrix |
( |
var |
points | ) |
|
|
protectedinherited |
Constructs regression matrix.
Regression matrix (model matrix, Vandermonde matrix, ...) for a set of points Based on this.regressionFcn.
- Parameters
-
points | input point matrix (optional) |
- Return values
-
F | Model matrix |
dF | Derivative of model matrix w.r.t. the hyperparameters OR the input points |
function setData |
( |
var |
samples, |
|
|
var |
values |
|
) |
| |
|
protected |
Sets samples and values matrix.
Scales samples and values, passing the scaled dataset to the underlying base method.
- Parameters
-
samples | input sample matrix |
values | output value matrix |
function setOption |
( |
var |
key, |
|
|
var |
value |
|
) |
| |
|
inlineinherited |
Sets a value in the options structure.
- Parameters
-
key | option name |
value | option value |
function tuneParameters |
( |
var |
F | ) |
|
|
protectedinherited |
Hyperparameter optimization.
Setups and invokes the optimizer.
- Parameters
-
- Return values
-
optimHp | optimized hyperparameters |
perf | Performance score (likelihood score) |
function updateModel |
( |
var |
F, |
|
|
var |
hp |
|
) |
| |
|
protectedinherited |
Constructs model.
Full update of the model (regression + correlation part)
- Parameters
-
F | model matrix |
hp | new hyperparameters |
function updateRegression |
( |
var |
F, |
|
|
var |
hp |
|
) |
| |
|
protectedinherited |
Constructs regression part.
Updates regression part of the model.
- Parameters
-
F | model matrix |
hp | new hyperparameters |
- Return values
-
- 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
-
- Return values
-
err | error string (if any) |
dpsi | Derivative of correlation matrix w.r.t. the hyperparameters |
Choleski Decomposition of extrinsic + intrinsic matrices.
Reinterpolation version of C
.
string -> function handle
indexing needed to calculate psi from D
decorrelated model matrix
Reinterpolation version of Ft
.
'Correlation part' coefficients
index of the correlation function parameters
initial hp values OR the real ones (if optimization is done outside the class)
index of the lambda parameter
logical indices to parameters that are optimized
number of optimization parameter (vector; one entry per type of parameter)
from QR decomposition of regression part
Reinterpolation version of R
.
degrees matrix (strings are converted)
index of the rho parameter
intrinsic covariance matrix (amount of regression of stochastic part)
index of the sigma2 parameter
process variance of the GP (extrinsic variance )
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...
The documentation for this class was generated from the following files:
- /home/ilm/projecten/meta/scripts/ooDACE/@Kriging/Kriging.m
- /home/ilm/projecten/meta/scripts/ooDACE/@Kriging/cvpe.m
- /home/ilm/projecten/meta/scripts/ooDACE/@Kriging/getExpression.m
- /home/ilm/projecten/meta/scripts/ooDACE/@Kriging/predict.m
- /home/ilm/projecten/meta/scripts/ooDACE/@Kriging/predict_derivatives.m
- /home/ilm/projecten/meta/scripts/ooDACE/@Kriging/setData.m