-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Speed up tests * Prevent DeviceQuantileDMatrix initialisation with numpy * Use joblib.memory * Use RandomState
- Loading branch information
1 parent
cfc23c6
commit 359023c
Showing
5 changed files
with
53 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- coding: utf-8 -*- | ||
import numpy as np | ||
import xgboost as xgb | ||
import unittest | ||
import pytest | ||
import sys | ||
|
||
sys.path.append("tests/python") | ||
import testing as tm | ||
|
||
|
||
class TestDeviceQuantileDMatrix(unittest.TestCase): | ||
def test_dmatrix_numpy_init(self): | ||
data = np.random.randn(5, 5) | ||
with pytest.raises(AssertionError, match='is not supported for DeviceQuantileDMatrix'): | ||
dm = xgb.DeviceQuantileDMatrix(data, np.ones(5, dtype=np.float64)) | ||
|
||
@pytest.mark.skipif(**tm.no_cupy()) | ||
def test_dmatrix_cupy_init(self): | ||
import cupy as cp | ||
data = cp.random.randn(5, 5) | ||
dm = xgb.DeviceQuantileDMatrix(data, cp.ones(5, dtype=np.float64)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters