added mean function into the prediction

This commit is contained in:
James Hensman 2015-03-23 14:59:08 +00:00
parent 2d312099c0
commit e97b6e59aa

View file

@ -5,6 +5,7 @@ import numpy as np
import sys import sys
from .. import kern from .. import kern
from model import Model from model import Model
from mapping import Mapping
from parameterization import ObsAr from parameterization import ObsAr
from .. import likelihoods from .. import likelihoods
from ..inference.latent_function_inference import exact_gaussian_inference, expectation_propagation from ..inference.latent_function_inference import exact_gaussian_inference, expectation_propagation
@ -201,6 +202,10 @@ class GP(Model):
#force mu to be a column vector #force mu to be a column vector
if len(mu.shape)==1: mu = mu[:,None] if len(mu.shape)==1: mu = mu[:,None]
#add the mean function in
if not self.mean_function is None:
mu += self.mean_function.f(_Xnew)
return mu, var return mu, var
def predict(self, Xnew, full_cov=False, Y_metadata=None, kern=None): def predict(self, Xnew, full_cov=False, Y_metadata=None, kern=None):