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

Method fit

numpy_ml/nonparametric/gp.py:44–62  ·  view source on GitHub ↗

Fit the GP prior to the training data. Parameters ---------- X : :py:class:`ndarray ` of shape `(N, M)` A training dataset of `N` examples, each with dimensionality `M`. y : :py:class:`ndarray ` of shape `(N, O)`

(self, X, y)

Source from the content-addressed store, hash-verified

42 self.hyperparameters = {"kernel": str(self.kernel), "alpha": alpha}
43
44 def fit(self, X, y):
45 """
46 Fit the GP prior to the training data.
47
48 Parameters
49 ----------
50 X : :py:class:`ndarray <numpy.ndarray>` of shape `(N, M)`
51 A training dataset of `N` examples, each with dimensionality `M`.
52 y : :py:class:`ndarray <numpy.ndarray>` of shape `(N, O)`
53 A collection of real-valued training targets for the
54 examples in `X`, each with dimension `O`.
55 """
56 mu = np.zeros(X.shape[0])
57 K = self.kernel(X, X)
58
59 self.parameters["X"] = X
60 self.parameters["y"] = y
61 self.parameters["GP_cov"] = K
62 self.parameters["GP_mean"] = mu
63
64 def predict(self, X, conf_interval=0.95, return_cov=False):
65 """

Callers 3

plot_gpFunction · 0.95
plot_gp_distFunction · 0.95
test_gp_regressionFunction · 0.95

Calls

no outgoing calls

Tested by 1

test_gp_regressionFunction · 0.76