diff --git a/GPy/core/gp.py b/GPy/core/gp.py index 254549e6..8ce3482c 100644 --- a/GPy/core/gp.py +++ b/GPy/core/gp.py @@ -15,7 +15,7 @@ from parameterization.variational import VariationalPosterior from scipy.sparse.base import issparse import logging -from GPy.util.normalizer import GaussianNorm +from GPy.util.normalizer import MeanNorm logger = logging.getLogger("GP") class GP(Model): @@ -31,7 +31,7 @@ class GP(Model): :param Norm normalizer: normalize the outputs Y. Prediction will be un-normalized using this normalizer. - If normalizer is None, we will normalize using GaussianNorm. + If normalizer is None, we will normalize using MeanNorm. If normalizer is False, no normalization will be done. .. Note:: Multiple independent outputs are allowed using columns of Y @@ -52,7 +52,7 @@ class GP(Model): logger.info("initializing Y") if normalizer is None: - self.normalizer = GaussianNorm() + self.normalizer = MeanNorm() elif normalizer is False: self.normalizer = None else: diff --git a/GPy/util/normalizer.py b/GPy/util/normalizer.py index 86ffac86..854726c4 100644 --- a/GPy/util/normalizer.py +++ b/GPy/util/normalizer.py @@ -24,25 +24,22 @@ class Norm(object): Project the normalized object X into space of Y """ raise NotImplementedError + def inverse_variance(self, var): + return var def scaled(self): """ Whether this Norm object has been initialized. """ raise NotImplementedError -class GaussianNorm(Norm): +class MeanNorm(Norm): def __init__(self): self.mean = None - self.std = None def scale_by(self, Y): Y = np.ma.masked_invalid(Y, copy=False) self.mean = Y.mean(0).view(np.ndarray) - self.std = Y.std(0).view(np.ndarray) - self.std[self.std==0] = 1. def normalize(self, Y): - return ((Y-self.mean)/self.std) + return Y-self.mean def inverse_mean(self, X): - return ((X*self.std)+self.mean) - def inverse_variance(self, var): - return (var*self.std**2) + return X+self.mean def scaled(self): - return self.mean is not None and self.std is not None + return self.mean is not None