1% STK_EXAMPLE_KB10 Leave-one-out (LOO) cross validation 2% 3% This example demonstrate the use of Leave-one-out (LOO) cross-validation to 4% produced goodness-of-fit graphical diagnostics. 5% 6% The dataset comes from the "borehole model" response function, evaluated 7% without noise on a space-filling design of size 10 * DIM = 80. It is analyzed 8% using a Gaussian process prior with unknown constant mean (with a uniform 9% prior) and anisotropic stationary Matern covariance function (regularity 5/2; 10% variance and range parameters estimated by restricted maximum likelihood). 11% 12% See also stk_predict_leaveoneout, stk_plot_predvsobs, stk_plot_histnormres 13 14% Copyright Notice 15% 16% Copyright (C) 2016 CentraleSupelec 17% 18% Author: Julien Bect <julien.bect@centralesupelec.fr> 19 20% Copying Permission Statement 21% 22% This file is part of 23% 24% STK: a Small (Matlab/Octave) Toolbox for Kriging 25% (http://sourceforge.net/projects/kriging) 26% 27% STK is free software: you can redistribute it and/or modify it under 28% the terms of the GNU General Public License as published by the Free 29% Software Foundation, either version 3 of the License, or (at your 30% option) any later version. 31% 32% STK is distributed in the hope that it will be useful, but WITHOUT 33% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 34% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 35% License for more details. 36% 37% You should have received a copy of the GNU General Public License 38% along with STK. If not, see <http://www.gnu.org/licenses/>. 39 40stk_disp_examplewelcome (); 41 42% Define the input domain (see stk_testfun_borehole.m) 43BOX = stk_hrect ([ ... 44 0.05 100 63070 990 63.1 700 1120 9855; ... 45 0.15 50000 115600 1110 116 820 1680 12045], ... 46 {'rw', 'r', 'Tu', 'Hu', 'Tl', 'Hl', 'L', 'Kw'}); 47 48% Generate dataset 49d = size (BOX, 2); 50x = stk_sampling_maximinlhs (10 * d, d, BOX); % Space-filling LHS of size 10*d 51y = stk_testfun_borehole (x); % Obtain the responses on the DoE x 52 53% Build Gaussian process model 54M_prior = stk_model (@stk_materncov52_aniso, d); % prior 55M_prior.param = stk_param_estim (M_prior, x, y); % ReML parameter estimation 56 57% Compye LOO predictions and residuals 58[y_LOO, res_LOO] = stk_predict_leaveoneout (M_prior, x, y); 59 60% Plot predictions VS observations (left planel) 61% and normalized residuals (right panel) 62stk_figure ('stk_example_kb10 (a)'); stk_plot_predvsobs (y, y_LOO); 63stk_figure ('stk_example_kb10 (b)'); stk_plot_histnormres (res_LOO.norm_res); 64 65% Note that the three previous lines can be summarized, 66% if you only need the two diagnostic plots, as: 67% 68% stk_predict_leaveoneout (M_prior, x, y); 69% 70% (calling stk_predict_leaveoneout with no output arguments creates the plots). 71