Path: blob/master/notebooks/book2/18/gp_spectral_mixture.ipynb
1192 views
Kernel: Python [conda env:pyprobml]
Spectral mixture kernel in 1d for GP
https://tinygp.readthedocs.io/en/latest/tutorials/kernels.html#example-spectral-mixture-kernel
In this section, we will implement the "spectral mixture kernel" proposed by Gordon Wilson & Adams (2013).
In [1]:
In [2]:
Out[2]:
/home/patel_zeel/miniconda3/envs/pyprobml/lib/python3.7/site-packages/probml_utils/plotting.py:26: UserWarning: LATEXIFY environment variable not set, not latexifying
warnings.warn("LATEXIFY environment variable not set, not latexifying")
In [3]:
Now let's implement the simulate some data from this model:
In [4]:
Out[4]:
WARNING:absl:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)
One thing to note here is that we've used named parameters in a dictionary, instead of an array of parameters as in some of the other examples. This would be awkward (but not impossible) to fit using scipy
, so instead we'll use optax
for optimization:
In [5]:
Out[5]:
/home/patel_zeel/miniconda3/envs/pyprobml/lib/python3.7/site-packages/probml_utils/plotting.py:79: UserWarning: set FIG_DIR environment variable to save figures
warnings.warn("set FIG_DIR environment variable to save figures")
Using our optimized model, over-plot the conditional predictions:
In [6]:
Out[6]:
/home/patel_zeel/miniconda3/envs/pyprobml/lib/python3.7/site-packages/probml_utils/plotting.py:79: UserWarning: set FIG_DIR environment variable to save figures
warnings.warn("set FIG_DIR environment variable to save figures")