Move Python testing utilities into xgboost module. (#8379)
- Add typehints. - Fixes for pylint. Co-authored-by: Hyunsu Philip Cho <chohyu01@cs.washington.edu>
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
from typing import Union
|
||||
import xgboost as xgb
|
||||
import pytest
|
||||
import os
|
||||
import testing as tm
|
||||
import tempfile
|
||||
from contextlib import nullcontext
|
||||
from typing import Union
|
||||
|
||||
import pytest
|
||||
|
||||
import xgboost as xgb
|
||||
from xgboost import testing as tm
|
||||
|
||||
# We use the dataset for tests.
|
||||
pytestmark = pytest.mark.skipif(**tm.no_sklearn())
|
||||
@@ -271,13 +274,14 @@ class TestCallbacks:
|
||||
"""Test learning rate scheduler, used by both CPU and GPU tests."""
|
||||
scheduler = xgb.callback.LearningRateScheduler
|
||||
|
||||
dpath = os.path.join(tm.PROJECT_ROOT, 'demo/data/')
|
||||
dtrain = xgb.DMatrix(dpath + 'agaricus.txt.train')
|
||||
dtest = xgb.DMatrix(dpath + 'agaricus.txt.test')
|
||||
dpath = tm.data_dir(__file__)
|
||||
dtrain = xgb.DMatrix(os.path.join(dpath, "agaricus.txt.train"))
|
||||
dtest = xgb.DMatrix(os.path.join(dpath, "agaricus.txt.test"))
|
||||
|
||||
watchlist = [(dtest, 'eval'), (dtrain, 'train')]
|
||||
num_round = 4
|
||||
|
||||
warning_check = tm.noop_context()
|
||||
warning_check = nullcontext()
|
||||
|
||||
# learning_rates as a list
|
||||
# init eta with 0 to check whether learning_rates work
|
||||
|
||||
Reference in New Issue
Block a user