<jupyter_start><jupyter_text>Gaussian Process Regression Aims* To sample from a Gaussian process prior distribution.* To implement Gaussian process inference for regression.* To use the above to observe samples from a Gaussian process posterior distribution.* To evaluate how different hyperparameter settings impact model quality.<jupyter_code>%matplotlib inline

import numpy as np
import matplotlib.pyplot as plt

plt.rcParams['font.family'] = 'Fira Sans'
plt.rcParams['figure.figsize'] = (16.0, 8.0)
def f(x):
    return np.sin(np.exp(0.03 * x))
x = np.random.uniform(low=-20, high=80, size=(200,))
t = f(x)
fig, ax = plt.subplots()
fig.suptitle('Sampled points', fontsize=18)
ax.plot(np.arange(-20, 80), f(np.arange(-20, 80)), color='red')
ax.scatter(x, t)
plt.show()
def k(x1, x2, var, l):
    return var * np.exp(-(x1 - x2)**2 / (2*l**2))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14857142857142858, 'fraction_numerical': 0.036571428571428574, 'mean_word_length': 5.257142857142857, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '332430', 'license': 'MIT', 'n_tokens_mistral': 325, 'n_tokens_neox': 305, 'n_words': 91, 'path': 'lab03-gaussian-processes/gaussian-process-regression.ipynb', 'repo_name': 'gcollura/advanced-statistical-inference-labs', 'size': '875'}