8000 SGDRegressor is not inheriting from LinearModel · Issue #31315 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content
SGDRegressor is not inheriting from LinearModel #31315
Open
@MarcBresson

Description

@MarcBresson

Describe the bug

I wanted to rely on the base class LinearModel to identify linear models, but I found out that SGDRegressor (nor any of its sub classes) is not inheriting this class. However, SGDClassifier is (through LinearClassifierMixin).

Is there any reason for BaseSGDRegressor to not inherit LinearModel? Is it because it overloads all of LinearModel's methods?

Steps/Code to Reproduce

from sklearn.linear_model import SGDRegressor
from sklearn.linear_model._base import LinearModel

issubclass(SGDRegressor, LinearModel)

Expected Results

from sklearn.linear_model import SGDRegressor
from sklearn.linear_model._base import LinearModel

issubclass(SGDRegressor, LinearModel)

True

Actual Results

from sklearn.linear_model import SGDRegressor
from sklearn.linear_model._base import LinearModel

issubclass(SGDRegressor, LinearModel)

False

Versions

System:
    python: 3.10.11 (v3.10.11:7d4cc5aa85, Apr  4 2023, 19:05:19) [Clang 13.0.0 (clang-1300.0.29.30)]
executable: /usr/local/bin/python3.10
   machine: macOS-14.4.1-arm64-arm-64bit

Python dependencies:
      sklearn: 1.5.0
          pip: 24.2
   setuptools: 74.0.0
        numpy: 1.26.4
        scipy: 1.13.1
       Cython: 3.0.12
       pandas: 1.5.3
   matplotlib: 3.8.4
       joblib: 1.2.0
threadpoolctl: 3.5.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
    num_threads: 8
         prefix: libopenblas
       filepath: /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/.dylibs/libopenblas64_.0.dylib
        version: 0.3.23.dev
threading_layer: pthreads
   architecture: armv8

       user_api: blas
   internal_api: openblas
    num_threads: 8
         prefix: libopenblas
       filepath: /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/scipy/.dylibs/libopenblas.0.dylib
        version: 0.3.27
threading_layer: pthreads
   architecture: neoversen1

       user_api: openmp
   internal_api: openmp
    num_threads: 8
         prefix: libomp
       filepath: /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/sklearn/.dylibs/libomp.dylib
        version: None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0