Update GPy/util/normalizer.py

This commit is contained in:
Neil Lawrence 2021-05-19 18:31:52 +01:00
parent ef90137c4c
commit 714ad858aa

View file

@ -92,7 +92,8 @@ class Standardize(_Norm):
self.std = Y.std(0).view(np.ndarray)
if np.any(self.std == 0):
warnings.warn("Some values of Y have standard deviation of zero. Resetting to 1.0 to avoid divide by zero errors.")
self.std[np.where(self.std==0)]=1.
# Choice of setting to 1.0 is somewhat arbitrary. It avoids a divide by zero error, but setting to EPS would also do this. Don't have strong reasons for choosing 1.0, it was just first instinct
self.std[np.where(self.std==0)]=1.
def normalize(self, Y):
super(Standardize, self).normalize(Y)