def predict(self, X, T, X_new):
"""Predict ``X_new`` with given traning data ``(X, T)``."""
n_tests = X_new.shape[0]
phi = sp.r_[sp.ones(n_tests).reshape(1, -1), self._compute_design_matrix(X_new, X)] # Add x0
phi = phi[self.rv_indices, :]
predict_mean = sp.dot(self.mean, phi)
predict_cov = 1 / self.beta + sp.dot(phi.T, sp.dot(self.cov, phi)).diagonal()
return predict_mean, predict_cov
评论列表
文章目录