The data to train the model comes from the Georgia Tech Waveform catalogue.

Let’s create a file for the training data set.

In order to select the “zero” time of the waveform we find the maximum hrss, and define that as $t = 0$.

Let’s do a little further data reduction, and make all of the training_x values scale from 0 to 1 rather than their current ranges.

Define the model using a Matern 5/2 kernel.

# Training

Then train the model using an MCMC process to optimise the evidence of the GP by fitting the hyperparameters of the model.

Uniform priors are assigned to each hyperparameter (because they’re easiest to code-up: any prior could be used). For the log of the constant kernel (k0 in the code) this is $U(-20,\infty)$; for the time scale length $log(l_0) \sim U(0,15)$, and for all the other scale lengths is $U(-15, 15)$.

One approach to finding the hyperparameters is to just use the MAP estimate, which we can do with the BFGS algorithm.

However, to better understand the behaviour of the model with respect to its hyperparameters we can sample using an MCMC.

Run 1000 samples for the burn-in

99.0%

Inspecting the burn-in it looks like the MCMC is converging fairly well for each scale length (however it is worth noting that this is only on a subset of the total training data.

We can see the difference between the MCMC estimate of the hyperparameters and the MAP estimate:

[-6.3305358  -7.15205328  1.74945289 -0.80468957  4.03947842  3.37911173
-3.82367335  0.88604704 -1.89391033]
[ -6.10398307e+00  -8.84487910e-01  -4.77508964e-03  -3.91684510e-01
-3.00549832e-02  -4.03256862e-01  -7.82583915e-02  -5.46419445e-01
-1.02489770e+01]

True

A quick sanity check shows that we’re getting something which is similar to the exact waveform, but the sparsity of the training data (and the use of the burnin sample) has probably resulted in the obvious errors in this waveform.

<matplotlib.collections.PolyCollection at 0x7f3cf89b4310>

Make the “production” samples.

99.5%

We can then look at the error behaviour of this model through a hyper-slice in the parameter space.

Producing plot at 0 0
Producing plot at 0 1

/home/daniel/.virtualenvs/heron/lib/python2.7/site-packages/matplotlib-2.0.0-py2.7-linux-x86_64.egg/matplotlib/axes/_base.py:1292: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
if aspect == 'normal':
/home/daniel/.virtualenvs/heron/lib/python2.7/site-packages/matplotlib-2.0.0-py2.7-linux-x86_64.egg/matplotlib/axes/_base.py:1297: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
elif aspect in ('equal', 'auto'):

Producing plot at 0 2
Producing plot at 0 3
Producing plot at 0 4
Producing plot at 0 5
Producing plot at 0 6
Producing plot at 0 7
Producing plot at 1 0
Producing plot at 1 1
Producing plot at 1 2
Producing plot at 1 3
Producing plot at 1 4
Producing plot at 1 5
Producing plot at 1 6
Producing plot at 1 7
Producing plot at 2 0
Producing plot at 2 1
Producing plot at 2 2
Producing plot at 2 3
Producing plot at 2 4
Producing plot at 2 5
Producing plot at 2 6
Producing plot at 2 7
Producing plot at 3 0
Producing plot at 3 1
Producing plot at 3 2
Producing plot at 3 3
Producing plot at 3 4
Producing plot at 3 5
Producing plot at 3 6
Producing plot at 3 7
Producing plot at 4 0
Producing plot at 4 1
Producing plot at 4 2
Producing plot at 4 3
Producing plot at 4 4
Producing plot at 4 5
Producing plot at 4 6
Producing plot at 4 7
Producing plot at 5 0
Producing plot at 5 1
Producing plot at 5 2
Producing plot at 5 3
Producing plot at 5 4
Producing plot at 5 5
Producing plot at 5 6
Producing plot at 5 7
Producing plot at 6 0
Producing plot at 6 1
Producing plot at 6 2
Producing plot at 6 3
Producing plot at 6 4
Producing plot at 6 5
Producing plot at 6 6
Producing plot at 6 7
Producing plot at 7 0
Producing plot at 7 1
Producing plot at 7 2
Producing plot at 7 3
Producing plot at 7 4
Producing plot at 7 5
Producing plot at 7 6
Producing plot at 7 7

## Variance of test points

The Gaussian process has given us a gridding of the parameter space, and from that we can then plot a histogram of the model’s variance at each of those points.

<matplotlib.text.Text at 0x7f3cdc0ce510>

There are clearly a large number of points in the parameter space which have a large variance in the GP model.

We can also look at how this variance behaviour changes as a function of the test points’ distance from the training data.

<matplotlib.text.Text at 0x7f3cf831d390>