Remove all use of DeviceQuantileDMatrix. (#8665)
This commit is contained in:
@@ -11,7 +11,7 @@ sys.path.append("tests/python")
|
||||
import test_quantile_dmatrix as tqd
|
||||
|
||||
|
||||
class TestDeviceQuantileDMatrix:
|
||||
class TestQuantileDMatrix:
|
||||
cputest = tqd.TestQuantileDMatrix()
|
||||
|
||||
@pytest.mark.skipif(**tm.no_cupy())
|
||||
@@ -32,7 +32,7 @@ class TestDeviceQuantileDMatrix:
|
||||
def test_dmatrix_cupy_init(self) -> None:
|
||||
import cupy as cp
|
||||
data = cp.random.randn(5, 5)
|
||||
xgb.DeviceQuantileDMatrix(data, cp.ones(5, dtype=np.float64))
|
||||
xgb.QuantileDMatrix(data, cp.ones(5, dtype=np.float64))
|
||||
|
||||
@pytest.mark.skipif(**tm.no_cupy())
|
||||
@pytest.mark.parametrize(
|
||||
@@ -85,7 +85,7 @@ class TestDeviceQuantileDMatrix:
|
||||
fw = rng.randn(rows)
|
||||
fw -= fw.min()
|
||||
|
||||
m = xgb.DeviceQuantileDMatrix(data=data, label=labels, feature_weights=fw)
|
||||
m = xgb.QuantileDMatrix(data=data, label=labels, feature_weights=fw)
|
||||
|
||||
got_fw = m.get_float_info("feature_weights")
|
||||
got_labels = m.get_label()
|
||||
|
||||
@@ -160,7 +160,7 @@ Arrow specification.'''
|
||||
|
||||
@pytest.mark.skipif(**tm.no_cudf())
|
||||
def test_device_dmatrix_from_cudf(self):
|
||||
_test_from_cudf(xgb.DeviceQuantileDMatrix)
|
||||
_test_from_cudf(xgb.QuantileDMatrix)
|
||||
|
||||
@pytest.mark.skipif(**tm.no_cudf())
|
||||
def test_cudf_training_simple_dmatrix(self):
|
||||
@@ -168,7 +168,7 @@ Arrow specification.'''
|
||||
|
||||
@pytest.mark.skipif(**tm.no_cudf())
|
||||
def test_cudf_training_device_dmatrix(self):
|
||||
_test_cudf_training(xgb.DeviceQuantileDMatrix)
|
||||
_test_cudf_training(xgb.QuantileDMatrix)
|
||||
|
||||
@pytest.mark.skipif(**tm.no_cudf())
|
||||
def test_cudf_metainfo_simple_dmatrix(self):
|
||||
@@ -176,7 +176,7 @@ Arrow specification.'''
|
||||
|
||||
@pytest.mark.skipif(**tm.no_cudf())
|
||||
def test_cudf_metainfo_device_dmatrix(self):
|
||||
_test_cudf_metainfo(xgb.DeviceQuantileDMatrix)
|
||||
_test_cudf_metainfo(xgb.QuantileDMatrix)
|
||||
|
||||
@pytest.mark.skipif(**tm.no_cudf())
|
||||
def test_cudf_categorical(self) -> None:
|
||||
@@ -191,7 +191,7 @@ Arrow specification.'''
|
||||
assert len(Xy.feature_types) == X.shape[1]
|
||||
assert all(t == "c" for t in Xy.feature_types)
|
||||
|
||||
Xy = xgb.DeviceQuantileDMatrix(X, y, enable_categorical=True)
|
||||
Xy = xgb.QuantileDMatrix(X, y, enable_categorical=True)
|
||||
assert Xy.feature_types is not None
|
||||
assert len(Xy.feature_types) == X.shape[1]
|
||||
assert all(t == "c" for t in Xy.feature_types)
|
||||
@@ -228,9 +228,9 @@ Arrow specification.'''
|
||||
assert Xy.num_col() == 1
|
||||
|
||||
with pytest.raises(ValueError, match="enable_categorical"):
|
||||
xgb.DeviceQuantileDMatrix(X, y)
|
||||
xgb.QuantileDMatrix(X, y)
|
||||
|
||||
Xy = xgb.DeviceQuantileDMatrix(X, y, enable_categorical=True)
|
||||
Xy = xgb.QuantileDMatrix(X, y, enable_categorical=True)
|
||||
assert Xy.num_row() == 3
|
||||
assert Xy.num_col() == 1
|
||||
|
||||
@@ -344,7 +344,7 @@ def test_from_cudf_iter(enable_categorical):
|
||||
params = {"tree_method": "gpu_hist"}
|
||||
|
||||
# Use iterator
|
||||
m_it = xgb.DeviceQuantileDMatrix(it, enable_categorical=enable_categorical)
|
||||
m_it = xgb.QuantileDMatrix(it, enable_categorical=enable_categorical)
|
||||
reg_with_it = xgb.train(params, m_it, num_boost_round=rounds)
|
||||
|
||||
X = it.as_array()
|
||||
|
||||
@@ -27,8 +27,8 @@ def dmatrix_from_cupy(input_type, DMatrixT, missing=np.NAN):
|
||||
assert dtrain.num_col() == kCols
|
||||
assert dtrain.num_row() == kRows
|
||||
|
||||
if DMatrixT is xgb.DeviceQuantileDMatrix:
|
||||
# Slice is not supported by DeviceQuantileDMatrix
|
||||
if DMatrixT is xgb.QuantileDMatrix:
|
||||
# Slice is not supported by QuantileDMatrix
|
||||
with pytest.raises(xgb.core.XGBoostError):
|
||||
dtrain.slice(rindex=[0, 1, 2])
|
||||
dtrain.slice(rindex=[0, 1, 2])
|
||||
@@ -153,11 +153,11 @@ Arrow specification.'''
|
||||
|
||||
@pytest.mark.skipif(**tm.no_cupy())
|
||||
def test_device_dmat_from_cupy(self):
|
||||
_test_from_cupy(xgb.DeviceQuantileDMatrix)
|
||||
_test_from_cupy(xgb.QuantileDMatrix)
|
||||
|
||||
@pytest.mark.skipif(**tm.no_cupy())
|
||||
def test_cupy_training_device_dmat(self):
|
||||
_test_cupy_training(xgb.DeviceQuantileDMatrix)
|
||||
_test_cupy_training(xgb.QuantileDMatrix)
|
||||
|
||||
@pytest.mark.skipif(**tm.no_cupy())
|
||||
def test_cupy_training_simple_dmat(self):
|
||||
@@ -169,7 +169,7 @@ Arrow specification.'''
|
||||
|
||||
@pytest.mark.skipif(**tm.no_cupy())
|
||||
def test_cupy_metainfo_device_dmat(self):
|
||||
_test_cupy_metainfo(xgb.DeviceQuantileDMatrix)
|
||||
_test_cupy_metainfo(xgb.QuantileDMatrix)
|
||||
|
||||
@pytest.mark.skipif(**tm.no_cupy())
|
||||
def test_dlpack_simple_dmat(self):
|
||||
@@ -196,7 +196,7 @@ Arrow specification.'''
|
||||
import cupy as cp
|
||||
n = 100
|
||||
X = cp.random.random((n, 2))
|
||||
m = xgb.DeviceQuantileDMatrix(X.toDlpack())
|
||||
m = xgb.QuantileDMatrix(X.toDlpack())
|
||||
with pytest.raises(xgb.core.XGBoostError):
|
||||
m.slice(rindex=[0, 1, 2])
|
||||
|
||||
@@ -222,7 +222,7 @@ Arrow specification.'''
|
||||
import cupy as cp
|
||||
cp.cuda.runtime.setDevice(0)
|
||||
dtrain = dmatrix_from_cupy(
|
||||
np.float32, xgb.DeviceQuantileDMatrix, np.nan)
|
||||
np.float32, xgb.QuantileDMatrix, np.nan)
|
||||
with pytest.raises(xgb.core.XGBoostError):
|
||||
xgb.train(
|
||||
{'tree_method': 'gpu_hist', 'gpu_id': 1}, dtrain, num_boost_round=10
|
||||
|
||||
@@ -17,7 +17,7 @@ def test_large_input():
|
||||
assert (np.log2(m * n) > 31)
|
||||
X = cp.ones((m, n), dtype=np.float32)
|
||||
y = cp.ones(m)
|
||||
dmat = xgb.DeviceQuantileDMatrix(X, y)
|
||||
dmat = xgb.QuantileDMatrix(X, y)
|
||||
booster = xgb.train({"tree_method": "gpu_hist", "max_depth": 1}, dmat, 1)
|
||||
del y
|
||||
booster.inplace_predict(X)
|
||||
|
||||
Reference in New Issue
Block a user