Skip to content

Deprecation warning with scipy=1.9.0 #24080

Closed
@jonyscathe

Description

@jonyscathe

Describe the bug

When running a fit with a Ride regression model we get:

DeprecationWarning: The 'sym_pos' keyword is deprecated and should be replaced by using 'assume_a = "pos"'. 'sym_pos' will be removed in SciPy 1.11.0.

Looking through the SciPy release notes, sym_pos was actually deprecated about 5 years ago, they just forgot to add the deprecation warning. Now that they have, it is probably best to make this change now before the sym_pos keyword is actually removed.

The argument is used 4 times within sklearn/linear_model/_ridge.py.

Steps/Code to Reproduce

import warnings

from sklearn import linear_model

warnings.simplefilter('always', DeprecationWarning)

reg = linear_model.Ridge(alpha=0.5, solver='cholesky')
reg.fit([[0, 0], [0, 0], [1, 1]], [0, 0.1, 1])

Expected Results

No warnings generated

Actual Results

/usr/local/lib/python3.10/site-packages/sklearn/linear_model/_ridge.py:212: DeprecationWarning: The 'sym_pos' keyword is deprecated and should be replaced by using 'assume_a = "pos"'. 'sym_pos' will be removed in SciPy 1.11.0.
return linalg.solve(A, Xy, sym_pos=True, overwrite_a=True).T

Versions

System:
    python: 3.10.5 (main, Jul 13 2022, 05:45:22) [GCC 10.2.1 20210110]
executable: /usr/local/bin/python
   machine: Linux-5.15.0-43-generic-x86_64-with-glibc2.31

Python dependencies:
      sklearn: 1.1.1
          pip: 22.1.2
   setuptools: 58.1.0
        numpy: 1.23.1
        scipy: 1.9.0
       Cython: None
       pandas: 1.4.3
   matplotlib: 3.5.2
       joblib: 1.1.0
threadpoolctl: 3.1.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
         prefix: libgomp
       filepath: /usr/local/lib/python3.10/site-packages/scikit_learn.libs/libgomp-a34b3233.so.1.0.0
        version: None
    num_threads: 32

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: /usr/local/lib/python3.10/site-packages/numpy.libs/libopenblas64_p-r0-742d56dc.3.20.so
        version: 0.3.20
threading_layer: pthreads
   architecture: Zen
    num_threads: 32

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: /usr/local/lib/python3.10/site-packages/scipy.libs/libopenblasp-r0-9f9f5dbc.3.18.so
        version: 0.3.18
threading_layer: pthreads
   architecture: Zen
    num_threads: 32

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions