Skip to content
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

[BUG] RandomForestClassifier score failing due to output_class handling #3682

Closed
beckernick opened this issue Mar 31, 2021 · 2 comments · Fixed by #3685
Closed

[BUG] RandomForestClassifier score failing due to output_class handling #3682

beckernick opened this issue Mar 31, 2021 · 2 comments · Fixed by #3685
Assignees
Labels
bug Something isn't working Cython / Python Cython or Python issue

Comments

@beckernick
Copy link
Member

In today's nightly, RandomForestClassifier.score is failing with an output class handling error.

import cuml
from sklearn.datasets import make_classification
​
X, y = make_classification(
    n_samples=100000,
    n_features=20,
    n_informative=15,
    n_classes=2,
    class_sep=0.5,
    shuffle=True,
    random_state=12,
)
​
X = X.astype("float32")
​
gclf = cuml.ensemble.RandomForestClassifier(
    n_estimators=100,
)
gclf.fit(X, y)
gclf.score(X, y)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-30-1162551a0613> in <module>
     18 )
     19 gclf.fit(X, y)
---> 20 gclf.score(X, y)

/raid/nicholasb/miniconda3/envs/rapids-gpubdb-20210331/lib/python3.7/site-packages/cuml/internals/api_decorators.py in inner(*args, **kwargs)
    358         def inner(*args, **kwargs):
    359             with self._recreate_cm(func, args):
--> 360                 return func(*args, **kwargs)
    361 
    362         return inner

cuml/ensemble/randomforestclassifier.pyx in cuml.ensemble.randomforestclassifier.RandomForestClassifier.score()

/raid/nicholasb/miniconda3/envs/rapids-gpubdb-20210331/lib/python3.7/site-packages/cuml/internals/api_decorators.py in inner_get(*args, **kwargs)
    584 
    585                 # Call the function
--> 586                 ret_val = func(*args, **kwargs)
    587 
    588             return cm.process_return(ret_val)

cuml/ensemble/randomforestclassifier.pyx in cuml.ensemble.randomforestclassifier.RandomForestClassifier.predict()

TypeError: predict() got an unexpected keyword argument 'output_class'
conda list | grep "rapids\|dask\|numpy\|cupy"
# packages in environment at /raid/nicholasb/miniconda3/envs/rapids-gpubdb-20210331:
cudf                      0.19.0a210331   cuda_10.2_py37_gc99fcef41b_313    rapidsai-nightly
cuml                      0.19.0a210331   cuda10.2_py37_g83168076c_138    rapidsai-nightly
cupy                      8.6.0            py37h7fc54ca_0    conda-forge
dask                      2021.3.1           pyhd8ed1ab_0    conda-forge
dask-core                 2021.3.1           pyhd8ed1ab_0    conda-forge
dask-cuda                 0.19.0a210331           py37_45    rapidsai-nightly
dask-cudf                 0.19.0a210331   py37_gc99fcef41b_313    rapidsai-nightly
libcudf                   0.19.0a210331   cuda10.2_gbe2f0c000f_314    rapidsai-nightly
libcuml                   0.19.0a210331   cuda10.2_g83168076c_138    rapidsai-nightly
libcumlprims              0.19.0a210316   cuda10.2_ge7e82a0_12    rapidsai-nightly
librmm                    0.19.0a210331   cuda10.2_g9d1ba02_50    rapidsai-nightly
numpy                     1.19.5           py37haa41c4c_1    conda-forge
rmm                       0.19.0a210331   cuda_10.2_py37_g9d1ba02_50    rapidsai-nightly
ucx                       1.9.0+gcd9efd3       cuda10.2_0    rapidsai-nightly
ucx-proc                  1.0.0                       gpu    rapidsai-nightly
ucx-py                    0.19.0a210331   py37_gcd9efd3_46    rapidsai-nightly
@beckernick beckernick added bug Something isn't working ? - Needs Triage Need team to review and classify labels Mar 31, 2021
@hcho3 hcho3 added Cython / Python Cython or Python issue and removed ? - Needs Triage Need team to review and classify labels Mar 31, 2021
@hcho3 hcho3 self-assigned this Mar 31, 2021
@hcho3
Copy link
Contributor

hcho3 commented Mar 31, 2021

The bug is most likely introduced in #3609. I will submit a pull request today.

@hcho3
Copy link
Contributor

hcho3 commented Mar 31, 2021

I filed #3685 to restore the functionality of score(). Thanks!

@rapids-bot rapids-bot bot closed this as completed in #3685 Apr 1, 2021
rapids-bot bot pushed a commit that referenced this issue Apr 1, 2021
Closes #3682

In #3609, I unintentionally broke the function `score()` in the random forest. This PR restores the functionality. In addition, I added `score()` to one of the unit tests to ensure that `score()` does not break again.

Authors:
  - Philip Hyunsu Cho (https://github.com/hcho3)

Approvers:
  - John Zedlewski (https://github.com/JohnZed)

URL: #3685
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Cython / Python Cython or Python issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants