This Python GPR implementation uses the following libraries

import numpy as np
import matplotlib.pyplot as plt

The squared-exponential function is used as its covariance-function

def squared_exponential_covariance_function(x, y, params):
    return params[0] * np.exp(-0.5 * params[1] * np.subtract.outer(x, y) ** 2)

TODO

def conditional(x_new, x, y, params):
    B = squared_exponential_covariance_function(x_new, x, params)
    C = squared_exponential_covariance_function(x, x, params)
    A = squared_exponential_covariance_function(x_new, x_new, params)
    mu = np.linalg.inv(C).dot(B.T).T.dot(y)
    sigma = A - B.dot(np.linalg.inv(C).dot(B.T))
    return mu.squeeze(), sigma.squeeze()

TODO

Entire Code

Resources