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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
glemaitre opened this issue Nov 7, 2021 · 1 comment · Fixed by #21809
Closed

Conflict between key-values and build-in method name in Bunch #21595

glemaitre opened this issue Nov 7, 2021 · 1 comment · Fixed by #21809

Comments

@glemaitre
Copy link
Member

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
@adrinjalali
Copy link
Member

I really think we should rename values here to something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
0