Fix normalizer to catch when output scale is zero.

This commit is contained in:
Neil Lawrence 2021-05-19 09:58:16 +01:00 committed by Neil Lawrence
parent 943be980d4
commit 95426aed34

View file

@ -91,8 +91,8 @@ class Standardize(_Norm):
self.mean = Y.mean(0).view(np.ndarray)
self.std = Y.std(0).view(np.ndarray)
if np.any(self.std == 0):
self.std[np.where(Y_std==0)]=1.
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.
def normalize(self, Y):
super(Standardize, self).normalize(Y)