8000 Conflict between key-values and build-in method name in `Bunch` · Issue #21595 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content
Conflict between key-values and build-in method name in Bunch #21595
Closed
@glemaitre

Description

@glemaitre

Describe the bug

This is unfortunate but there is a clash between the values key and the values build-in method in the Bunch returned by partial_dependence.

Steps/Code to Reproduce

In [1]: X = [[0, 0, 2], [1, 0, 0]]
   ...: y = [0, 1]
   ...: from sklearn.inspection import partial_dependence
   ...: from sklearn.ensemble import GradientBoostingClassifier
   ...: gb = GradientBoostingClassifier(random_state=0).fit(X, y)
   ...: results = partial_dependence(gb, features=[0], X=X, percentiles=(0, 1),
   ...:                    grid_resolution=2, kind="average")

In [1]: 

In [2]: results.values
Out[2]: <function Bunch.values>

In [3]: results.keys()
Out[3]: dict_keys(['average', 'values'])

Expected Results

We cannot access the values with results.values

Actual Results

We might expect to access the values with results.values

Versions

System:
    python: 3.8.12 | packaged by conda-forge | (default, Sep 16 2021, 01:38:21)  [Clang 11.1.0 ]
executable: /Users/glemaitre/mambaforge/envs/dev/bin/python
   machine: macOS-12.0.1-arm64-arm-64bit

Python dependencies:
          pip: 21.3
   setuptools: 58.2.0
      sklearn: 1.1.dev0
        numpy: 1.21.2
        scipy: 1.8.0.dev0+1902.b795164
       Cython: 0.29.24
       pandas: 1.3.3
   matplotlib: 3.4.3
       joblib: 1.0.1
threadpoolctl: 3.0.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: /Users/glemaitre/mambaforge/envs/dev/lib/libopenblas_vortexp-r0.3.18.dylib
        version: 0.3.18
threading_layer: openmp
   architecture: VORTEX
    num_threads: 8

       user_api: openmp
   internal_api: openmp
         prefix: libomp
       filepath: /Users/glemaitre/mambaforge/envs/dev/lib/libomp.dylib
        version: None
    num_threads: 8

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