MCPcopy
hub / github.com/ddbourgin/numpy-ml / __init__

Method __init__

numpy_ml/nonparametric/gp.py:19–42  ·  view source on GitHub ↗

A Gaussian Process (GP) regression model. .. math:: y \mid X, f &\sim \mathcal{N}( [f(x_1), \ldots, f(x_n)], \\alpha I ) \\\\ f \mid X &\sim \\text{GP}(0, K) for data :math:`D = \{(x_1, y_1), \ldots, (x_n, y_n) \}` and a covariance matrix :m

(self, kernel="RBFKernel", alpha=1e-10)

Source from the content-addressed store, hash-verified

17
18class GPRegression:
19 def __init__(self, kernel="RBFKernel", alpha=1e-10):
20 """
21 A Gaussian Process (GP) regression model.
22
23 .. math::
24
25 y \mid X, f &\sim \mathcal{N}( [f(x_1), \ldots, f(x_n)], \\alpha I ) \\\\
26 f \mid X &\sim \\text{GP}(0, K)
27
28 for data :math:`D = \{(x_1, y_1), \ldots, (x_n, y_n) \}` and a covariance matrix :math:`K_{ij}
29 = \\text{kernel}(x_i, x_j)` for all :math:`i, j \in \{1, \ldots, n \}`.
30
31 Parameters
32 ----------
33 kernel : str
34 The kernel to use in fitting the GP prior. Default is 'RBFKernel'.
35 alpha : float
36 An isotropic noise term for the diagonal in the GP covariance, `K`.
37 Larger values correspond to the expectation of greater noise in the
38 observed data points. Default is 1e-10.
39 """
40 self.kernel = KernelInitializer(kernel)()
41 self.parameters = {"GP_mean": None, "GP_cov": None, "X": None}
42 self.hyperparameters = {"kernel": str(self.kernel), "alpha": alpha}
43
44 def fit(self, X, y):
45 """

Callers

nothing calls this directly

Calls 1

KernelInitializerClass · 0.85

Tested by

no test coverage detected