1
+ import sys
2
+
1
3
import numpy as np
2
- import xgboost as xgb
3
4
import pytest
4
- import sys
5
- from hypothesis import given , strategies , settings
6
- from scipy import sparse
5
+ from hypothesis import given , settings , strategies
6
+
7
+ import xgboost as xgb
7
8
8
9
sys .path .append ("tests/python" )
9
- import testing as tm
10
10
import test_quantile_dmatrix as tqd
11
+ import testing as tm
11
12
12
13
13
14
class TestDeviceQuantileDMatrix :
@@ -107,9 +108,8 @@ def test_ref_dmatrix(self) -> None:
107
108
@settings (print_blob = True , deadline = None )
108
109
def test_to_csr (self , n_samples , n_features , sparsity ) -> None :
109
110
import cupy as cp
110
- X , y = tm .make_sparse_regression (
111
- n_samples , n_features , sparsity , False
112
- )
111
+
112
+ X , y = tm .make_sparse_regression (n_samples , n_features , sparsity , False )
113
113
h_X = X .astype (np .float32 )
114
114
115
115
csr = h_X
@@ -130,10 +130,12 @@ def test_to_csr(self, n_samples, n_features, sparsity) -> None:
130
130
np .testing .assert_equal (h_ret .indptr , d_ret .indptr )
131
131
np .testing .assert_equal (h_ret .indices , d_ret .indices )
132
132
133
- booster = xgb .train ({"tree_method" : "gpu_hist" }, dtrain = d_m )
133
+ booster = xgb .train (
134
+ {"tree_method" : "gpu_hist" , "predictor" : "gpu_predictor" }, dtrain = d_m
135
+ )
134
136
135
137
np .testing .assert_allclose (
136
138
booster .predict (d_m ),
137
139
booster .predict (xgb .DMatrix (d_m .get_data ())),
138
- atol = 1e-6
140
+ atol = 1e-6 ,
139
141
)
0 commit comments