def predict_one(self, X, T, x, beta, C):
"""Predict one single new point ``x``.
The hyperparameter ``beta`` and Gram matrix ``C`` should be estimated
and calculated from the training data, respectively. """
kXx = self.kernel.inner(X, x)
kxx = self.kernel.inner(x, x)
inv_C = linalg.inv(C)
c = kxx + 1 / beta
self.pred_mean = kXx.T.dot(inv_C).dot(T)
self.pred_cov = c - kXx.T.dot(inv_C).dot(kXx) # Why the cov so small ?
return self.pred_mean, self.pred_cov
评论列表
文章目录