Support exporting cut values (#9356)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import json
|
||||
import sys
|
||||
|
||||
import numpy as np
|
||||
@@ -10,6 +11,16 @@ from test_dmatrix import set_base_margin_info
|
||||
|
||||
from xgboost import testing as tm
|
||||
|
||||
cupy = pytest.importorskip("cupy")
|
||||
|
||||
|
||||
def test_array_interface() -> None:
|
||||
arr = cupy.array([[1, 2, 3, 4], [1, 2, 3, 4]])
|
||||
i_arr = arr.__cuda_array_interface__
|
||||
i_arr = json.loads(json.dumps(i_arr))
|
||||
ret = xgb.core.from_array_interface(i_arr)
|
||||
np.testing.assert_equal(cupy.asnumpy(arr), cupy.asnumpy(ret))
|
||||
|
||||
|
||||
def dmatrix_from_cupy(input_type, DMatrixT, missing=np.NAN):
|
||||
'''Test constructing DMatrix from cupy'''
|
||||
|
||||
@@ -8,7 +8,11 @@ from hypothesis import assume, given, note, settings, strategies
|
||||
import xgboost as xgb
|
||||
from xgboost import testing as tm
|
||||
from xgboost.testing.params import cat_parameter_strategy, hist_parameter_strategy
|
||||
from xgboost.testing.updater import check_init_estimation, check_quantile_loss
|
||||
from xgboost.testing.updater import (
|
||||
check_get_quantile_cut,
|
||||
check_init_estimation,
|
||||
check_quantile_loss,
|
||||
)
|
||||
|
||||
sys.path.append("tests/python")
|
||||
import test_updaters as test_up
|
||||
@@ -264,3 +268,7 @@ class TestGPUUpdaters:
|
||||
},
|
||||
num_boost_round=150,
|
||||
)
|
||||
|
||||
@pytest.mark.skipif(**tm.no_cudf())
|
||||
def test_get_quantile_cut(self) -> None:
|
||||
check_get_quantile_cut("gpu_hist")
|
||||
|
||||
Reference in New Issue
Block a user