Quantco / glum

High performance Python GLMs with all the features!
https://glum.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
312 stars 25 forks source link

glum/tabmat is incompatible with scipy 1.14 #811

Closed github-actions[bot] closed 4 months ago

github-actions[bot] commented 4 months ago

The daily unit tests failed. See https://github.com/Quantco/glum/actions/runs/9656709326 for details.

=================================== FAILURES ===================================
____ test_glm_identity_regression_categorical_data[<lambda>3-None-irls-ls] _____
[gw1] linux -- Python 3.10.14 /home/runner/micromamba/envs/glum/bin/python3.10
tests/glm/test_glm.py:756: in test_glm_identity_regression_categorical_data
    np.testing.assert_almost_equal(X.toarray() if hasattr(X, "toarray") else X, x_mat)
../../../micromamba/envs/glum/lib/python3.10/site-packages/tabmat/categorical_matrix.py:589: in toarray
    return self.tocsr().A
E   AttributeError: 'csr_matrix' object has no attribute 'A'
_____ test_glm_identity_regression_categorical_data[<lambda>3-None-lbfgs] ______
[gw1] linux -- Python 3.10.14 /home/runner/micromamba/envs/glum/bin/python3.10
tests/glm/test_glm.py:756: in test_glm_identity_regression_categorical_data
    np.testing.assert_almost_equal(X.toarray() if hasattr(X, "toarray") else X, x_mat)
../../../micromamba/envs/glum/lib/python3.10/site-packages/tabmat/categorical_matrix.py:589: in toarray
    return self.tocsr().A
E   AttributeError: 'csr_matrix' object has no attribute 'A'
____ test_glm_identity_regression_categorical_data[<lambda>3-None-irls-cd] _____
[gw1] linux -- Python 3.10.14 /home/runner/micromamba/envs/glum/bin/python3.10
tests/glm/test_glm.py:756: in test_glm_identity_regression_categorical_data
    np.testing.assert_almost_equal(X.toarray() if hasattr(X, "toarray") else X, x_mat)
../../../micromamba/envs/glum/lib/python3.10/site-packages/tabmat/categorical_matrix.py:589: in toarray
    return self.tocsr().A
E   AttributeError: 'csr_matrix' object has no attribute 'A'
__ test_glm_identity_regression_categorical_data[<lambda>3-None-trust-constr] __
[gw1] linux -- Python 3.10.14 /home/runner/micromamba/envs/glum/bin/python3.10
tests/glm/test_glm.py:756: in test_glm_identity_regression_categorical_data
    np.testing.assert_almost_equal(X.toarray() if hasattr(X, "toarray") else X, x_mat)
../../../micromamba/envs/glum/lib/python3.10/site-packages/tabmat/categorical_matrix.py:589: in toarray
    return self.tocsr().A
E   AttributeError: 'csr_matrix' object has no attribute 'A'
___ test_glm_identity_regression_categorical_data[<lambda>3-offset1-irls-ls] ___
[gw1] linux -- Python 3.10.14 /home/runner/micromamba/envs/glum/bin/python3.10
tests/glm/test_glm.py:756: in test_glm_identity_regression_categorical_data
tests/glm/test_glm.py:3037: in test_formula
    ).fit(data)
src/glum/_glm.py:3246: in fit
    coef = self._solve(
src/glum/_glm.py:1108: in _solve
    coef, self.n_iter_, self._n_cycles, self.diagnostics_ = _irls_solver(
src/glum/_solvers.py:311: in _irls_solver
    hessian, state.n_active_rows = update_hessian(state, data, state.active_set)
src/glum/_solvers.py:36: in inner_fct
    out = fct(*args, **kwargs)
src/glum/_solvers.py:144: in update_hessian
    hessian_init = build_hessian_delta(
src/glum/_solvers.py:208: in build_hessian_delta
    delta = _safe_sandwich_dot(
src/glum/_util.py:[19](https://github.com/Quantco/glum/actions/runs/9656709326/job/26634700574#step:6:20)3: in _safe_sandwich_dot
    result = X.sandwich(d, rows, cols)
../../../micromamba/envs/glum/lib/python3.10/site-packages/tabmat/standardized_mat.py:141: in sandwich
    term1 = self.mat.sandwich(d, rows, cols)
../../../micromamba/envs/glum/lib/python3.10/site-packages/tabmat/split_matrix.py:348: in sandwich
    res = mat_i._cross_sandwich(
../../../micromamba/envs/glum/lib/python3.10/site-packages/tabmat/categorical_matrix.py:537: in _cross_sandwich
    return self._cross_sparse(other.array_csc, d, rows, L_cols, R_cols)
../../../micromamba/envs/glum/lib/python3.10/site-packages/tabmat/categorical_matrix.py:706: in _cross_sparse
    res = term_1.T.dot(_row_col_indexing(other, rows, R_cols)).A
E   AttributeError: 'csc_matrix' object has no attribute 'A'
jtilly commented 4 months ago

Yesterday's daily tests passed with https://github.com/Quantco/glum/actions/runs/9639815003/job/26582604415#step:3:354

Todays' daily tests are failing with https://github.com/Quantco/glum/actions/runs/9656709326/job/26634700574#step:3:354.

From scipy's release notes:

Expired deprecations There is an ongoing effort to follow through on long-standing deprecations. The following previously deprecated features are affected: Several previously deprecated methods for sparse arrays were removed: asfptype, getrow, getcol, get_shape, getmaxprint, set_shape, getnnz, and getformat. Additionally, the .A and .H attributes were removed.

https://github.com/scipy/scipy/releases/tag/v1.14.0