1% STK_DATASET_TWOBUMPS defines datasets based on the TwoBumps response function
2
3% Copyright Notice
4%
5%    Copyright (C) 2016 CentraleSupelec
6%
7%    Authors:  Julien Bect       <julien.bect@centralesupelec.fr>
8%              Emmanuel Vazquez  <emmanuel.vazquez@centralesupelec.fr>
9
10% Copying Permission Statement  (STK toolbox)
11%
12%    This file is part of
13%
14%            STK: a Small (Matlab/Octave) Toolbox for Kriging
15%               (http://sourceforge.net/projects/kriging)
16%
17%    STK is free software: you can redistribute it and/or modify it under
18%    the terms of the GNU General Public License as published by the Free
19%    Software Foundation,  either version 3  of the License, or  (at your
20%    option) any later version.
21%
22%    STK is distributed  in the hope that it will  be useful, but WITHOUT
23%    ANY WARRANTY;  without even the implied  warranty of MERCHANTABILITY
24%    or FITNESS  FOR A  PARTICULAR PURPOSE.  See  the GNU  General Public
25%    License for more details.
26%
27%    You should  have received a copy  of the GNU  General Public License
28%    along with STK.  If not, see <http://www.gnu.org/licenses/>.
29
30% Copying Permission Statement  (this file)
31%
32%    To the extent possible under law,  Julien Bect  and Emmanuel Vazquez
33%    have waived  all copyright  and related  or neighboring rights to
34%    stk_dataset_twobumps.m.  This work is published from France.
35%
36%    License: CC0  <http://creativecommons.org/publicdomain/zero/1.0/>
37
38function [xi, zi, ref] = stk_dataset_twobumps (dataset_name, simulate)
39
40if nargin < 2
41    % Default: use saved versions of noisy datasets (for reproducibility)
42    simulate = false;
43end
44
45ref.f = @stk_testfun_twobumps;
46
47% Factor space (i.e., input space)
48ref.box = [-1.0; 1.0];
49
50% Reference dataset
51ref.xt = stk_sampling_regulargrid (400, [], ref.box);
52ref.zt = stk_feval (ref.f, ref.xt);
53
54switch dataset_name
55
56    case 'noiseless'
57
58        % Indices of six evaluation points in xt
59        ref.xi_ind = [1 20 90 200 300 350];
60
61        % Evaluation points
62        xi = ref.xt(ref.xi_ind, 1);
63
64        % Evaluation results
65        zi = stk_feval (ref.f, xi);
66
67    case 'noisy1'
68
69        % Number of noisy observations
70        n = 20;
71
72        % Standard deviation of the (Gaussian) observation noise
73        ref.noise_std = 0.2;
74
75        % Evaluation points on a regular grid
76        xi = stk_sampling_regulargrid (n, [], ref.box);
77
78        % Standard Gaussian noise
79        if simulate
80            u = randn (n, 1);
81        else
82            u = [ ...
83                +2.494262357945395; -0.734979628183384; +0.482374373838845; ...
84                +0.723297790408916; -0.698828108725056; -0.544234733755390; ...
85                +0.200719359571192; +0.114419113713883; -2.430087055004133; ...
86                +0.982006706100309; +1.043148691468279; +0.332804939718977; ...
87                -0.014386709815515; -0.470223054833317; -0.504604762739981; ...
88                +1.214912259853930; -0.514268293209969; +0.195757395918953; ...
89                +1.517874831056133; +0.753351049482162];
90        end
91
92        % Evaluation results with homoscedastic Gaussian noise
93        zi = stk_feval (ref.f, xi) + ref.noise_std * u;
94
95    case 'noisy2'
96
97        % Standard deviation function of the heteroscedastic noise
98        ref.noise_std_func = @(x) 0.1 + (x + 1) .^ 2;
99
100        % Evaluation points
101        xi1 = stk_sampling_regulargrid (30, [], ref.box);
102        xi2 = stk_sampling_regulargrid (50, [], [0; 1]);
103        xi = [xi1; xi2];
104        n = size (xi, 1);
105
106        % Standard deviation of the noise
107        ref.noise_std = ref.noise_std_func (xi.data);
108
109        % Standard Gaussian noise
110        if simulate
111            u = randn (n, 1);
112        else
113            u = [ ...
114                -0.791478467901437; -1.762943052690207; -0.001299829346851; ...
115                +0.732147620330301; +0.605023011882157; -0.235236784824946; ...
116                +1.229945155335280; +0.886837017097442; +0.488261575509975; ...
117                +0.424488726533523; +1.754745494583444; -0.441222483623965; ...
118                +0.879192878193787; +0.324020151981654; +0.084432929005424; ...
119                -0.604693498668125; -0.031299228423533; +0.007433332039656; ...
120                -0.107529006311618; +0.890983601251905; -0.696857251549359; ...
121                -0.394367071934840; +1.209585103839413; +0.720950468832869; ...
122                +0.188359447172079; -0.659677837960163; +0.254008558054221; ...
123                -1.264954661580136; +0.816118804592636; +0.202455570359224; ...
124                +0.734286747946277; -0.244906212630412; +0.274108676705772; ...
125                -0.862005106214534; +0.434343874659720; -0.117332608645138; ...
126                -0.914714934350702; +0.115661357086073; -0.325149459903396; ...
127                +0.639533386284049; +0.509460672890649; -0.852768546081912; ...
128                +0.186192416612840; +0.313594500855111; +0.294019880744365; ...
129                -1.130158251045297; -0.766406113410912; -1.866775028802603; ...
130                -0.947126212506609; +0.538816492914357; +0.511602507613618; ...
131                +0.823135354100495; -1.756797156406481; -0.312291404135173; ...
132                +0.087942003030425; +0.567707468547421; +2.032871465968247; ...
133                +1.898136463799602; +0.017457787439612; -0.544269383534046; ...
134                -0.031505371902443; -0.152838878112194; -1.329039092306233; ...
135                +1.080298915753245; +1.010267794177553; -0.786523836101804; ...
136                -1.172017693806294; +0.545622109584444; -0.565273496172850; ...
137                +1.395393272315889; +2.249339864785413; +1.152166643543791; ...
138                -0.529253078296878; -0.550879429738137; -0.658033963155681; ...
139                -2.229148823293678; -0.883276090753784; -1.048334125700457; ...
140                +0.787058154693710; +2.284606236947447];
141        end
142
143        % Evaluation results with homoscedastic Gaussian noise
144        zi = stk_feval (ref.f, xi) + ref.noise_std .* u;
145
146    otherwise
147
148        error ('Unknown dataset name.');
149
150end % switch
151
152end % function
153