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] LabelEncoder can't encode cupy array #4589

Closed
daxiongshu opened this issue Feb 18, 2022 · 2 comments
Closed

[BUG] LabelEncoder can't encode cupy array #4589

daxiongshu opened this issue Feb 18, 2022 · 2 comments
Assignees
Labels
? - Needs Triage Need team to review and classify bug Something isn't working inactive-30d

Comments

@daxiongshu
Copy link
Contributor

Describe the bug
cuml.preprocessing.LabelEncoder can't encode cupy.ndarray. it can only encode cudf.Series. In comparison, sklearn LabelEncoder can encode both pandas.Series and numpy.ndarray.

Steps/Code to reproduce bug

import cuml
import cupy
x = cupy.array([1,2,3])
lbl = cuml.preprocessing.LabelEncoder()
lbl.fit(x)

output:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-1ce7fdb217b0> in <module>
----> 1 lbl.fit(x)

/raid/data/ml/anaconda3/envs/cuml_dev/lib/python3.9/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

/raid/data/ml/anaconda3/envs/cuml_dev/lib/python3.9/site-packages/cuml/preprocessing/LabelEncoder.py in fit(self, y, _classes)
    179             self.classes_ = _classes
    180         else:
--> 181             self.classes_ = y.unique()  # dedupe and sort
    182 
    183         self._fitted = True

AttributeError: 'cupy._core.core.ndarray' object has no attribute 'unique'

Expected behavior
output:

array([0, 1, 2])

Environment details (please complete the following information):

  • Environment location: Bare-metal
  • Linux Distro/Architecture: Ubuntu 18.04 amd64
  • GPU Model/Driver: V100 and driver 495.44
  • CUDA: 11.5
  • Method of cuDF & cuML install: from source
@daxiongshu daxiongshu added bug Something isn't working ? - Needs Triage Need team to review and classify labels Feb 18, 2022
@daxiongshu daxiongshu self-assigned this Feb 18, 2022
@github-actions
Copy link

This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.

rapids-bot bot pushed a commit that referenced this issue May 23, 2022
@daxiongshu
Copy link
Contributor Author

issue closed with above PR

vimarsh6739 pushed a commit to vimarsh6739/cuml that referenced this issue Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
? - Needs Triage Need team to review and classify bug Something isn't working inactive-30d
Projects
None yet
Development

No branches or pull requests

1 participant