Skip to content

Commit

Permalink
Update src/tabmat/categorical_matrix.py
Browse files Browse the repository at this point in the history
Co-authored-by: Luca Bittarello <15511539+lbittarello@users.noreply.github.com>
  • Loading branch information
mlondschien and lbittarello authored Sep 18, 2024
1 parent 7c2486d commit 15b4abf
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/tabmat/categorical_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,7 @@ def _get_col_stds(self, weights: np.ndarray, col_means: np.ndarray) -> np.ndarra
mean = self.transpose_matvec(weights)
vars = mean - col_means**2
# If using float32, we can get negative values due to precision errors
vars[vars < 0] = 0
return np.sqrt(vars)
return np.sqrt(np.maximum(vars, 0))

def __getitem__(self, item):
row, col = _check_indexer(item)
Expand Down

0 comments on commit 15b4abf

Please sign in to comment.