diff --git a/miplearn/features/extractor.py b/miplearn/features/extractor.py index 398a3e4..d1466f9 100644 --- a/miplearn/features/extractor.py +++ b/miplearn/features/extractor.py @@ -356,17 +356,8 @@ class FeaturesExtractor: push(np.abs(v)) def maxmin(M: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: - # Compute max using regular numpy operations M_max = np.ravel(M.max(axis=0).todense()) - - # Compute min by iterating through the sparse matrix data, so that - # we skip non-zero entries - M_min = np.array( - [ - 0.0 if len(M[:, j].data) == 0 else M[:, j].data.min() - for j in range(M.shape[1]) - ] - ) + M_min = np.ravel(M.min(axis=0).todense()) return M_max, M_min with np.errstate(divide="ignore", invalid="ignore"):