Skip to content

Commit 6ed6b51

Browse files
authored
Merge branch 'main' into pull-request/6211
2 parents 8c11bbb + cb13f32 commit 6ed6b51

7 files changed

Lines changed: 9 additions & 11 deletions

File tree

python/cuml/cuml/dask/neighbors/kneighbors_classifier.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,8 @@ def fit(self, X, y):
9696
uniq_labels.append(_y.iloc[:, i].unique())
9797

9898
uniq_labels = da.compute(uniq_labels)[0]
99-
if hasattr(uniq_labels[0], "values_host"): # for cuDF Series
100-
uniq_labels = list(map(lambda x: x.values_host, uniq_labels))
101-
elif hasattr(uniq_labels[0], "values"): # for pandas Series
102-
uniq_labels = list(map(lambda x: x.values, uniq_labels))
99+
if hasattr(uniq_labels[0], "to_numpy"): # for pandas and cuDF Series
100+
uniq_labels = list(map(lambda x: x.to_numpy(), uniq_labels))
103101
elif isinstance(uniq_labels[0], cp.ndarray): # for CuPy arrays
104102
uniq_labels = list(map(lambda x: cp.asnumpy(x), uniq_labels))
105103
self.uniq_labels = np.sort(np.array(uniq_labels))

python/cuml/cuml/preprocessing/LabelEncoder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def inverse_transform(self, y: "cudf.Series"):
268268
category_num = len(self.classes_)
269269
if self.handle_unknown == "error":
270270
if not isinstance(ord_label, (cp.ndarray, np.ndarray)):
271-
ord_label = ord_label.values_host
271+
ord_label = ord_label.to_numpy()
272272
for ordi in ord_label:
273273
if ordi < 0 or ordi >= category_num:
274274
raise ValueError(

python/cuml/cuml/preprocessing/TargetEncoder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ def _rename_col(df, col):
530530
res = []
531531
unq_vals = train[self.fold_col].unique()
532532
if not isinstance(unq_vals, (cp.ndarray, np.ndarray)):
533-
unq_vals = unq_vals.values_host
533+
unq_vals = unq_vals.to_numpy()
534534
for f in unq_vals:
535535
mask = train[self.fold_col].values == f
536536
dg = train.loc[~mask].groupby(x_cols).agg({self.y_col: self.stat})

python/cuml/cuml/preprocessing/encoders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ def get_feature_names(self, input_features=None):
536536
feature_names = []
537537
for i in range(len(cats)):
538538
names = [
539-
input_features[i] + "_" + str(t) for t in cats[i].values_host
539+
input_features[i] + "_" + str(t) for t in cats[i].to_numpy()
540540
]
541541
if self.drop_idx_ is not None and self.drop_idx_[i] is not None:
542542
names.pop(self.drop_idx_[i])

python/cuml/cuml/testing/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ def from_df_to_numpy(df):
473473
if isinstance(df, pd.DataFrame):
474474
return list(zip(*[df[feature] for feature in df.columns]))
475475
else:
476-
return list(zip(*[df[feature].values_host for feature in df.columns]))
476+
return list(zip(*[df[feature].to_numpy() for feature in df.columns]))
477477

478478

479479
def compare_svm(

python/cuml/tests/test_one_hot_encoder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION.
1+
# SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION.
22
# SPDX-License-Identifier: Apache-2.0
33
import math
44

@@ -26,7 +26,7 @@ def _from_df_to_cupy(df):
2626
df[col] = [ord(c) for c in df[col]]
2727
else:
2828
df[col] = [
29-
ord(c) if c is not None else c for c in df[col].values_host
29+
ord(c) if c is not None else c for c in df[col].to_numpy()
3030
]
3131
return cp.array(from_df_to_numpy(df))
3232

python/cuml/tests/test_train_test_split.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def test_split_dataframe(train_size, shuffle):
6565
y_reconstructed = cudf.concat([y_train, y_test]).sort_values()
6666

6767
assert all(X_reconstructed.reset_index(drop=True) == X)
68-
out = y_reconstructed.reset_index(drop=True).values_host == y.values_host
68+
out = y_reconstructed.reset_index(drop=True).to_numpy() == y.to_numpy()
6969
assert all(out)
7070

7171

0 commit comments

Comments
 (0)