Skip to content

Commit

Permalink
Fix zero in denominator in CGRU
Browse files Browse the repository at this point in the history
  • Loading branch information
kasyanovse committed Aug 21, 2023
1 parent 634de80 commit 29588af
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@ def _fit_transform_scaler(self, data: InputData):
return f_scaled, t_scaled

def _scale(self, array: np.ndarray):
return (array - self.mu) / self.std
if self.std != 0:
return (array - self.mu) / self.std
else:
# if std is 0 then array has the only unique value
# the _scale returns 0 - near to true
return array - self.mu

def _inverse_scale(self, array: np.ndarray):
return array * self.std + self.mu
Expand Down

0 comments on commit 29588af

Please sign in to comment.