Skip to content

The input_tags.sparse flag is often incorrect #30139

Closed
@antoinebaker

Description

@antoinebaker

Describe the bug

If I understood correctly the developer API for tags, input_tags.sparse tells us whether an estimator can accept sparse data or not. For many estimators it seems that input_tags.sparse is False but should be True.

Steps/Code to Reproduce

from sklearn.linear_model import LinearRegression
from sklearn.utils import get_tags

reg = LinearRegression()
tags = get_tags(reg)
tags.input_tags.sparse

Expected Results

True as LinearRegression accepts sparse input data.

Actual Results

False

Versions

System:
    python: 3.12.5 | packaged by conda-forge | (main, Aug  8 2024, 18:32:50) [Clang 16.0.6 ]
executable: /Users/abaker/miniforge3/envs/sklearn-dev/bin/python
   machine: macOS-14.5-arm64-arm-64bit

Python dependencies:
      sklearn: 1.6.dev0
          pip: 24.2
   setuptools: 73.0.1
        numpy: 2.1.0
        scipy: 1.14.1
       Cython: 3.0.11
       pandas: 2.2.2
   matplotlib: 3.9.2
       joblib: 1.4.2
threadpoolctl: 3.5.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
    num_threads: 8
         prefix: libopenblas
       filepath: /Users/abaker/miniforge3/envs/sklearn-dev/lib/libopenblas.0.dylib
        version: 0.3.27
threading_layer: openmp
   architecture: VORTEX

       user_api: openmp
   internal_api: openmp
    num_threads: 8
         prefix: libomp
       filepath: /Users/abaker/miniforge3/envs/sklearn-dev/lib/libomp.dylib
        version: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDeveloper APIThird party developer API related

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions