Skip to content

Commit 5d5c2c8

Browse files
committed
Enable CPU execution of RandomForestRegressor.score
1 parent 6cf1271 commit 5d5c2c8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

python/cuml/cuml/ensemble/randomforestregressor.pyx

+1
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ class RandomForestRegressor(BaseRandomForestModel,
629629
domain="cuml_python")
630630
@insert_into_docstring(parameters=[('dense', '(n_samples, n_features)'),
631631
('dense', '(n_samples, 1)')])
632+
@enable_device_interop
632633
def score(self, X, y, algo='auto', convert_dtype=True,
633634
fil_sparse_format='auto', predict_model="GPU"):
634635
"""

python/cuml/cuml_accel_tests/integration/test_rf_regressor.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ def test_rf_criterion_reg(regression_data, criterion):
4848
criterion=criterion, n_estimators=50, random_state=42
4949
)
5050
reg.fit(X, y)
51-
_ = r2_score(y, reg.predict(X))
51+
score1 = r2_score(y, reg.predict(X))
52+
assert isinstance(score1, float)
53+
score2 = reg.score(X, y)
54+
assert isinstance(score2, float)
5255

5356

5457
@pytest.mark.parametrize("max_depth", [None, 5, 10])

0 commit comments

Comments
 (0)