Skip to content

Commit 83224e2

Browse files
committed
Remove RF_params.oob_score
Not needed since we can trigger the bootstrap_mask storage by providing a non-null pointer.
1 parent ba0c33a commit 83224e2

8 files changed

Lines changed: 9 additions & 24 deletions

File tree

cpp/bench/sg/fil.cu

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ std::vector<Params> getInputs()
170170
true, /* bootstrap */
171171
1, /* n_trees */
172172
1.f, /* max_samples */
173-
false, /* oob_score */
174173
1234ULL, /* seed */
175174
ML::CRITERION::MSE, /* split_criterion */
176175
8, /* n_streams */

cpp/bench/sg/rf_classifier.cu

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION.
2+
* SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION.
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

@@ -92,7 +92,6 @@ std::vector<Params> getInputs()
9292
true, /* bootstrap */
9393
500, /* n_trees */
9494
1.f, /* max_samples */
95-
false, /* oob_score */
9695
1234ULL, /* seed */
9796
ML::CRITERION::GINI, /* split_criterion */
9897
8, /* n_streams */

cpp/bench/sg/rf_regressor.cu

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION.
2+
* SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION.
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

@@ -92,7 +92,6 @@ std::vector<RegParams> getInputs()
9292
true, /* bootstrap */
9393
500, /* n_trees */
9494
1.f, /* max_samples */
95-
false, /* oob_score */
9695
1234ULL, /* seed */
9796
ML::CRITERION::MSE, /* split_criterion */
9897
8, /* n_streams */

cpp/include/cuml/ensemble/randomforest.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,6 @@ struct RF_params {
6868
* Ratio of dataset rows used while fitting each tree.
6969
*/
7070
float max_samples;
71-
/**
72-
* Whether to compute out-of-bag score.
73-
* If true, per-tree bootstrap masks are stored for OOB computation.
74-
*/
75-
bool oob_score;
7671
/**
7772
* Decision tree training hyper parameter struct.
7873
*/
@@ -202,7 +197,6 @@ RF_params set_rf_params(int max_depth,
202197
bool bootstrap,
203198
int n_trees,
204199
float max_samples,
205-
bool oob_score,
206200
uint64_t seed,
207201
CRITERION split_criterion,
208202
int cfg_n_streams,

cpp/src/randomforest/randomforest.cu

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,6 @@ RF_params set_rf_params(int max_depth,
524524
bool bootstrap,
525525
int n_trees,
526526
float max_samples,
527-
bool oob_score,
528527
uint64_t seed,
529528
CRITERION split_criterion,
530529
int cfg_n_streams,
@@ -545,7 +544,6 @@ RF_params set_rf_params(int max_depth,
545544
rf_params.n_trees = n_trees;
546545
rf_params.bootstrap = bootstrap;
547546
rf_params.max_samples = max_samples;
548-
rf_params.oob_score = oob_score;
549547
rf_params.seed = seed;
550548
rf_params.n_streams = min(cfg_n_streams, omp_get_max_threads());
551549
if (n_trees < rf_params.n_streams) rf_params.n_streams = n_trees;

cpp/src/randomforest/randomforest.cuh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ class RandomForest {
185185
quantiles,
186186
i);
187187

188-
// Store bootstrap mask if OOB score is enabled and device buffer is provided
189-
if (this->rf_params.oob_score && bootstrap_masks != nullptr) {
188+
// Store bootstrap mask if device buffer is provided
189+
if (bootstrap_masks != nullptr) {
190190
// Calculate pointer offset for this tree's mask
191191
bool* tree_mask = bootstrap_masks + (i * n_rows);
192192

cpp/tests/sg/rf_test.cu

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ auto TrainScore(
308308
params.bootstrap,
309309
params.n_trees,
310310
params.max_samples,
311-
false, // oob_score
312311
0,
313312
params.split_criterion,
314313
params.n_streams,
@@ -636,7 +635,7 @@ TEST(RfTests, IntegerOverflow)
636635
auto stream_pool = std::make_shared<rmm::cuda_stream_pool>(4);
637636
raft::handle_t handle(rmm::cuda_stream_per_thread, stream_pool);
638637
RF_params rf_params =
639-
set_rf_params(3, 100, 1.0, 256, 1, 2, 0.0, false, 1, 1.0, false, 0, CRITERION::MSE, 4, 128);
638+
set_rf_params(3, 100, 1.0, 256, 1, 2, 0.0, false, 1, 1.0, 0, CRITERION::MSE, 4, 128);
640639
fit(handle, forest_ptr, X.data().get(), m, n, y.data().get(), rf_params);
641640

642641
// Check we have actually learned something
@@ -886,9 +885,8 @@ INSTANTIATE_TEST_CASE_P(RfTests, RFQuantileVariableBinsTestD, ::testing::ValuesI
886885

887886
TEST(RfTest, TextDump)
888887
{
889-
RF_params rf_params =
890-
set_rf_params(2, 2, 1.0, 2, 1, 2, 0.0, false, 1, 1.0, false, 0, GINI, 1, 128);
891-
auto forest = std::make_shared<RandomForestMetaData<float, int>>();
888+
RF_params rf_params = set_rf_params(2, 2, 1.0, 2, 1, 2, 0.0, false, 1, 1.0, 0, GINI, 1, 128);
889+
auto forest = std::make_shared<RandomForestMetaData<float, int>>();
892890

893891
std::vector<float> X_host = {1, 2, 3, 6, 7, 8};
894892
thrust::device_vector<float> X = X_host;

python/cuml/cuml/ensemble/randomforest_common.pyx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ cdef extern from "cuml/ensemble/randomforest.hpp" namespace "ML" nogil:
5050
cdef struct RF_params:
5151
pass
5252

53-
cdef RF_params set_rf_params(
53+
cdef RF_params set_rf_params(
5454
int max_depth,
5555
int max_leaves,
5656
float max_features,
@@ -61,7 +61,6 @@ cdef extern from "cuml/ensemble/randomforest.hpp" namespace "ML" nogil:
6161
bool bootstrap,
6262
int n_trees,
6363
float max_samples,
64-
bool oob_score,
6564
uint64_t seed,
6665
CRITERION split_criterion,
6766
int cfg_n_streams,
@@ -447,7 +446,7 @@ class BaseRandomForestModel(Base, InteropMixin):
447446
else:
448447
n_bins = self.n_bins
449448

450-
cdef RF_params params = set_rf_params(
449+
cdef RF_params params = set_rf_params(
451450
self.max_depth,
452451
self.max_leaves,
453452
max_features,
@@ -458,7 +457,6 @@ class BaseRandomForestModel(Base, InteropMixin):
458457
self.bootstrap,
459458
self.n_estimators,
460459
self.max_samples,
461-
self.oob_score,
462460
seed,
463461
_normalize_split_criterion(self.split_criterion),
464462
self.n_streams,

0 commit comments

Comments
 (0)