Skip to content

make_sparse_spd_matrix does not return sparse matrix #27359

@Tialo

Description

@Tialo

Describe the bug

I have been looking at #27090 and working on test_graphical_lasso.py. There is used make_sparse_spd_matrix function, which, according to documentation, should return sparse matrix. But it returns numpy.ndarray.

Did not find any issue mentioned it, so I considered it to be a bug.
Should it return scipy sparse matrix, or documentation should be changed?

Steps/Code to Reproduce

from sklearn.datasets import make_sparse_spd_matrix
make_sparse_spd_matrix(4)

Expected Results

scipy sparse matrix

Actual Results

numpy.ndarray

Versions

System:
    python: 3.9.16 | packaged by conda-forge | (main, Feb  1 2023, 21:42:20)  [Clang 14.0.6 ]
executable: /Users/y.korobko/mambaforge/envs/sklearn-env/bin/python
   machine: macOS-13.4.1-x86_64-i386-64bit
Python dependencies:
      sklearn: 1.4.dev0
          pip: 23.2.1
   setuptools: 68.0.0
        numpy: 1.25.1
        scipy: 1.11.1
       Cython: 3.0.0
       pandas: 2.0.3
   matplotlib: 3.7.2
       joblib: 1.3.1
threadpoolctl: 3.2.0
Built with OpenMP: False
threadpoolctl info:
       user_api: blas
   internal_api: openblas
    num_threads: 12
         prefix: libopenblas
       filepath: /Users/y.korobko/mambaforge/envs/sklearn-env/lib/libopenblasp-r0.3.23.dylib
        version: 0.3.23
threading_layer: openmp
   architecture: Haswell
       user_api: openmp
   internal_api: openmp
    num_threads: 12
         prefix: libomp
       filepath: /Users/y.korobko/mambaforge/envs/sklearn-env/lib/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