Skip to content

Commit

Permalink
Merge branch 'branch-24.04' into test-cuda-12.2
Browse files Browse the repository at this point in the history
  • Loading branch information
vyasr authored Feb 9, 2024
2 parents f94be82 + d2f509e commit da0c036
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
11 changes: 6 additions & 5 deletions cpp/test/sg/fil_test.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2023, NVIDIA CORPORATION.
* Copyright (c) 2019-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -787,6 +787,7 @@ class TreeliteFilTest : public BaseFilTest<real_t> {
case fil::leaf_algo_t::GROVE_PER_CLASS_FEW_CLASSES:
case fil::leaf_algo_t::GROVE_PER_CLASS_MANY_CLASSES: break;
}
builder->EndNode();
} else {
int left = root + 2 * (node - root) + 1;
int right = root + 2 * (node - root) + 2;
Expand All @@ -806,8 +807,6 @@ class TreeliteFilTest : public BaseFilTest<real_t> {
}
}
}
node_to_treelite(builder, root, left);
node_to_treelite(builder, root, right);
// TODO(levsnv): remove workaround once confirmed to work with empty category lists in
// Treelite
if (!right_categories.empty() && dense_node.is_categorical()) {
Expand All @@ -818,8 +817,10 @@ class TreeliteFilTest : public BaseFilTest<real_t> {
adjust_threshold_to_treelite(&threshold, &left, &right, &default_left, this->ps.op);
builder->NumericalTest(dense_node.fid(), threshold, default_left, this->ps.op, left, right);
}
builder->EndNode();
node_to_treelite(builder, root, left);
node_to_treelite(builder, root, right);
}
builder->EndNode();
}

void init_forest_impl(fil::forest_t<real_t>* pforest, fil::storage_type_t storage_type)
Expand Down Expand Up @@ -875,7 +876,7 @@ class TreeliteFilTest : public BaseFilTest<real_t> {
postprocessor_name = "sigmoid";
}
} else if (this->ps.leaf_algo != fil::leaf_algo_t::FLOAT_UNARY_BINARY) {
postprocessor_name = "softmax";
postprocessor_name = "identity_multiclass";
this->ps.output = fil::output_t(this->ps.output | fil::output_t::SOFTMAX);
} else if (this->ps.leaf_algo == GROVE_PER_CLASS) {
postprocessor_name = "identity_multiclass";
Expand Down
2 changes: 1 addition & 1 deletion python/cuml/benchmark/datagen.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def _gen_data_regression(
)

X_df = cudf.DataFrame(X_arr)
y_df = cudf.Series(y_arr)
y_df = cudf.Series(np.squeeze(y_arr))

return X_df, y_df

Expand Down
3 changes: 2 additions & 1 deletion python/cuml/common/sparsefuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,9 @@ def create_csr_matrix_from_count_df(

doc_token_counts = count_df["doc_id"].value_counts().reset_index()
del count_df

doc_token_counts = doc_token_counts.rename(
{"doc_id": "token_counts", "index": "doc_id"}, axis=1
{"count": "token_counts"}, axis=1
).sort_values(by="doc_id")

token_counts = _insert_zeros(
Expand Down
2 changes: 1 addition & 1 deletion python/cuml/preprocessing/encoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def inverse_transform(self, X):
dropped_class_idx = Series(self.drop_idx_[feature])
dropped_class_mask = Series(cats).isin(cats[dropped_class_idx])
if len(cats) == 1:
inv = Series(Index(cats[0]).repeat(X.shape[0]))
inv = Series(Index([cats[0]]).repeat(X.shape[0]))
result[feature] = inv
continue
cats = cats[~dropped_class_mask]
Expand Down
4 changes: 2 additions & 2 deletions python/cuml/tests/test_train_test_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_split_dataframe(train_size, shuffle):
assert all(X_test.index.to_pandas() == y_test.index.to_pandas())

X_reconstructed = cudf.concat([X_train, X_test]).sort_values(by=["x"])
y_reconstructed = y_train.append(y_test).sort_values()
y_reconstructed = cudf.concat([y_train, y_test]).sort_values()

assert all(X_reconstructed.reset_index(drop=True) == X)
out = y_reconstructed.reset_index(drop=True).values_host == y.values_host
Expand Down Expand Up @@ -96,7 +96,7 @@ def test_split_column():
)

X_reconstructed = cudf.concat([X_train, X_test]).sort_values(by=["x"])
y_reconstructed = y_train.append(y_test).sort_values()
y_reconstructed = cudf.concat([y_train, y_test]).sort_values()

assert all(
data
Expand Down
1 change: 1 addition & 0 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ build-dir = "build/{wheel_tag}"
cmake.build-type = "Release"
cmake.minimum-version = "3.26.4"
ninja.make-fallback = true
sdist.exclude = ["*tests*"]
sdist.reproducible = true
wheel.packages = ["cuml"]

Expand Down

0 comments on commit da0c036

Please sign in to comment.