1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
4 | *
|
---|
5 | * This file is part of HeuristicLab.
|
---|
6 | *
|
---|
7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | using System.Linq;
|
---|
23 | using HeuristicLab.Algorithms.DataAnalysis;
|
---|
24 | using Microsoft.VisualStudio.TestTools.UnitTesting;
|
---|
25 |
|
---|
26 | namespace HeuristicLab.Algorithms.DataAnalysis_34.Tests {
|
---|
27 | [TestClass]
|
---|
28 |
|
---|
29 | // reference values calculated with Rasmussen's GPML MATLAB package
|
---|
30 | public class GaussianProcessFunctionsTest {
|
---|
31 | [TestMethod]
|
---|
32 | public void MeanConstTest() {
|
---|
33 | TestMeanFunction(new MeanConst(), 0,
|
---|
34 | new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
---|
35 | new double[][] { new double[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }
|
---|
36 | );
|
---|
37 | TestMeanFunction(new MeanConst(), 1,
|
---|
38 | new double[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
|
---|
39 | new double[][] { new double[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }
|
---|
40 | );
|
---|
41 | }
|
---|
42 |
|
---|
43 | [TestMethod]
|
---|
44 | public void MeanZeroTest() {
|
---|
45 | TestMeanFunction(new MeanZero(), 0,
|
---|
46 | new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
---|
47 | new double[][] { new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
|
---|
48 | );
|
---|
49 | TestMeanFunction(new MeanZero(), 1,
|
---|
50 | new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
---|
51 | new double[][] { new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
|
---|
52 | );
|
---|
53 | }
|
---|
54 |
|
---|
55 | [TestMethod]
|
---|
56 | public void MeanSumTest() {
|
---|
57 | var sum = new MeanSum();
|
---|
58 | sum.Terms.Add(new MeanConst());
|
---|
59 | sum.Terms.Add(new MeanConst());
|
---|
60 | TestMeanFunction(sum, 0,
|
---|
61 | new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
---|
62 | new double[][]
|
---|
63 | {
|
---|
64 | new double[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
|
---|
65 | new double[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
|
---|
66 | }
|
---|
67 | );
|
---|
68 | TestMeanFunction(sum, 1,
|
---|
69 | new double[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 },
|
---|
70 | new double[][]
|
---|
71 | {
|
---|
72 | new double[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
|
---|
73 | new double[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
|
---|
74 | }
|
---|
75 | );
|
---|
76 | }
|
---|
77 | [TestMethod]
|
---|
78 | public void MeanProdTest() {
|
---|
79 | var prod = new MeanProd();
|
---|
80 | prod.Factors.Add(new MeanConst());
|
---|
81 | prod.Factors.Add(new MeanConst());
|
---|
82 | TestMeanFunction(prod, 0,
|
---|
83 | new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
---|
84 | new double[][]
|
---|
85 | {
|
---|
86 | new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
---|
87 | new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
---|
88 | }
|
---|
89 | );
|
---|
90 | TestMeanFunction(prod, 1,
|
---|
91 | new double[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
|
---|
92 | new double[][]
|
---|
93 | {
|
---|
94 | new double[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
|
---|
95 | new double[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
|
---|
96 | }
|
---|
97 | );
|
---|
98 |
|
---|
99 | prod.Factors.Clear();
|
---|
100 | prod.Factors.Add(new MeanZero());
|
---|
101 | prod.Factors.Add(new MeanLinear());
|
---|
102 | TestMeanFunction(prod, 0,
|
---|
103 | new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
---|
104 | new double[][]
|
---|
105 | {
|
---|
106 | new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
---|
107 | new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
---|
108 | new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
---|
109 | new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
---|
110 | new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
---|
111 | }
|
---|
112 | );
|
---|
113 | TestMeanFunction(prod, 1,
|
---|
114 | new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
---|
115 | new double[][]
|
---|
116 | {
|
---|
117 | new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
---|
118 | new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
---|
119 | new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
---|
120 | new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
---|
121 | new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
---|
122 | }
|
---|
123 | );
|
---|
124 |
|
---|
125 | prod.Factors.Clear();
|
---|
126 | prod.Factors.Add(new MeanConst());
|
---|
127 | prod.Factors.Add(new MeanLinear());
|
---|
128 | TestMeanFunction(prod, 1,
|
---|
129 | new double[] { 1.843574580675791, 2.127929337522181, 3.116568910281474, 1.688566127130978, 3.250517738447450, 2.961262743634280, 2.326019412613392, 1.729286976436201, 1.769654419215176, 2.398170347588917 },
|
---|
130 | new double[][]
|
---|
131 | {
|
---|
132 | new double[] { 2.9088, 1.8646, 3.1971, 1.9890, 1.7640, 1.2801, 2.8059, 3.7243, 3.1899 ,1.4978 },
|
---|
133 | new double[] { 0.4173, 0.0497, 0.9027, 0.9448, 0.4909, 0.4893, 0.3377, 0.9001, 0.3692 ,0.1112 },
|
---|
134 | new double[] { 0.7803, 0.3897, 0.2417, 0.4039, 0.0965, 0.1320, 0.9421, 0.9561, 0.5752 ,0.0598 },
|
---|
135 | new double[] { 0.2348, 0.3532, 0.8212, 0.0154, 0.0430, 0.1690, 0.6491, 0.7317, 0.6477 ,0.4509 },
|
---|
136 | new double[] { 0.5470, 0.2963, 0.7447, 0.1890, 0.6868, 0.1835, 0.3685, 0.6256, 0.7802 ,0.0811 },
|
---|
137 | new double[] { 0.9294, 0.7757, 0.4868, 0.4359, 0.4468, 0.3063, 0.5085, 0.5108, 0.8176 ,0.7948 }
|
---|
138 | }
|
---|
139 | );
|
---|
140 | }
|
---|
141 |
|
---|
142 | [TestMethod]
|
---|
143 | public void MeanLinear() {
|
---|
144 | TestMeanFunction(new MeanLinear(), 0,
|
---|
145 | new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
---|
146 | new double[][]
|
---|
147 | {
|
---|
148 | new double[] { 0.4173, 0.0497, 0.9027, 0.9448, 0.4909, 0.4893, 0.3377, 0.9001, 0.3692, 0.1112 },
|
---|
149 | new double[] { 0.7803, 0.3897, 0.2417, 0.4039, 0.0965, 0.1320, 0.9421, 0.9561, 0.5752, 0.0598 },
|
---|
150 | new double[] { 0.2348, 0.3532, 0.8212, 0.0154, 0.0430, 0.1690, 0.6491, 0.7317, 0.6477, 0.4509 },
|
---|
151 | new double[] { 0.5470, 0.2963, 0.7447, 0.1890, 0.6868, 0.1835, 0.3685, 0.6256, 0.7802, 0.0811 },
|
---|
152 | new double[] { 0.9294, 0.7757, 0.4868, 0.4359, 0.4468, 0.3063, 0.5085, 0.5108, 0.8176, 0.7948 }
|
---|
153 | }
|
---|
154 | );
|
---|
155 | TestMeanFunction(new MeanLinear(), 1,
|
---|
156 | new double[] { 1.8436, 2.1279, 3.1166, 1.6886, 3.2505, 2.9613, 2.3260, 1.7293, 1.7697, 2.3982 },
|
---|
157 | new double[][]
|
---|
158 | {
|
---|
159 | new double[] { 0.4173, 0.0497, 0.9027, 0.9448, 0.4909, 0.4893, 0.3377, 0.9001, 0.3692, 0.1112 },
|
---|
160 | new double[] { 0.7803, 0.3897, 0.2417, 0.4039, 0.0965, 0.1320, 0.9421, 0.9561, 0.5752, 0.0598 },
|
---|
161 | new double[] { 0.2348, 0.3532, 0.8212, 0.0154, 0.0430, 0.1690, 0.6491, 0.7317, 0.6477, 0.4509 },
|
---|
162 | new double[] { 0.5470, 0.2963, 0.7447, 0.1890, 0.6868, 0.1835, 0.3685, 0.6256, 0.7802, 0.0811 },
|
---|
163 | new double[] { 0.9294, 0.7757, 0.4868, 0.4359, 0.4468, 0.3063, 0.5085, 0.5108, 0.8176, 0.7948 }
|
---|
164 | }
|
---|
165 | );
|
---|
166 | }
|
---|
167 |
|
---|
168 | [TestMethod]
|
---|
169 | public void CovSeIsoTest() {
|
---|
170 | TestCovarianceFunction(new CovarianceSEiso(), 0,
|
---|
171 | new double[,]
|
---|
172 | {
|
---|
173 | { 0.5771, 0.5404, 0.8569, 0.5612, 0.7545, 0.4980, 0.6649, 0.7484, 0.6564, 0.8184},
|
---|
174 | { 0.6206, 0.7027, 0.7091, 0.6015, 0.7295, 0.5338, 0.6705, 0.8202, 0.7155, 0.8029},
|
---|
175 | { 0.7743, 0.7513, 0.8468, 0.6865, 0.5645, 0.7861, 0.8404, 0.6625, 0.7555, 0.8335},
|
---|
176 | { 0.7773, 0.5513, 0.7792, 0.7166, 0.4534, 0.5870, 0.8913, 0.8796, 0.8656, 0.8245},
|
---|
177 | { 0.8839, 0.5934, 0.7689, 0.8982, 0.4126, 0.4741, 0.7883, 0.9201, 0.9077, 0.8649},
|
---|
178 | { 0.8746, 0.7341, 0.7020, 0.8323, 0.4826, 0.5922, 0.8706, 0.9508, 0.9524, 0.8660},
|
---|
179 | { 0.6133, 0.7560, 0.7280, 0.5749, 0.8722, 0.5651, 0.6530, 0.6260, 0.6633, 0.8195},
|
---|
180 | { 0.6113, 0.6277, 0.8110, 0.5489, 0.7110, 0.6221, 0.6948, 0.5425, 0.6227, 0.7828},
|
---|
181 | { 0.6394, 0.6950, 0.8669, 0.6107, 0.7933, 0.5985, 0.6823, 0.6858, 0.6702, 0.8492},
|
---|
182 | { 0.5790, 0.7156, 0.6274, 0.5324, 0.6323, 0.6100, 0.6863, 0.8091, 0.6855, 0.7173},
|
---|
183 | },
|
---|
184 | new double[][,]
|
---|
185 | {
|
---|
186 | new double[,] {
|
---|
187 | { 0.6345, 0.6652, 0.2647, 0.6484, 0.4251, 0.6943, 0.5427, 0.4338, 0.5527, 0.3280},
|
---|
188 | { 0.5921, 0.4959, 0.4876, 0.6115, 0.4601, 0.6702, 0.5360, 0.3252, 0.4791, 0.3526},
|
---|
189 | { 0.3961, 0.4296, 0.2816, 0.5165, 0.6456, 0.3784, 0.2923, 0.5455, 0.4237, 0.3036},
|
---|
190 | { 0.3916, 0.6566, 0.3888, 0.4777, 0.7173, 0.6255, 0.2051, 0.2256, 0.2498, 0.3182},
|
---|
191 | { 0.2181, 0.6194, 0.4041, 0.1929, 0.7305, 0.7077, 0.3750, 0.1532, 0.1758, 0.2510},
|
---|
192 | { 0.2344, 0.4538, 0.4967, 0.3056, 0.7032, 0.6205, 0.2413, 0.0960, 0.0929, 0.2492},
|
---|
193 | { 0.5996, 0.4229, 0.4622, 0.6365, 0.2384, 0.6451, 0.5566, 0.5865, 0.5446, 0.3263},
|
---|
194 | { 0.6017, 0.5846, 0.3398, 0.6585, 0.4850, 0.5905, 0.5060, 0.6636, 0.5900, 0.3834},
|
---|
195 | { 0.5719, 0.5057, 0.2476, 0.6023, 0.3674, 0.6144, 0.5216, 0.5174, 0.5364, 0.2776},
|
---|
196 | { 0.6327, 0.4789, 0.5849, 0.6712, 0.5796, 0.6030, 0.5167, 0.3428, 0.5177, 0.4767},
|
---|
197 | },
|
---|
198 | new double[,] {
|
---|
199 | { 1.1542, 1.0808, 1.7137, 1.1224, 1.5090, 0.9961, 1.3298, 1.4968, 1.3127, 1.6369},
|
---|
200 | { 1.2413, 1.4053, 1.4181, 1.2031, 1.4591, 1.0675, 1.3411, 1.6404, 1.4309, 1.6057},
|
---|
201 | { 1.5486, 1.5027, 1.6936, 1.3729, 1.1289, 1.5721, 1.6807, 1.3251, 1.5109, 1.6670},
|
---|
202 | { 1.5547, 1.1026, 1.5584, 1.4331, 0.9067, 1.1739, 1.7826, 1.7593, 1.7313, 1.6490},
|
---|
203 | { 1.7679, 1.1868, 1.5379, 1.7963, 0.8253, 0.9483, 1.5767, 1.8403, 1.8154, 1.7298},
|
---|
204 | { 1.7492, 1.4683, 1.4041, 1.6646, 0.9652, 1.1845, 1.7411, 1.9016, 1.9048, 1.7320},
|
---|
205 | { 1.2267, 1.5121, 1.4560, 1.1498, 1.7445, 1.1302, 1.3060, 1.2519, 1.3266, 1.6389},
|
---|
206 | { 1.2227, 1.2555, 1.6220, 1.0978, 1.4220, 1.2443, 1.3896, 1.0850, 1.2454, 1.5656},
|
---|
207 | { 1.2789, 1.3900, 1.7339, 1.2214, 1.5866, 1.1971, 1.3647, 1.3715, 1.3404, 1.6984},
|
---|
208 | { 1.1581, 1.4312, 1.2549, 1.0647, 1.2647, 1.2200, 1.3726, 1.6182, 1.3709, 1.4346},
|
---|
209 | }
|
---|
210 | }
|
---|
211 | );
|
---|
212 | TestCovarianceFunction(new CovarianceSEiso(), 1,
|
---|
213 | new double[,]
|
---|
214 | {
|
---|
215 | { 6.8592, 6.7985, 7.2362, 6.8334, 7.1127, 6.7239, 6.9920, 7.1048, 6.9798, 7.1914},
|
---|
216 | { 6.9271, 7.0445, 7.0531, 6.8979, 7.0803, 6.7872, 7.0000, 7.1935, 7.0617, 7.1727},
|
---|
217 | { 7.1376, 7.1086, 7.2246, 7.0223, 6.8388, 7.1522, 7.2172, 6.9886, 7.1139, 7.2091},
|
---|
218 | { 7.1414, 6.8169, 7.1438, 7.0632, 6.6389, 6.8750, 7.2749, 7.2619, 7.2462, 7.1986},
|
---|
219 | { 7.2667, 6.8852, 7.1309, 7.2824, 6.5548, 6.6792, 7.1550, 7.3063, 7.2929, 7.2454},
|
---|
220 | { 7.2563, 7.0864, 7.0436, 7.2078, 6.6953, 6.8834, 7.2517, 7.3388, 7.3405, 7.2466},
|
---|
221 | { 6.9160, 7.1146, 7.0783, 6.8557, 7.2536, 6.8398, 6.9750, 6.9351, 6.9897, 7.1926},
|
---|
222 | { 6.9130, 6.9378, 7.1825, 6.8129, 7.0557, 6.9294, 7.0338, 6.8021, 6.9302, 7.1482},
|
---|
223 | { 6.9551, 7.0340, 7.2476, 6.9120, 7.1611, 6.8932, 7.0166, 7.0213, 6.9995, 7.2274},
|
---|
224 | { 6.8624, 7.0619, 6.9373, 6.7848, 6.9446, 6.9109, 7.0221, 7.1802, 7.0209, 7.0642},
|
---|
225 | },
|
---|
226 | new double[][,]
|
---|
227 | {
|
---|
228 | new double[,] {
|
---|
229 | { 1.0207, 1.1326, 0.3026, 1.0685, 0.5423, 1.2686, 0.7724, 0.5574, 0.7955, 0.3900},
|
---|
230 | { 0.8944, 0.6729, 0.6564, 0.9490, 0.6043, 1.1534, 0.7573, 0.3860, 0.6400, 0.4263},
|
---|
231 | { 0.4942, 0.5501, 0.3252, 0.7151, 1.0586, 0.4660, 0.3398, 0.7787, 0.5400, 0.3554},
|
---|
232 | { 0.4868, 1.0987, 0.4824, 0.6372, 1.4215, 0.9914, 0.2266, 0.2521, 0.2830, 0.3760},
|
---|
233 | { 0.2427, 0.9726, 0.5072, 0.2117, 1.5705, 1.3491, 0.4606, 0.1646, 0.1911, 0.2846},
|
---|
234 | { 0.2632, 0.5928, 0.6745, 0.3581, 1.3203, 0.9760, 0.2721, 0.1002, 0.0969, 0.2822},
|
---|
235 | { 0.9151, 0.5386, 0.6082, 1.0272, 0.2684, 1.0567, 0.8045, 0.8794, 0.7766, 0.3876},
|
---|
236 | { 0.9208, 0.8744, 0.4072, 1.1062, 0.6514, 0.8901, 0.6932, 1.1260, 0.8886, 0.4738},
|
---|
237 | { 0.8418, 0.6927, 0.2801, 0.9226, 0.4489, 0.9576, 0.7259, 0.7169, 0.7582, 0.3198},
|
---|
238 | { 1.0149, 0.6396, 0.8752, 1.1578, 0.8615, 0.9246, 0.7154, 0.4117, 0.7177, 0.6353},
|
---|
239 | },
|
---|
240 | new double[,] {
|
---|
241 | { 13.7185, 13.5970, 14.4724, 13.6668, 14.2254, 13.4477, 13.9840, 14.2096, 13.9596, 14.3828},
|
---|
242 | { 13.8542, 14.0889, 14.1062, 13.7957, 14.1607, 13.5743, 14.0000, 14.3869, 14.1234, 14.3454},
|
---|
243 | { 14.2753, 14.2173, 14.4492, 14.0445, 13.6775, 14.3044, 14.4343, 13.9773, 14.2278, 14.4183},
|
---|
244 | { 14.2829, 13.6339, 14.2875, 14.1263, 13.2777, 13.7501, 14.5498, 14.5238, 14.4923, 14.3972},
|
---|
245 | { 14.5334, 13.7703, 14.2618, 14.5649, 13.1097, 13.3585, 14.3100, 14.6126, 14.5857, 14.4907},
|
---|
246 | { 14.5125, 14.1727, 14.0872, 14.4155, 13.3905, 13.7667, 14.5035, 14.6775, 14.6809, 14.4932},
|
---|
247 | { 13.8321, 14.2292, 14.1566, 13.7114, 14.5073, 13.6796, 13.9499, 13.8703, 13.9795, 14.3852},
|
---|
248 | { 13.8260, 13.8756, 14.3651, 13.6258, 14.1115, 13.8588, 14.0675, 13.6042, 13.8604, 14.2964},
|
---|
249 | { 13.9103, 14.0681, 14.4953, 13.8241, 14.3221, 13.7864, 14.0331, 14.0426, 13.9991, 14.4548},
|
---|
250 | { 13.7248, 14.1238, 13.8747, 13.5695, 13.8893, 13.8218, 14.0442, 14.3604, 14.0418, 14.1283},
|
---|
251 | },
|
---|
252 | }
|
---|
253 | );
|
---|
254 | }
|
---|
255 |
|
---|
256 |
|
---|
257 | [TestMethod]
|
---|
258 | public void CovLinearTest() {
|
---|
259 | TestCovarianceFunction(new CovarianceLinear(), 0,
|
---|
260 | new double[,]
|
---|
261 | {
|
---|
262 | { 0.9089, 0.9972, 1.8813, 0.8618, 2.0021, 1.5168, 1.2612, 1.1009, 0.9505, 1.3851},
|
---|
263 | { 0.4654, 0.7436, 1.1758, 0.4150, 1.4523, 1.0699, 0.7535, 0.6763, 0.5205, 0.8497},
|
---|
264 | { 1.3720, 1.4959, 2.0386, 1.2323, 1.8810, 2.1422, 1.6645, 1.1482, 1.2602, 1.5724},
|
---|
265 | { 0.8471, 0.6576, 1.4266, 0.7465, 1.1331, 1.3214, 1.1946, 0.9028, 0.8676, 1.0329},
|
---|
266 | { 0.7965, 0.5520, 1.2342, 0.7932, 0.8598, 0.9288, 0.8927, 0.7687, 0.7359, 0.9016},
|
---|
267 | { 0.5306, 0.5096, 0.8879, 0.4618, 0.7612, 0.8960, 0.7367, 0.5462, 0.5287, 0.6475},
|
---|
268 | { 0.8779, 1.2411, 1.6264, 0.7940, 2.0552, 1.5512, 1.1513, 0.8304, 0.8692, 1.2945},
|
---|
269 | { 1.4220, 1.6026, 2.2818, 1.2951, 2.3982, 2.1948, 1.7607, 1.2346, 1.3533, 1.7961},
|
---|
270 | { 1.0930, 1.3304, 1.9745, 1.0278, 2.1338, 1.7821, 1.3686, 1.0951, 1.0529, 1.5035},
|
---|
271 | { 0.3406, 0.7064, 0.9980, 0.2373, 1.2538, 1.1479, 0.7212, 0.6072, 0.4222, 0.6815},
|
---|
272 | },
|
---|
273 | new double[][,]
|
---|
274 | {
|
---|
275 | }
|
---|
276 | );
|
---|
277 | }
|
---|
278 |
|
---|
279 | [TestMethod]
|
---|
280 | public void CovPeriodicTest() {
|
---|
281 | TestCovarianceFunction(new CovariancePeriodic(), 0,
|
---|
282 | new double[,]
|
---|
283 | {
|
---|
284 | { 0.9548, 0.7965, 0.1438, 0.8971, 0.3692, 0.5608, 0.8367, 0.3951, 0.8773, 0.1881},
|
---|
285 | { 0.9894, 0.6290, 0.5931, 0.9987, 0.4838, 0.7608, 0.8078, 0.1852, 0.5579, 0.2184},
|
---|
286 | { 0.2962, 0.3824, 0.1517, 0.7208, 0.9105, 0.2604, 0.1580, 0.8483, 0.3653, 0.1660},
|
---|
287 | { 0.2864, 0.8521, 0.2806, 0.5519, 0.3502, 0.9797, 0.1364, 0.1354, 0.1391, 0.1784},
|
---|
288 | { 0.1354, 0.9908, 0.3145, 0.1389, 0.2266, 0.4391, 0.2541, 0.1592, 0.1452, 0.1394},
|
---|
289 | { 0.1362, 0.4609, 0.6325, 0.1675, 0.4801, 0.9891, 0.1372, 0.2435, 0.2512, 0.1389},
|
---|
290 | { 0.9975, 0.3630, 0.4916, 0.9481, 0.1367, 0.9130, 0.8921, 0.9800, 0.8445, 0.1864},
|
---|
291 | { 0.9988, 0.9762, 0.2016, 0.8402, 0.5823, 0.9870, 0.6736, 0.8076, 0.9861, 0.2698},
|
---|
292 | { 0.9440, 0.6724, 0.1385, 0.9991, 0.2411, 0.9966, 0.7439, 0.7247, 0.8095, 0.1496},
|
---|
293 | { 0.9605, 0.5569, 0.9769, 0.7531, 0.9651, 0.9994, 0.7216, 0.2054, 0.7264, 0.5478},
|
---|
294 | },
|
---|
295 | new double[][,]
|
---|
296 | {
|
---|
297 | new double[,]
|
---|
298 | {
|
---|
299 | { 0.0883, 0.3624, 0.5578, 0.1949, 0.7358, 0.6487, 0.2984, 0.7338, 0.2296, 0.6286},
|
---|
300 | { 0.0211, 0.5833, 0.6197, 0.0027, 0.7026, 0.4160, 0.3448, 0.6246, 0.6512, 0.6645},
|
---|
301 | { 0.7208, 0.7352, 0.5721, 0.4719, 0.1707, 0.7008, 0.5831, 0.2792, 0.7357, 0.5962},
|
---|
302 | { 0.7162, 0.2728, 0.7132, 0.6561, 0.7349, 0.0401, 0.5435, 0.5416, 0.5487, 0.6150},
|
---|
303 | { 0.5414, 0.0183, 0.7276, 0.5484, 0.6728, 0.7228, 0.6963, 0.5851, 0.5603, 0.5493},
|
---|
304 | { 0.5430, 0.7140, 0.5794, 0.5986, 0.7046, 0.0216, 0.5451, 0.6879, 0.6941, 0.5484},
|
---|
305 | { 0.0050, 0.7357, 0.6982, 0.1011, 0.5441, 0.1662, 0.2038, 0.0396, 0.2855, 0.6263},
|
---|
306 | { 0.0025, 0.0470, 0.6457, 0.2925, 0.6298, 0.0258, 0.5324, 0.3451, 0.0275, 0.7069},
|
---|
307 | { 0.1088, 0.5338, 0.5476, 0.0019, 0.6859, 0.0068, 0.4402, 0.4667, 0.3421, 0.5684},
|
---|
308 | { 0.0774, 0.6520, 0.0457, 0.4271, 0.0686, 0.0013, 0.4709, 0.6502, 0.4644, 0.6594},
|
---|
309 | },
|
---|
310 | new double[,]
|
---|
311 | {
|
---|
312 | { 1.8911, 3.5259, -0.1726, 2.7462, -1.7412, 3.7725, -2.7071, -1.8853, -2.5019, -0.5552},
|
---|
313 | { -0.8840, -2.8021, -2.7150, 0.3273, -2.3218, 3.6802, -2.8022, -0.5330, -2.6079, -0.7758},
|
---|
314 | { -1.2996, -1.8154, -0.2547, -2.9071, 2.5861, -1.0654, -0.3131, -2.6579, -1.7190, -0.3814},
|
---|
315 | { -1.2366, 3.1709, -1.1989, -2.5877, 2.7645, 1.2794, 0.0523, -0.0174, -0.1087, -0.4806},
|
---|
316 | { 0.0086, 0.8629, -1.4146, 0.0921, 1.6565, 3.3174, -1.0231, 0.2231, 0.1477, -0.1137},
|
---|
317 | { -0.0491, -2.2183, -2.8095, -0.3938, 3.5099, 0.9382, -0.0753, 0.4427, 0.4556, -0.1062},
|
---|
318 | { -0.4372, -1.7059, -2.3555, 2.0194, -0.0642, 2.5547, -2.4014, -1.1924, -2.6748, -0.5422},
|
---|
319 | { -0.3101, -1.2911, -0.6547, 3.2602, -2.6843, -0.9727, -2.8761, 3.4673, -1.0044, -1.1276},
|
---|
320 | { -1.8766, -2.8747, -0.0998, -0.2703, -0.9342, 0.5245, -2.9018, -2.9072, -2.7976, -0.2342},
|
---|
321 | { 1.7731, -2.6049, -1.2740, 3.7069, -1.5344, -0.2241, -2.9071, -0.6824, -2.9071, -2.5738},
|
---|
322 | },
|
---|
323 | new double[,]
|
---|
324 | {
|
---|
325 | { 1.9096, 1.5931, 0.2877, 1.7941, 0.7384, 1.1215, 1.6733, 0.7902, 1.7547, 0.3763},
|
---|
326 | { 1.9788, 1.2580, 1.1862, 1.9973, 0.9676, 1.5216, 1.6156, 0.3704, 1.1157, 0.4367},
|
---|
327 | { 0.5925, 0.7648, 0.3033, 1.4416, 1.8211, 0.5208, 0.3160, 1.6965, 0.7306, 0.3320},
|
---|
328 | { 0.5729, 1.7041, 0.5612, 1.1037, 0.7004, 1.9595, 0.2729, 0.2709, 0.2781, 0.3568},
|
---|
329 | { 0.2707, 1.9816, 0.6289, 0.2779, 0.4531, 0.8782, 0.5082, 0.3184, 0.2903, 0.2788},
|
---|
330 | { 0.2723, 0.9219, 1.2651, 0.3350, 0.9602, 1.9782, 0.2744, 0.4870, 0.5024, 0.2778},
|
---|
331 | { 1.9950, 0.7261, 0.9832, 1.8961, 0.2735, 1.8260, 1.7841, 1.9600, 1.6889, 0.3729},
|
---|
332 | { 1.9975, 1.9524, 0.4031, 1.6805, 1.1645, 1.9741, 1.3471, 1.6152, 1.9723, 0.5395},
|
---|
333 | { 1.8880, 1.3447, 0.2770, 1.9981, 0.4821, 1.9932, 1.4877, 1.4494, 1.6190, 0.2991},
|
---|
334 | { 1.9210, 1.1139, 1.9538, 1.5061, 1.9301, 1.9987, 1.4432, 0.4107, 1.4528, 1.0956},
|
---|
335 | },
|
---|
336 | }
|
---|
337 | );
|
---|
338 | TestCovarianceFunction(new CovariancePeriodic(), 1,
|
---|
339 | new double[,]
|
---|
340 | {
|
---|
341 | { 5.8283, 5.7618, 6.7049, 5.7980, 6.3126, 5.7012, 6.0358, 6.2917, 6.0128, 6.5482},
|
---|
342 | { 5.9230, 6.1447, 6.1643, 5.8794, 6.2291, 5.7511, 6.0513, 6.5551, 6.1842, 6.4880},
|
---|
343 | { 6.3822, 6.3018, 6.6628, 6.0966, 5.8040, 6.4250, 6.6362, 6.0294, 6.3159, 6.6082},
|
---|
344 | { 6.3932, 5.7803, 6.4000, 6.1876, 5.6577, 5.8483, 6.8550, 6.8032, 6.7423, 6.5723},
|
---|
345 | { 6.8221, 5.8618, 6.3630, 6.8860, 5.6385, 5.6752, 6.4334, 6.9877, 6.9298, 6.7393},
|
---|
346 | { 6.7811, 6.2441, 6.1428, 6.6035, 5.6837, 5.8594, 6.7636, 7.1358, 7.1438, 6.7439},
|
---|
347 | { 5.9060, 6.3179, 6.2241, 5.8240, 6.7709, 5.8052, 6.0040, 5.9357, 6.0315, 6.5522},
|
---|
348 | { 5.9014, 5.9400, 6.5193, 5.7761, 6.1703, 5.9266, 6.1211, 5.7652, 5.9278, 6.4131},
|
---|
349 | { 5.9689, 6.1217, 6.7479, 5.9000, 6.4518, 5.8729, 6.0847, 6.0946, 6.0504, 6.6728},
|
---|
350 | { 5.8322, 6.1847, 5.9393, 5.7489, 5.9512, 5.8983, 6.0962, 6.5118, 6.0937, 6.1900},
|
---|
351 | },
|
---|
352 | new double[][,]
|
---|
353 | {
|
---|
354 | new double[,]
|
---|
355 | {
|
---|
356 | { 2.7658, 2.8666, 1.3028, 2.8119, 1.9878, 2.9569, 2.4420, 2.0231, 2.4786, 1.5821},
|
---|
357 | { 2.6198, 2.2663, 2.2343, 2.6874, 2.1274, 2.8825, 2.4171, 1.5700, 2.2016, 1.6875},
|
---|
358 | { 1.8698, 2.0061, 1.3786, 2.3444, 2.8027, 1.7965, 1.4262, 2.4522, 1.9823, 1.4760},
|
---|
359 | { 1.8510, 2.8387, 1.8395, 2.1959, 3.0210, 2.7352, 1.0285, 1.1240, 1.2352, 1.5397},
|
---|
360 | { 1.0892, 2.7145, 1.9025, 0.9710, 3.0490, 2.9953, 1.7820, 0.7805, 0.8894, 1.2407},
|
---|
361 | { 1.1645, 2.1025, 2.2694, 1.4845, 2.9828, 2.7182, 1.1965, 0.4978, 0.4823, 1.2323},
|
---|
362 | { 2.6463, 1.9790, 2.1357, 2.7724, 1.1832, 2.8010, 2.4926, 2.6000, 2.4488, 1.5751},
|
---|
363 | { 2.6534, 2.5933, 1.6329, 2.8450, 2.2244, 2.6143, 2.3047, 2.8613, 2.6123, 1.8170},
|
---|
364 | { 2.5480, 2.3036, 1.2251, 2.6556, 1.7503, 2.6975, 2.3636, 2.3476, 2.4186, 1.3608},
|
---|
365 | { 2.7599, 2.2008, 2.5944, 2.8858, 2.5757, 2.6581, 2.3450, 1.6460, 2.3490, 2.1920},
|
---|
366 | },
|
---|
367 | new double[,]
|
---|
368 | {
|
---|
369 | { 1.2575, 1.0910, 1.1185, 1.1908, 1.4623, 0.8439, 1.4825, 1.4718, 1.4712, 1.2892},
|
---|
370 | { 1.3993, 1.5049, 1.5043, 1.3445, 1.4935, 1.0563, 1.4887, 1.2825, 1.5024, 1.3439},
|
---|
371 | { 1.4231, 1.4673, 1.1682, 1.5008, 1.2052, 1.3938, 1.1981, 1.4796, 1.4607, 1.2285},
|
---|
372 | { 1.4160, 1.1451, 1.4114, 1.5019, 0.5165, 1.2949, 0.9209, 0.9927, 1.0722, 1.2656},
|
---|
373 | { 0.9668, 1.3176, 1.4350, 0.8763, 0.1550, 0.6776, 1.3876, 0.7218, 0.8114, 1.0761},
|
---|
374 | { 1.0221, 1.4893, 1.5049, 1.2335, 0.7388, 1.3137, 1.0450, 0.4752, 0.4611, 1.0702},
|
---|
375 | { 1.3798, 1.4597, 1.4948, 1.2488, 1.0355, 1.2079, 1.4662, 1.4126, 1.4806, 1.2853},
|
---|
376 | { 1.3741, 1.4168, 1.3163, 1.1334, 1.5039, 1.4032, 1.5040, 1.1017, 1.4045, 1.4024},
|
---|
377 | { 1.4421, 1.5040, 1.0652, 1.3723, 1.3735, 1.3349, 1.4984, 1.5004, 1.4883, 1.1567},
|
---|
378 | { 1.2652, 1.5023, 1.4161, 1.0487, 1.4273, 1.3702, 1.5007, 1.3231, 1.5003, 1.5016},
|
---|
379 | },
|
---|
380 | new double[,]
|
---|
381 | {
|
---|
382 | { 11.6566, 11.5235, 13.4099, 11.5959, 12.6253, 11.4024, 12.0716, 12.5834, 12.0256, 13.0964},
|
---|
383 | { 11.8460, 12.2894, 12.3285, 11.7588, 12.4583, 11.5022, 12.1027, 13.1103, 12.3684, 12.9759},
|
---|
384 | { 12.7645, 12.6035, 13.3256, 12.1932, 11.6081, 12.8500, 13.2725, 12.0588, 12.6318, 13.2165},
|
---|
385 | { 12.7864, 11.5605, 12.7999, 12.3753, 11.3155, 11.6967, 13.7101, 13.6063, 13.4846, 13.1446},
|
---|
386 | { 13.6442, 11.7236, 12.7260, 13.7721, 11.2771, 11.3504, 12.8668, 13.9754, 13.8595, 13.4785},
|
---|
387 | { 13.5621, 12.4883, 12.2856, 13.2070, 11.3674, 11.7187, 13.5272, 14.2715, 14.2876, 13.4877},
|
---|
388 | { 11.8120, 12.6357, 12.4483, 11.6480, 13.5417, 11.6104, 12.0079, 11.8714, 12.0630, 13.1045},
|
---|
389 | { 11.8028, 11.8801, 13.0386, 11.5521, 12.3406, 11.8531, 12.2422, 11.5305, 11.8557, 12.8261},
|
---|
390 | { 11.9378, 12.2435, 13.4957, 11.8000, 12.9036, 11.7458, 12.1694, 12.1892, 12.1009, 13.3455},
|
---|
391 | { 11.6644, 12.3694, 11.8785, 11.4978, 11.9025, 11.7967, 12.1924, 13.0236, 12.1874, 12.3800},
|
---|
392 |
|
---|
393 | },
|
---|
394 | }
|
---|
395 | );
|
---|
396 | }
|
---|
397 |
|
---|
398 | [TestMethod]
|
---|
399 | public void CovSEardTest() {
|
---|
400 | TestCovarianceFunction(new CovarianceSEard(), 0,
|
---|
401 | new double[,]
|
---|
402 | {
|
---|
403 | { 0.5771, 0.5404, 0.8569, 0.5612, 0.7545, 0.4980, 0.6649, 0.7484, 0.6564, 0.8184},
|
---|
404 | { 0.6206, 0.7027, 0.7091, 0.6015, 0.7295, 0.5338, 0.6705, 0.8202, 0.7155, 0.8029},
|
---|
405 | { 0.7743, 0.7513, 0.8468, 0.6865, 0.5645, 0.7861, 0.8404, 0.6625, 0.7555, 0.8335},
|
---|
406 | { 0.7773, 0.5513, 0.7792, 0.7166, 0.4534, 0.5870, 0.8913, 0.8796, 0.8656, 0.8245},
|
---|
407 | { 0.8839, 0.5934, 0.7689, 0.8982, 0.4126, 0.4741, 0.7883, 0.9201, 0.9077, 0.8649},
|
---|
408 | { 0.8746, 0.7341, 0.7020, 0.8323, 0.4826, 0.5922, 0.8706, 0.9508, 0.9524, 0.8660},
|
---|
409 | { 0.6133, 0.7560, 0.7280, 0.5749, 0.8722, 0.5651, 0.6530, 0.6260, 0.6633, 0.8195},
|
---|
410 | { 0.6113, 0.6277, 0.8110, 0.5489, 0.7110, 0.6221, 0.6948, 0.5425, 0.6227, 0.7828},
|
---|
411 | { 0.6394, 0.6950, 0.8669, 0.6107, 0.7933, 0.5985, 0.6823, 0.6858, 0.6702, 0.8492},
|
---|
412 | { 0.5790, 0.7156, 0.6274, 0.5324, 0.6323, 0.6100, 0.6863, 0.8091, 0.6855, 0.7173},
|
---|
413 |
|
---|
414 | },
|
---|
415 | new double[][,]
|
---|
416 | {
|
---|
417 | new double[,]
|
---|
418 | {
|
---|
419 | { 0.0297, 0.0008, 0.1332, 0.0075, 0.0033, 0.1356, 0.1399, 0.0132, 0.0276, 0.0236},
|
---|
420 | { 0.2195, 0.0760, 0.4116, 0.1404, 0.0661, 0.4222, 0.4578, 0.2055, 0.2348, 0.2319},
|
---|
421 | { 0.0517, 0.2064, 0.0070, 0.0939, 0.1720, 0.0010, 0.0006, 0.0824, 0.0593, 0.0831},
|
---|
422 | { 0.0702, 0.1767, 0.0138, 0.1216, 0.1600, 0.0000, 0.0042, 0.1370, 0.0899, 0.1055},
|
---|
423 | { 0.0208, 0.0075, 0.0791, 0.0016, 0.0081, 0.0952, 0.1169, 0.0032, 0.0157, 0.0080},
|
---|
424 | { 0.0210, 0.0090, 0.0729, 0.0016, 0.0093, 0.1198, 0.1302, 0.0035, 0.0169, 0.0083},
|
---|
425 | { 0.0577, 0.0013, 0.1635, 0.0219, 0.0001, 0.2043, 0.1892, 0.0282, 0.0538, 0.0509},
|
---|
426 | { 0.0400, 0.1707, 0.0063, 0.0740, 0.2146, 0.0009, 0.0004, 0.0664, 0.0480, 0.0767},
|
---|
427 | { 0.0484, 0.0001, 0.1696, 0.0163, 0.0003, 0.1943, 0.1752, 0.0224, 0.0430, 0.0403},
|
---|
428 | { 0.1646, 0.0512, 0.3078, 0.0946, 0.0363, 0.4180, 0.4014, 0.1559, 0.1792, 0.1624},
|
---|
429 | },
|
---|
430 | new double[,]
|
---|
431 | {
|
---|
432 | { 0.1891, 0.1240, 0.0820, 0.1696, 0.0031, 0.1707, 0.2043, 0.2781, 0.2004, 0.0972},
|
---|
433 | { 0.0206, 0.0055, 0.0047, 0.0153, 0.1507, 0.0203, 0.0180, 0.0393, 0.0188, 0.0017},
|
---|
434 | { 0.0009, 0.0027, 0.0445, 0.0001, 0.2050, 0.0017, 0.0002, 0.0033, 0.0001, 0.0314},
|
---|
435 | { 0.0299, 0.0058, 0.0035, 0.0216, 0.0879, 0.0257, 0.0282, 0.0478, 0.0269, 0.0008},
|
---|
436 | { 0.0109, 0.0249, 0.1078, 0.0161, 0.2308, 0.0046, 0.0132, 0.0051, 0.0156, 0.0995},
|
---|
437 | { 0.0050, 0.0210, 0.0807, 0.0081, 0.2449, 0.0023, 0.0077, 0.0014, 0.0087, 0.0799},
|
---|
438 | { 0.3307, 0.3104, 0.1616, 0.2911, 0.0083, 0.3156, 0.3349, 0.3724, 0.3385, 0.2101},
|
---|
439 | { 0.3424, 0.2692, 0.1909, 0.2890, 0.0089, 0.3606, 0.3705, 0.3347, 0.3304, 0.2120},
|
---|
440 | { 0.0863, 0.0522, 0.0094, 0.0726, 0.0574, 0.0866, 0.0832, 0.1122, 0.0810, 0.0165},
|
---|
441 | { 0.0127, 0.0417, 0.1061, 0.0155, 0.3892, 0.0111, 0.0189, 0.0100, 0.0193, 0.1014},
|
---|
442 | },
|
---|
443 | new double[,]
|
---|
444 | {
|
---|
445 | { 0.0034, 0.2562, 0.0327, 0.0014, 0.3388, 0.2764, 0.0277, 0.0114, 0.0004, 0.0248},
|
---|
446 | { 0.0011, 0.2285, 0.0042, 0.0170, 0.2221, 0.2096, 0.0049, 0.0480, 0.0065, 0.0025},
|
---|
447 | { 0.2015, 0.0078, 0.1295, 0.2780, 0.0040, 0.0198, 0.1228, 0.3341, 0.2396, 0.1418},
|
---|
448 | { 0.0680, 0.4545, 0.1341, 0.0206, 0.3587, 0.5459, 0.1598, 0.0081, 0.0510, 0.1276},
|
---|
449 | { 0.0635, 0.4599, 0.1153, 0.0181, 0.3065, 0.4160, 0.1235, 0.0043, 0.0420, 0.1157},
|
---|
450 | { 0.0177, 0.4178, 0.0479, 0.0002, 0.2613, 0.3893, 0.0634, 0.0032, 0.0076, 0.0498},
|
---|
451 | { 0.0701, 0.0569, 0.0349, 0.1239, 0.0571, 0.0618, 0.0289, 0.1812, 0.1014, 0.0474},
|
---|
452 | { 0.1082, 0.0231, 0.0737, 0.1642, 0.0213, 0.0383, 0.0596, 0.2089, 0.1397, 0.0817},
|
---|
453 | { 0.0725, 0.0528, 0.0410, 0.1309, 0.0525, 0.0660, 0.0298, 0.1975, 0.1018, 0.0485},
|
---|
454 | { 0.0113, 0.1597, 0.0003, 0.0377, 0.1303, 0.1706, 0.0001, 0.0934, 0.0255, 0.0013},
|
---|
455 | },
|
---|
456 | new double[,]
|
---|
457 | {
|
---|
458 | { 0.0013, 0.0438, 0.0027, 0.0151, 0.0798, 0.0919, 0.0417, 0.0390, 0.0099, 0.0013},
|
---|
459 | { 0.0553, 0.0008, 0.0666, 0.1035, 0.0041, 0.0171, 0.0000, 0.0004, 0.0117, 0.0359},
|
---|
460 | { 0.0174, 0.1749, 0.0170, 0.0008, 0.1544, 0.3093, 0.1687, 0.1202, 0.0776, 0.0468},
|
---|
461 | { 0.1281, 0.0030, 0.1335, 0.1954, 0.0005, 0.0030, 0.0103, 0.0148, 0.0479, 0.0839},
|
---|
462 | { 0.0075, 0.1070, 0.0054, 0.0005, 0.0892, 0.1537, 0.1200, 0.1246, 0.0626, 0.0277},
|
---|
463 | { 0.1480, 0.0045, 0.1234, 0.2318, 0.0007, 0.0026, 0.0111, 0.0174, 0.0552, 0.0911},
|
---|
464 | { 0.0314, 0.0085, 0.0400, 0.0675, 0.0188, 0.0356, 0.0034, 0.0015, 0.0021, 0.0159},
|
---|
465 | { 0.0006, 0.0829, 0.0004, 0.0040, 0.1160, 0.1607, 0.0752, 0.0511, 0.0253, 0.0109},
|
---|
466 | { 0.0220, 0.1865, 0.0273, 0.0029, 0.2474, 0.2629, 0.1595, 0.1460, 0.0850, 0.0630},
|
---|
467 | { 0.1528, 0.0235, 0.1708, 0.2114, 0.0125, 0.0008, 0.0319, 0.0457, 0.0807, 0.1306},
|
---|
468 | },
|
---|
469 | new double[,]
|
---|
470 | {
|
---|
471 | { 0.4109, 0.2403, 0.0141, 0.4547, 0.0000, 0.0197, 0.1292, 0.0921, 0.3144, 0.1812},
|
---|
472 | { 0.2957, 0.1851, 0.0005, 0.3352, 0.0171, 0.0011, 0.0553, 0.0319, 0.2074, 0.0806},
|
---|
473 | { 0.1247, 0.0378, 0.0836, 0.1437, 0.1103, 0.0466, 0.0000, 0.0056, 0.0470, 0.0007},
|
---|
474 | { 0.0954, 0.0166, 0.1039, 0.1185, 0.1102, 0.0509, 0.0025, 0.0179, 0.0341, 0.0004},
|
---|
475 | { 0.1154, 0.0202, 0.0965, 0.1566, 0.0959, 0.0381, 0.0014, 0.0160, 0.0398, 0.0001},
|
---|
476 | { 0.0427, 0.0014, 0.1718, 0.0639, 0.1870, 0.1065, 0.0289, 0.0704, 0.0045, 0.0201},
|
---|
477 | { 0.1097, 0.0458, 0.0623, 0.1321, 0.1541, 0.0278, 0.0003, 0.0031, 0.0488, 0.0020},
|
---|
478 | { 0.1106, 0.0387, 0.0683, 0.1273, 0.1243, 0.0300, 0.0003, 0.0025, 0.0466, 0.0021},
|
---|
479 | { 0.3427, 0.2142, 0.0002, 0.3796, 0.0098, 0.0046, 0.0739, 0.0392, 0.2257, 0.1093},
|
---|
480 | { 0.2913, 0.2028, 0.0000, 0.3120, 0.0114, 0.0025, 0.0644, 0.0379, 0.2131, 0.0810},
|
---|
481 | },
|
---|
482 | new double[,]
|
---|
483 | {
|
---|
484 | { 1.1542, 1.0808, 1.7137, 1.1224, 1.5090, 0.9961, 1.3298, 1.4968, 1.3127, 1.6369},
|
---|
485 | { 1.2413, 1.4053, 1.4181, 1.2031, 1.4591, 1.0675, 1.3411, 1.6404, 1.4309, 1.6057},
|
---|
486 | { 1.5486, 1.5027, 1.6936, 1.3729, 1.1289, 1.5721, 1.6807, 1.3251, 1.5109, 1.6670},
|
---|
487 | { 1.5547, 1.1026, 1.5584, 1.4331, 0.9067, 1.1739, 1.7826, 1.7593, 1.7313, 1.6490},
|
---|
488 | { 1.7679, 1.1868, 1.5379, 1.7963, 0.8253, 0.9483, 1.5767, 1.8403, 1.8154, 1.7298},
|
---|
489 | { 1.7492, 1.4683, 1.4041, 1.6646, 0.9652, 1.1845, 1.7411, 1.9016, 1.9048, 1.7320},
|
---|
490 | { 1.2267, 1.5121, 1.4560, 1.1498, 1.7445, 1.1302, 1.3060, 1.2519, 1.3266, 1.6389},
|
---|
491 | { 1.2227, 1.2555, 1.6220, 1.0978, 1.4220, 1.2443, 1.3896, 1.0850, 1.2454, 1.5656},
|
---|
492 | { 1.2789, 1.3900, 1.7339, 1.2214, 1.5866, 1.1971, 1.3647, 1.3715, 1.3404, 1.6984},
|
---|
493 | { 1.1581, 1.4312, 1.2549, 1.0647, 1.2647, 1.2200, 1.3726, 1.6182, 1.3709, 1.4346},
|
---|
494 | },
|
---|
495 | }
|
---|
496 | );
|
---|
497 | TestCovarianceFunction(new CovarianceSEard(), 1,
|
---|
498 | new double[,]
|
---|
499 | {
|
---|
500 | { 6.8592, 6.7985, 7.2362, 6.8334, 7.1127, 6.7239, 6.9920, 7.1048, 6.9798, 7.1914},
|
---|
501 | { 6.9271, 7.0445, 7.0531, 6.8979, 7.0803, 6.7872, 7.0000, 7.1935, 7.0617, 7.1727},
|
---|
502 | { 7.1376, 7.1086, 7.2246, 7.0223, 6.8388, 7.1522, 7.2172, 6.9886, 7.1139, 7.2091},
|
---|
503 | { 7.1414, 6.8169, 7.1438, 7.0632, 6.6389, 6.8750, 7.2749, 7.2619, 7.2462, 7.1986},
|
---|
504 | { 7.2667, 6.8852, 7.1309, 7.2824, 6.5548, 6.6792, 7.1550, 7.3063, 7.2929, 7.2454},
|
---|
505 | { 7.2563, 7.0864, 7.0436, 7.2078, 6.6953, 6.8834, 7.2517, 7.3388, 7.3405, 7.2466},
|
---|
506 | { 6.9160, 7.1146, 7.0783, 6.8557, 7.2536, 6.8398, 6.9750, 6.9351, 6.9897, 7.1926},
|
---|
507 | { 6.9130, 6.9378, 7.1825, 6.8129, 7.0557, 6.9294, 7.0338, 6.8021, 6.9302, 7.1482},
|
---|
508 | { 6.9551, 7.0340, 7.2476, 6.9120, 7.1611, 6.8932, 7.0166, 7.0213, 6.9995, 7.2274},
|
---|
509 | { 6.8624, 7.0619, 6.9373, 6.7848, 6.9446, 6.9109, 7.0221, 7.1802, 7.0209, 7.0642},
|
---|
510 | },
|
---|
511 | new double[][,]
|
---|
512 | {
|
---|
513 | new double[,]
|
---|
514 | {
|
---|
515 | { 0.0479, 0.0014, 0.1523, 0.0123, 0.0043, 0.2477, 0.1991, 0.0170, 0.0398, 0.0281},
|
---|
516 | { 0.3315, 0.1032, 0.5541, 0.2179, 0.0869, 0.7265, 0.6468, 0.2439, 0.3136, 0.2803},
|
---|
517 | { 0.0645, 0.2643, 0.0081, 0.1300, 0.2820, 0.0013, 0.0007, 0.1176, 0.0756, 0.0972},
|
---|
518 | { 0.0873, 0.2957, 0.0172, 0.1622, 0.3171, 0.0000, 0.0047, 0.1531, 0.1019, 0.1247},
|
---|
519 | { 0.0232, 0.0117, 0.0993, 0.0017, 0.0174, 0.1815, 0.1436, 0.0035, 0.0171, 0.0091},
|
---|
520 | { 0.0236, 0.0117, 0.0990, 0.0019, 0.0174, 0.1884, 0.1468, 0.0037, 0.0176, 0.0094},
|
---|
521 | { 0.0880, 0.0016, 0.2151, 0.0353, 0.0002, 0.3347, 0.2735, 0.0424, 0.0767, 0.0605},
|
---|
522 | { 0.0612, 0.2553, 0.0076, 0.1243, 0.2881, 0.0014, 0.0006, 0.1127, 0.0723, 0.0948},
|
---|
523 | { 0.0712, 0.0001, 0.1919, 0.0250, 0.0003, 0.3028, 0.2438, 0.0311, 0.0607, 0.0464},
|
---|
524 | { 0.2640, 0.0683, 0.4605, 0.1632, 0.0539, 0.6409, 0.5558, 0.1872, 0.2484, 0.2165},
|
---|
525 |
|
---|
526 | },
|
---|
527 | new double[,]
|
---|
528 | {
|
---|
529 | { 0.3043, 0.2111, 0.0937, 0.2795, 0.0039, 0.3119, 0.2908, 0.3573, 0.2884, 0.1155},
|
---|
530 | { 0.0311, 0.0075, 0.0063, 0.0237, 0.1980, 0.0349, 0.0254, 0.0467, 0.0251, 0.0021},
|
---|
531 | { 0.0011, 0.0034, 0.0514, 0.0001, 0.3361, 0.0021, 0.0002, 0.0048, 0.0002, 0.0367},
|
---|
532 | { 0.0372, 0.0097, 0.0043, 0.0287, 0.1743, 0.0407, 0.0312, 0.0534, 0.0305, 0.0010},
|
---|
533 | { 0.0122, 0.0391, 0.1353, 0.0177, 0.4961, 0.0087, 0.0162, 0.0055, 0.0170, 0.1128},
|
---|
534 | { 0.0056, 0.0275, 0.1095, 0.0095, 0.4598, 0.0037, 0.0087, 0.0015, 0.0091, 0.0905},
|
---|
535 | { 0.5047, 0.3954, 0.2126, 0.4698, 0.0094, 0.5169, 0.4841, 0.5584, 0.4828, 0.2496},
|
---|
536 | { 0.5240, 0.4027, 0.2288, 0.4855, 0.0119, 0.5436, 0.5076, 0.5679, 0.4977, 0.2620},
|
---|
537 | { 0.1271, 0.0714, 0.0107, 0.1112, 0.0702, 0.1350, 0.1159, 0.1555, 0.1144, 0.0190},
|
---|
538 | { 0.0203, 0.0557, 0.1587, 0.0268, 0.5785, 0.0170, 0.0262, 0.0120, 0.0268, 0.1351},
|
---|
539 | },
|
---|
540 | new double[,]
|
---|
541 | {
|
---|
542 | { 0.0054, 0.4363, 0.0374, 0.0023, 0.4322, 0.5050, 0.0394, 0.0147, 0.0005, 0.0294},
|
---|
543 | { 0.0017, 0.3100, 0.0057, 0.0265, 0.2917, 0.3606, 0.0070, 0.0570, 0.0086, 0.0030},
|
---|
544 | { 0.2513, 0.0100, 0.1495, 0.3849, 0.0065, 0.0243, 0.1428, 0.4769, 0.3053, 0.1660},
|
---|
545 | { 0.0845, 0.7606, 0.1664, 0.0274, 0.7108, 0.8653, 0.1766, 0.0090, 0.0577, 0.1507},
|
---|
546 | { 0.0707, 0.7222, 0.1447, 0.0198, 0.6589, 0.7932, 0.1517, 0.0046, 0.0456, 0.1311},
|
---|
547 | { 0.0198, 0.5458, 0.0650, 0.0002, 0.4907, 0.6123, 0.0715, 0.0033, 0.0079, 0.0564},
|
---|
548 | { 0.1069, 0.0724, 0.0459, 0.2000, 0.0642, 0.1012, 0.0417, 0.2717, 0.1447, 0.0563},
|
---|
549 | { 0.1655, 0.0345, 0.0884, 0.2758, 0.0286, 0.0577, 0.0816, 0.3546, 0.2104, 0.1009},
|
---|
550 | { 0.1067, 0.0723, 0.0464, 0.2005, 0.0641, 0.1028, 0.0414, 0.2736, 0.1438, 0.0559},
|
---|
551 | { 0.0182, 0.2133, 0.0004, 0.0650, 0.1937, 0.2616, 0.0001, 0.1122, 0.0353, 0.0017},
|
---|
552 | },
|
---|
553 | new double[,]
|
---|
554 | {
|
---|
555 | { 0.0021, 0.0746, 0.0031, 0.0249, 0.1018, 0.1679, 0.0593, 0.0501, 0.0143, 0.0015},
|
---|
556 | { 0.0836, 0.0011, 0.0897, 0.1607, 0.0053, 0.0294, 0.0000, 0.0005, 0.0156, 0.0434},
|
---|
557 | { 0.0217, 0.2240, 0.0197, 0.0011, 0.2531, 0.3809, 0.1960, 0.1716, 0.0989, 0.0547},
|
---|
558 | { 0.1593, 0.0050, 0.1656, 0.2607, 0.0010, 0.0048, 0.0114, 0.0166, 0.0543, 0.0991},
|
---|
559 | { 0.0083, 0.1680, 0.0068, 0.0006, 0.1918, 0.2930, 0.1474, 0.1339, 0.0681, 0.0314},
|
---|
560 | { 0.1662, 0.0059, 0.1676, 0.2716, 0.0013, 0.0041, 0.0126, 0.0182, 0.0575, 0.1032},
|
---|
561 | { 0.0480, 0.0109, 0.0526, 0.1090, 0.0211, 0.0583, 0.0049, 0.0023, 0.0029, 0.0189},
|
---|
562 | { 0.0009, 0.1240, 0.0005, 0.0068, 0.1558, 0.2422, 0.1030, 0.0867, 0.0381, 0.0134},
|
---|
563 | { 0.0323, 0.2554, 0.0309, 0.0045, 0.3023, 0.4098, 0.2220, 0.2023, 0.1201, 0.0726},
|
---|
564 | { 0.2451, 0.0313, 0.2555, 0.3645, 0.0186, 0.0012, 0.0442, 0.0549, 0.1118, 0.1741},
|
---|
565 | },
|
---|
566 | new double[,]
|
---|
567 | {
|
---|
568 | { 0.6611, 0.4092, 0.0161, 0.7494, 0.0000, 0.0361, 0.1838, 0.1184, 0.4525, 0.2155},
|
---|
569 | { 0.4466, 0.2511, 0.0006, 0.5202, 0.0225, 0.0019, 0.0781, 0.0379, 0.2771, 0.0975},
|
---|
570 | { 0.1555, 0.0484, 0.0965, 0.1990, 0.1809, 0.0574, 0.0000, 0.0080, 0.0599, 0.0008},
|
---|
571 | { 0.1186, 0.0277, 0.1289, 0.1581, 0.2184, 0.0807, 0.0027, 0.0200, 0.0387, 0.0005},
|
---|
572 | { 0.1284, 0.0317, 0.1211, 0.1718, 0.2062, 0.0727, 0.0017, 0.0172, 0.0433, 0.0001},
|
---|
573 | { 0.0479, 0.0018, 0.2333, 0.0749, 0.3511, 0.1675, 0.0326, 0.0736, 0.0047, 0.0228},
|
---|
574 | { 0.1675, 0.0583, 0.0820, 0.2131, 0.1735, 0.0455, 0.0004, 0.0046, 0.0696, 0.0024},
|
---|
575 | { 0.1692, 0.0579, 0.0819, 0.2138, 0.1669, 0.0452, 0.0005, 0.0042, 0.0702, 0.0026},
|
---|
576 | { 0.5045, 0.2934, 0.0003, 0.5815, 0.0120, 0.0071, 0.1028, 0.0543, 0.3190, 0.1259},
|
---|
577 | { 0.4673, 0.2708, 0.0000, 0.5382, 0.0169, 0.0039, 0.0891, 0.0455, 0.2954, 0.1079},
|
---|
578 | },
|
---|
579 | new double[,]
|
---|
580 | {
|
---|
581 | { 13.7185, 13.5970, 14.4724, 13.6668, 14.2254, 13.4477, 13.9840, 14.2096, 13.9596, 14.3828},
|
---|
582 | { 13.8542, 14.0889, 14.1062, 13.7957, 14.1607, 13.5743, 14.0000, 14.3869, 14.1234, 14.3454},
|
---|
583 | { 14.2753, 14.2173, 14.4492, 14.0445, 13.6775, 14.3044, 14.4343, 13.9773, 14.2278, 14.4183},
|
---|
584 | { 14.2829, 13.6339, 14.2875, 14.1263, 13.2777, 13.7501, 14.5498, 14.5238, 14.4923, 14.3972},
|
---|
585 | { 14.5334, 13.7703, 14.2618, 14.5649, 13.1097, 13.3585, 14.3100, 14.6126, 14.5857, 14.4907},
|
---|
586 | { 14.5125, 14.1727, 14.0872, 14.4155, 13.3905, 13.7667, 14.5035, 14.6775, 14.6809, 14.4932},
|
---|
587 | { 13.8321, 14.2292, 14.1566, 13.7114, 14.5073, 13.6796, 13.9499, 13.8703, 13.9795, 14.3852},
|
---|
588 | { 13.8260, 13.8756, 14.3651, 13.6258, 14.1115, 13.8588, 14.0675, 13.6042, 13.8604, 14.2964},
|
---|
589 | { 13.9103, 14.0681, 14.4953, 13.8241, 14.3221, 13.7864, 14.0331, 14.0426, 13.9991, 14.4548},
|
---|
590 | { 13.7248, 14.1238, 13.8747, 13.5695, 13.8893, 13.8218, 14.0442, 14.3604, 14.0418, 14.1283},
|
---|
591 | },
|
---|
592 | }
|
---|
593 | );
|
---|
594 | }
|
---|
595 |
|
---|
596 | [TestMethod]
|
---|
597 | public void CovSumTest() {
|
---|
598 | var cov = new CovarianceSum();
|
---|
599 | cov.Terms.Add(new CovarianceSEiso());
|
---|
600 | cov.Terms.Add(new CovarianceLinear());
|
---|
601 | TestCovarianceFunction(cov, 0,
|
---|
602 | new double[,]
|
---|
603 | {
|
---|
604 | { 1.4860, 1.5376, 2.7382, 1.4230, 2.7566, 2.0148, 1.9261, 1.8493, 1.6069, 2.2035},
|
---|
605 | { 1.0861, 1.4463, 1.8848, 1.0165, 2.1818, 1.6036, 1.4240, 1.4965, 1.2360, 1.6526},
|
---|
606 | { 2.1463, 2.2472, 2.8854, 1.9188, 2.4455, 2.9283, 2.5049, 1.8107, 2.0157, 2.4059},
|
---|
607 | { 1.6245, 1.2089, 2.2059, 1.4630, 1.5864, 1.9084, 2.0859, 1.7825, 1.7332, 1.8574},
|
---|
608 | { 1.6804, 1.1454, 2.0031, 1.6914, 1.2725, 1.4029, 1.6810, 1.6888, 1.6437, 1.7665},
|
---|
609 | { 1.4052, 1.2437, 1.5900, 1.2941, 1.2438, 1.4882, 1.6072, 1.4970, 1.4811, 1.5135},
|
---|
610 | { 1.4913, 1.9972, 2.3544, 1.3689, 2.9275, 2.1163, 1.8043, 1.4564, 1.5325, 2.1139},
|
---|
611 | { 2.0334, 2.2303, 3.0928, 1.8439, 3.1092, 2.8169, 2.4555, 1.7771, 1.9760, 2.5789},
|
---|
612 | { 1.7324, 2.0254, 2.8414, 1.6386, 2.9270, 2.3807, 2.0510, 1.7808, 1.7231, 2.3527},
|
---|
613 | { 0.9196, 1.4220, 1.6254, 0.7696, 1.8861, 1.7579, 1.4076, 1.4163, 1.1077, 1.3988},
|
---|
614 | },
|
---|
615 | new double[][,]
|
---|
616 | {
|
---|
617 | new double[,]
|
---|
618 | {
|
---|
619 | { 0.6345, 0.6652, 0.2647, 0.6484, 0.4251, 0.6943, 0.5427, 0.4338, 0.5527, 0.3280},
|
---|
620 | { 0.5921, 0.4959, 0.4876, 0.6115, 0.4601, 0.6702, 0.5360, 0.3252, 0.4791, 0.3526},
|
---|
621 | { 0.3961, 0.4296, 0.2816, 0.5165, 0.6456, 0.3784, 0.2923, 0.5455, 0.4237, 0.3036},
|
---|
622 | { 0.3916, 0.6566, 0.3888, 0.4777, 0.7173, 0.6255, 0.2051, 0.2256, 0.2498, 0.3182},
|
---|
623 | { 0.2181, 0.6194, 0.4041, 0.1929, 0.7305, 0.7077, 0.3750, 0.1532, 0.1758, 0.2510},
|
---|
624 | { 0.2344, 0.4538, 0.4967, 0.3056, 0.7032, 0.6205, 0.2413, 0.0960, 0.0929, 0.2492},
|
---|
625 | { 0.5996, 0.4229, 0.4622, 0.6365, 0.2384, 0.6451, 0.5566, 0.5865, 0.5446, 0.3263},
|
---|
626 | { 0.6017, 0.5846, 0.3398, 0.6585, 0.4850, 0.5905, 0.5060, 0.6636, 0.5900, 0.3834},
|
---|
627 | { 0.5719, 0.5057, 0.2476, 0.6023, 0.3674, 0.6144, 0.5216, 0.5174, 0.5364, 0.2776},
|
---|
628 | { 0.6327, 0.4789, 0.5849, 0.6712, 0.5796, 0.6030, 0.5167, 0.3428, 0.5177, 0.4767},
|
---|
629 | },
|
---|
630 | new double[,]
|
---|
631 | {
|
---|
632 | { 1.1542, 1.0808, 1.7137, 1.1224, 1.5090, 0.9961, 1.3298, 1.4968, 1.3127, 1.6369},
|
---|
633 | { 1.2413, 1.4053, 1.4181, 1.2031, 1.4591, 1.0675, 1.3411, 1.6404, 1.4309, 1.6057},
|
---|
634 | { 1.5486, 1.5027, 1.6936, 1.3729, 1.1289, 1.5721, 1.6807, 1.3251, 1.5109, 1.6670},
|
---|
635 | { 1.5547, 1.1026, 1.5584, 1.4331, 0.9067, 1.1739, 1.7826, 1.7593, 1.7313, 1.6490},
|
---|
636 | { 1.7679, 1.1868, 1.5379, 1.7963, 0.8253, 0.9483, 1.5767, 1.8403, 1.8154, 1.7298},
|
---|
637 | { 1.7492, 1.4683, 1.4041, 1.6646, 0.9652, 1.1845, 1.7411, 1.9016, 1.9048, 1.7320},
|
---|
638 | { 1.2267, 1.5121, 1.4560, 1.1498, 1.7445, 1.1302, 1.3060, 1.2519, 1.3266, 1.6389},
|
---|
639 | { 1.2227, 1.2555, 1.6220, 1.0978, 1.4220, 1.2443, 1.3896, 1.0850, 1.2454, 1.5656},
|
---|
640 | { 1.2789, 1.3900, 1.7339, 1.2214, 1.5866, 1.1971, 1.3647, 1.3715, 1.3404, 1.6984},
|
---|
641 | { 1.1581, 1.4312, 1.2549, 1.0647, 1.2647, 1.2200, 1.3726, 1.6182, 1.3709, 1.4346},
|
---|
642 | },
|
---|
643 | }
|
---|
644 | );
|
---|
645 | TestCovarianceFunction(cov, 1,
|
---|
646 | new double[,]
|
---|
647 | {
|
---|
648 | { 7.7681, 7.7957, 9.1175, 7.6951, 9.1148, 8.2406, 8.2532, 8.2057, 7.9303, 8.5765},
|
---|
649 | { 7.3926, 7.7881, 8.2289, 7.3128, 8.5326, 7.8570, 7.7535, 7.8698, 7.5822, 8.0224},
|
---|
650 | { 8.5096, 8.6045, 9.2632, 8.2546, 8.7198, 9.2945, 8.8817, 8.1368, 8.3741, 8.7816},
|
---|
651 | { 7.9886, 7.4745, 8.5704, 7.8096, 7.7719, 8.1964, 8.4695, 8.1648, 8.1138, 8.2315},
|
---|
652 | { 8.0632, 7.4371, 8.3651, 8.0757, 7.4147, 7.6080, 8.0477, 8.0750, 8.0288, 8.1469},
|
---|
653 | { 7.7869, 7.5959, 7.9316, 7.6696, 7.4564, 7.7793, 7.9884, 7.8850, 7.8692, 7.8941},
|
---|
654 | { 7.7940, 8.3557, 8.7048, 7.6497, 9.3089, 8.3910, 8.1263, 7.7655, 7.8589, 8.4871},
|
---|
655 | { 8.3350, 8.5404, 9.4643, 8.1079, 9.4540, 9.1241, 8.7945, 8.0367, 8.2835, 8.9443},
|
---|
656 | { 8.0481, 8.3644, 9.2221, 7.9399, 9.2948, 8.6753, 8.3852, 8.1164, 8.0524, 8.7309},
|
---|
657 | { 7.2030, 7.7683, 7.9353, 7.0220, 8.1984, 8.0588, 7.7433, 7.7874, 7.4431, 7.7457},
|
---|
658 | },
|
---|
659 | new double[][,]
|
---|
660 | {
|
---|
661 | new double[,]
|
---|
662 | {
|
---|
663 | { 1.0207, 1.1326, 0.3026, 1.0685, 0.5423, 1.2686, 0.7724, 0.5574, 0.7955, 0.3900},
|
---|
664 | { 0.8944, 0.6729, 0.6564, 0.9490, 0.6043, 1.1534, 0.7573, 0.3860, 0.6400, 0.4263},
|
---|
665 | { 0.4942, 0.5501, 0.3252, 0.7151, 1.0586, 0.4660, 0.3398, 0.7787, 0.5400, 0.3554},
|
---|
666 | { 0.4868, 1.0987, 0.4824, 0.6372, 1.4215, 0.9914, 0.2266, 0.2521, 0.2830, 0.3760},
|
---|
667 | { 0.2427, 0.9726, 0.5072, 0.2117, 1.5705, 1.3491, 0.4606, 0.1646, 0.1911, 0.2846},
|
---|
668 | { 0.2632, 0.5928, 0.6745, 0.3581, 1.3203, 0.9760, 0.2721, 0.1002, 0.0969, 0.2822},
|
---|
669 | { 0.9151, 0.5386, 0.6082, 1.0272, 0.2684, 1.0567, 0.8045, 0.8794, 0.7766, 0.3876},
|
---|
670 | { 0.9208, 0.8744, 0.4072, 1.1062, 0.6514, 0.8901, 0.6932, 1.1260, 0.8886, 0.4738},
|
---|
671 | { 0.8418, 0.6927, 0.2801, 0.9226, 0.4489, 0.9576, 0.7259, 0.7169, 0.7582, 0.3198},
|
---|
672 | { 1.0149, 0.6396, 0.8752, 1.1578, 0.8615, 0.9246, 0.7154, 0.4117, 0.7177, 0.6353},
|
---|
673 | },
|
---|
674 | new double[,]
|
---|
675 | {
|
---|
676 | { 13.7185, 13.5970, 14.4724, 13.6668, 14.2254, 13.4477, 13.9840, 14.2096, 13.9596, 14.3828},
|
---|
677 | { 13.8542, 14.0889, 14.1062, 13.7957, 14.1607, 13.5743, 14.0000, 14.3869, 14.1234, 14.3454},
|
---|
678 | { 14.2753, 14.2173, 14.4492, 14.0445, 13.6775, 14.3044, 14.4343, 13.9773, 14.2278, 14.4183},
|
---|
679 | { 14.2829, 13.6339, 14.2875, 14.1263, 13.2777, 13.7501, 14.5498, 14.5238, 14.4923, 14.3972},
|
---|
680 | { 14.5334, 13.7703, 14.2618, 14.5649, 13.1097, 13.3585, 14.3100, 14.6126, 14.5857, 14.4907},
|
---|
681 | { 14.5125, 14.1727, 14.0872, 14.4155, 13.3905, 13.7667, 14.5035, 14.6775, 14.6809, 14.4932},
|
---|
682 | { 13.8321, 14.2292, 14.1566, 13.7114, 14.5073, 13.6796, 13.9499, 13.8703, 13.9795, 14.3852},
|
---|
683 | { 13.8260, 13.8756, 14.3651, 13.6258, 14.1115, 13.8588, 14.0675, 13.6042, 13.8604, 14.2964},
|
---|
684 | { 13.9103, 14.0681, 14.4953, 13.8241, 14.3221, 13.7864, 14.0331, 14.0426, 13.9991, 14.4548},
|
---|
685 | { 13.7248, 14.1238, 13.8747, 13.5695, 13.8893, 13.8218, 14.0442, 14.3604, 14.0418, 14.1283},
|
---|
686 | },
|
---|
687 | }
|
---|
688 | );
|
---|
689 | }
|
---|
690 | [TestMethod]
|
---|
691 | public void CovProdTest() {
|
---|
692 | var cov = new CovarianceProd();
|
---|
693 | cov.Factors.Add(new CovarianceSEiso());
|
---|
694 | cov.Factors.Add(new CovarianceLinear());
|
---|
695 | TestCovarianceFunction(cov, 0,
|
---|
696 | new double[,]
|
---|
697 | {
|
---|
698 | { 0.5245, 0.5389, 1.6120, 0.4836, 1.5106, 0.7554, 0.8386, 0.8239, 0.6239, 1.1336},
|
---|
699 | { 0.2889, 0.5225, 0.8337, 0.2496, 1.0595, 0.5710, 0.5052, 0.5547, 0.3724, 0.6822},
|
---|
700 | { 1.0623, 1.1239, 1.7263, 0.8459, 1.0618, 1.6839, 1.3988, 0.7607, 0.9521, 1.3106},
|
---|
701 | { 0.6585, 0.3625, 1.1117, 0.5349, 0.5137, 0.7756, 1.0648, 0.7942, 0.7510, 0.8516},
|
---|
702 | { 0.7040, 0.3275, 0.9490, 0.7125, 0.3548, 0.4404, 0.7037, 0.7073, 0.6680, 0.7798},
|
---|
703 | { 0.4641, 0.3741, 0.6234, 0.3844, 0.3673, 0.5306, 0.6413, 0.5193, 0.5036, 0.5608},
|
---|
704 | { 0.5385, 0.9383, 1.1840, 0.4565, 1.7927, 0.8766, 0.7518, 0.5198, 0.5765, 1.0608},
|
---|
705 | { 0.8694, 1.0060, 1.8506, 0.7108, 1.7052, 1.3654, 1.2234, 0.6698, 0.8427, 1.4060},
|
---|
706 | { 0.6989, 0.9246, 1.7118, 0.6277, 1.6927, 1.0667, 0.9339, 0.7510, 0.7057, 1.2768},
|
---|
707 | { 0.1972, 0.5055, 0.6262, 0.1263, 0.7928, 0.7002, 0.4950, 0.4913, 0.2894, 0.4889},
|
---|
708 |
|
---|
709 | },
|
---|
710 | new double[][,]
|
---|
711 | {
|
---|
712 | new double[,]
|
---|
713 | {
|
---|
714 | { 0.5767, 0.6633, 0.4980, 0.5588, 0.8510, 1.0532, 0.6845, 0.4776, 0.5254, 0.4543},
|
---|
715 | { 0.2756, 0.3688, 0.5733, 0.2537, 0.6682, 0.7170, 0.4039, 0.2199, 0.2494, 0.2996},
|
---|
716 | { 0.5435, 0.6426, 0.5741, 0.6365, 1.2144, 0.8107, 0.4866, 0.6263, 0.5340, 0.4774},
|
---|
717 | { 0.3317, 0.4317, 0.5547, 0.3566, 0.8127, 0.8265, 0.2450, 0.2037, 0.2167, 0.3287},
|
---|
718 | { 0.1737, 0.3419, 0.4987, 0.1530, 0.6281, 0.6573, 0.3347, 0.1177, 0.1294, 0.2263},
|
---|
719 | { 0.1244, 0.2312, 0.4411, 0.1411, 0.5353, 0.5559, 0.1778, 0.0524, 0.0491, 0.1614},
|
---|
720 | { 0.5264, 0.5249, 0.7518, 0.5054, 0.4900, 1.0006, 0.6408, 0.4870, 0.4733, 0.4224},
|
---|
721 | { 0.8556, 0.9368, 0.7753, 0.8528, 1.1632, 1.2961, 0.8909, 0.8193, 0.7984, 0.6886},
|
---|
722 | { 0.6251, 0.6728, 0.4889, 0.6191, 0.7840, 1.0950, 0.7139, 0.5665, 0.5648, 0.4174},
|
---|
723 | { 0.2155, 0.3383, 0.5837, 0.1593, 0.7267, 0.6922, 0.3726, 0.2082, 0.2186, 0.3249},
|
---|
724 | },
|
---|
725 | new double[,]
|
---|
726 | {
|
---|
727 | { 1.0490, 1.0777, 3.2240, 0.9672, 3.0213, 1.5108, 1.6771, 1.6478, 1.2478, 2.2672},
|
---|
728 | { 0.5777, 1.0450, 1.6673, 0.4992, 2.1190, 1.1421, 1.0104, 1.1094, 0.7448, 1.3644},
|
---|
729 | { 2.1246, 2.2479, 3.4526, 1.6919, 2.1236, 3.3679, 2.7976, 1.5214, 1.9041, 2.6212},
|
---|
730 | { 1.3170, 0.7250, 2.2233, 1.0698, 1.0274, 1.5513, 2.1295, 1.5883, 1.5021, 1.7032},
|
---|
731 | { 1.4080, 0.6551, 1.8980, 1.4249, 0.7096, 0.8808, 1.4075, 1.4146, 1.3360, 1.5596},
|
---|
732 | { 0.9281, 0.7482, 1.2467, 0.7687, 0.7347, 1.0613, 1.2826, 1.0386, 1.0071, 1.1216},
|
---|
733 | { 1.0770, 1.8767, 2.3681, 0.9129, 3.5854, 1.7532, 1.5037, 1.0396, 1.1531, 2.1215},
|
---|
734 | { 1.7387, 2.0120, 3.7012, 1.4217, 3.4103, 2.7309, 2.4467, 1.3395, 1.6854, 2.8121},
|
---|
735 | { 1.3978, 1.8493, 3.4235, 1.2554, 3.3854, 2.1334, 1.8678, 1.5019, 1.4113, 2.5536},
|
---|
736 | { 0.3944, 1.0110, 1.2523, 0.2526, 1.5856, 1.4004, 0.9900, 0.9825, 0.5788, 0.9777},
|
---|
737 | },
|
---|
738 | }
|
---|
739 | );
|
---|
740 | TestCovarianceFunction(cov, 1,
|
---|
741 | new double[,]
|
---|
742 | {
|
---|
743 | { 6.2342, 6.7795, 13.6134, 5.8887, 14.2405, 10.1987, 8.8183, 7.8217, 6.6344, 9.9609},
|
---|
744 | { 3.2242, 5.2384, 8.2928, 2.8624, 10.2826, 7.2613, 5.2743, 4.8651, 3.6758, 6.0948},
|
---|
745 | { 9.7926, 10.6338, 14.7280, 8.6537, 12.8640, 15.3218, 12.0130, 8.0240, 8.9653, 11.3359},
|
---|
746 | { 6.0497, 4.4825, 10.1916, 5.2725, 7.5223, 9.0848, 8.6907, 6.5563, 6.2868, 7.4352},
|
---|
747 | { 5.7877, 3.8005, 8.8010, 5.7766, 5.6360, 6.2037, 6.3872, 5.6164, 5.3671, 6.5321},
|
---|
748 | { 3.8501, 3.6110, 6.2543, 3.3286, 5.0963, 6.1672, 5.3421, 4.0085, 3.8812, 4.6925},
|
---|
749 | { 6.0719, 8.8301, 11.5124, 5.4433, 14.9080, 10.6099, 8.0304, 5.7589, 6.0753, 9.3107},
|
---|
750 | { 9.8306, 11.1183, 16.3892, 8.8231, 16.9213, 15.2084, 12.3844, 8.3980, 9.3789, 12.8390},
|
---|
751 | { 7.6019, 9.3580, 14.3105, 7.1044, 15.2800, 12.2846, 9.6031, 7.6887, 7.3699, 10.8667},
|
---|
752 | { 2.3372, 4.9884, 6.9233, 1.6100, 8.7070, 7.9328, 5.0646, 4.3597, 2.9643, 4.8145},
|
---|
753 | },
|
---|
754 | new double[][,]
|
---|
755 | {
|
---|
756 | new double[,]
|
---|
757 | {
|
---|
758 | { 0.9277, 1.1294, 0.5692, 0.9208, 1.0857, 1.9243, 0.9742, 0.6136, 0.7561, 0.5402},
|
---|
759 | { 0.4163, 0.5003, 0.7718, 0.3938, 0.8777, 1.2339, 0.5706, 0.2610, 0.3331, 0.3622},
|
---|
760 | { 0.6780, 0.8229, 0.6629, 0.8812, 1.9912, 0.9983, 0.5655, 0.8941, 0.6805, 0.5589},
|
---|
761 | { 0.4124, 0.7225, 0.6882, 0.4757, 1.6107, 1.3101, 0.2707, 0.2276, 0.2455, 0.3883},
|
---|
762 | { 0.1933, 0.5369, 0.6259, 0.1679, 1.3503, 1.2531, 0.4112, 0.1265, 0.1406, 0.2566},
|
---|
763 | { 0.1396, 0.3021, 0.5989, 0.1654, 1.0050, 0.8744, 0.2004, 0.0548, 0.0512, 0.1827},
|
---|
764 | { 0.8034, 0.6684, 0.9892, 0.8156, 0.5515, 1.6391, 0.9263, 0.7302, 0.6750, 0.5018},
|
---|
765 | { 1.3094, 1.4012, 0.9292, 1.4326, 1.5622, 1.9537, 1.2206, 1.3902, 1.2026, 0.8509},
|
---|
766 | { 0.9201, 0.9215, 0.5531, 0.9483, 0.9578, 1.7066, 0.9935, 0.7850, 0.7983, 0.4808},
|
---|
767 | { 0.3456, 0.4518, 0.8735, 0.2747, 1.0802, 1.0614, 0.5160, 0.2500, 0.3030, 0.4330},
|
---|
768 | },
|
---|
769 | new double[,]
|
---|
770 | {
|
---|
771 | { 12.4684, 13.5589, 27.2269, 11.7775, 28.4810, 20.3974, 17.6367, 15.6433, 13.2687, 19.9218},
|
---|
772 | { 6.4483, 10.4768, 16.5855, 5.7248, 20.5652, 14.5226, 10.5485, 9.7302, 7.3516, 12.1897},
|
---|
773 | { 19.5852, 21.2676, 29.4561, 17.3075, 25.7280, 30.6436, 24.0261, 16.0481, 17.9305, 22.6719},
|
---|
774 | { 12.0994, 8.9651, 20.3832, 10.5449, 15.0447, 18.1696, 17.3814, 13.1126, 12.5737, 14.8704},
|
---|
775 | { 11.5753, 7.6010, 17.6020, 11.5533, 11.2719, 12.4074, 12.7745, 11.2328, 10.7342, 13.0642},
|
---|
776 | { 7.7002, 7.2219, 12.5086, 6.6571, 10.1926, 12.3345, 10.6842, 8.0169, 7.7623, 9.3850},
|
---|
777 | { 12.1437, 17.6603, 23.0249, 10.8865, 29.8159, 21.2199, 16.0607, 11.5178, 12.1505, 18.6213},
|
---|
778 | { 19.6612, 22.2367, 32.7783, 17.6462, 33.8425, 30.4168, 24.7688, 16.7960, 18.7578, 25.6781},
|
---|
779 | { 15.2039, 18.7161, 28.6209, 14.2089, 30.5600, 24.5693, 19.2063, 15.3774, 14.7399, 21.7333},
|
---|
780 | { 4.6744, 9.9769, 13.8465, 3.2199, 17.4141, 15.8657, 10.1292, 8.7194, 5.9286, 9.6290},
|
---|
781 | },
|
---|
782 | }
|
---|
783 | );
|
---|
784 | }
|
---|
785 |
|
---|
786 |
|
---|
787 | private void TestCovarianceFunction(ICovarianceFunction cf, double hypValue, double[,] expectedCov, double[][,] expectedGradients) {
|
---|
788 | var x = GetData();
|
---|
789 | var xt = GetDataTest();
|
---|
790 |
|
---|
791 | int nHyp = cf.GetNumberOfParameters(x.GetLength(1));
|
---|
792 | var hyp = Enumerable.Repeat(hypValue, nHyp).ToArray();
|
---|
793 | cf.SetParameter(hyp);
|
---|
794 | cf.SetData(x, xt);
|
---|
795 |
|
---|
796 | int rows0 = x.GetLength(0);
|
---|
797 | int rows1 = xt.GetLength(0);
|
---|
798 | var actualCov = new double[rows0, rows1];
|
---|
799 | for (int i = 0; i < rows0; i++)
|
---|
800 | for (int j = 0; j < rows1; j++)
|
---|
801 | actualCov[i, j] = cf.GetCovariance(i, j);
|
---|
802 |
|
---|
803 | AssertEqual(expectedCov, actualCov);
|
---|
804 |
|
---|
805 | for (int i = 0; i < rows0; i++)
|
---|
806 | for (int j = 0; j < rows1; j++) {
|
---|
807 | for (int k = 0; k < nHyp; k++)
|
---|
808 | Assert.AreEqual(expectedGradients[k][i, j], cf.GetGradient(i, j, k), 5E-3);
|
---|
809 | }
|
---|
810 | }
|
---|
811 |
|
---|
812 |
|
---|
813 | private void TestMeanFunction(IMeanFunction mf, double hypValue, double[] expectedMean, double[][] expectedGradients) {
|
---|
814 | var x = GetData();
|
---|
815 | var xt = GetDataTest();
|
---|
816 |
|
---|
817 | int nHyp = mf.GetNumberOfParameters(x.GetLength(1));
|
---|
818 | var hyp = Enumerable.Repeat(hypValue, nHyp).ToArray();
|
---|
819 | mf.SetParameter(hyp);
|
---|
820 | mf.SetData(x);
|
---|
821 |
|
---|
822 | var m = mf.GetMean(xt);
|
---|
823 |
|
---|
824 | AssertEqual(expectedMean, m);
|
---|
825 |
|
---|
826 | for (int i = 0; i < nHyp; i++) {
|
---|
827 | var g = mf.GetGradients(i, x);
|
---|
828 | AssertEqual(expectedGradients[i], g);
|
---|
829 | }
|
---|
830 | }
|
---|
831 |
|
---|
832 |
|
---|
833 | private void AssertEqual(double[] expected, double[] actual) {
|
---|
834 | Assert.AreEqual(expected.Length, actual.Length);
|
---|
835 | for (int i = 0; i < expected.Length; i++)
|
---|
836 | Assert.AreEqual(expected[i], actual[i], 1E-3);
|
---|
837 | }
|
---|
838 | private void AssertEqual(double[,] expected, double[,] actual) {
|
---|
839 | Assert.AreEqual(expected.Length, actual.Length);
|
---|
840 | for (int i = 0; i < expected.GetLength(0); i++)
|
---|
841 | for (int j = 0; j < expected.GetLength(1); j++)
|
---|
842 | Assert.AreEqual(expected[i, j], actual[i, j], 5E-3);
|
---|
843 | }
|
---|
844 |
|
---|
845 | private double[,] GetData() {
|
---|
846 | return new double[,]
|
---|
847 | {
|
---|
848 | {0.4173, 0.7803, 0.2348, 0.5470, 0.9294},
|
---|
849 | {0.0497, 0.3897, 0.3532, 0.2963, 0.7757},
|
---|
850 | {0.9027, 0.2417, 0.8212, 0.7447, 0.4868},
|
---|
851 | {0.9448, 0.4039, 0.0154, 0.1890, 0.4359},
|
---|
852 | {0.4909, 0.0965, 0.0430, 0.6868, 0.4468},
|
---|
853 | {0.4893, 0.1320, 0.1690, 0.1835, 0.3063},
|
---|
854 | {0.3377, 0.9421, 0.6491, 0.3685, 0.5085},
|
---|
855 | {0.9001, 0.9561, 0.7317, 0.6256, 0.5108},
|
---|
856 | {0.3692, 0.5752, 0.6477, 0.7802, 0.8176},
|
---|
857 | {0.1112, 0.0598, 0.4509, 0.0811, 0.7948}
|
---|
858 | };
|
---|
859 | }
|
---|
860 |
|
---|
861 | private double[,] GetDataTest() {
|
---|
862 | return new double[,]
|
---|
863 | {
|
---|
864 | {0.6443, 0.2077, 0.3111, 0.5949, 0.0855},
|
---|
865 | {0.3786, 0.3012, 0.9234, 0.2622, 0.2625},
|
---|
866 | {0.8116, 0.4709, 0.4302, 0.6028, 0.8010},
|
---|
867 | {0.5328, 0.2305, 0.1848, 0.7112, 0.0292},
|
---|
868 | {0.3507, 0.8443, 0.9049, 0.2217, 0.9289},
|
---|
869 | {0.9390, 0.1948, 0.9797, 0.1174, 0.7303},
|
---|
870 | {0.8759, 0.2259, 0.4389, 0.2967, 0.4886},
|
---|
871 | {0.5502, 0.1707, 0.1111, 0.3188, 0.5785},
|
---|
872 | {0.6225, 0.2277, 0.2581, 0.4242, 0.2373},
|
---|
873 | {0.5870, 0.4357, 0.4087, 0.5079, 0.4588}
|
---|
874 | };
|
---|
875 | }
|
---|
876 | }
|
---|
877 | }
|
---|