Catch possible edge case in stddev calc

This commit is contained in:
Josh Hawkins 2024-10-11 12:03:41 -05:00
parent a8b5aebacb
commit 07d73e1123

View File

@ -20,7 +20,7 @@ class ZScoreNormalization:
@property @property
def stddev(self): def stddev(self):
return math.sqrt(self.variance) return math.sqrt(self.variance) if self.variance > 0 else 0.0
def normalize(self, distances: list[float]): def normalize(self, distances: list[float]):
self._update(distances) self._update(distances)