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] cuml fit_transform broken: TypeError: transform() got an unexpected keyword argument 'sample_weight' #4043

Closed
pseudotensor opened this issue Jul 11, 2021 · 0 comments · Fixed by #4055
Labels
bug Something isn't working

Comments

@pseudotensor
Copy link

pseudotensor commented Jul 11, 2021

from cuml import KMeans
from cuml.cluster import KMeans

import cudf
import numpy as np
import pandas as pd

def np2cudf(df):
    # convert numpy array to cuDF dataframe
    df = pd.DataFrame({'fea%d'%i:df[:,i] for i in range(df.shape[1])})
    pdf = cudf.DataFrame()
    for c,column in enumerate(df):
      pdf[str(c)] = df[column]
    return pdf

a = np.asarray([[1.0, 1.0], [1.0, 2.0], [3.0, 2.0], [4.0, 3.0]],
               dtype=np.float32)
b = np2cudf(a)
print("input:")
print(b)

print("Calling fit")
kmeans_float = KMeans(n_clusters=2)
kmeans_float.fit_transform(b)
input:
     0    1
0  1.0  1.0
1  1.0  2.0
2  3.0  2.0
3  4.0  3.0
Calling fit
Traceback (most recent call last):
  File "gocuml.py", line 24, in <module>
    kmeans_float.fit_transform(b)
  File "/home/jon/minicondadai_py38/lib/python3.8/site-packages/cuml/internals/api_decorators.py", line 586, in inner_get
    ret_val = func(*args, **kwargs)
  File "cuml/cluster/kmeans.pyx", line 628, in cuml.cluster.kmeans.KMeans.fit_transform
  File "/home/jon/minicondadai_py38/lib/python3.8/site-packages/cuml/internals/api_decorators.py", line 586, in inner_get
    ret_val = func(*args, **kwargs)
  File "cuml/cluster/kmeans.pyx", line 546, in cuml.cluster.kmeans.KMeans.transform
TypeError: transform() got an unexpected keyword argument 'sample_weight'
@pseudotensor pseudotensor added ? - Needs Triage Need team to review and classify bug Something isn't working labels Jul 11, 2021
@lowener lowener removed the ? - Needs Triage Need team to review and classify label Jul 16, 2021
rapids-bot bot pushed a commit that referenced this issue Jul 16, 2021
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
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants