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)
| 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 | """ |
no outgoing calls