Fix test_gpu_coordinate. (#3974)
* Fix test_gpu_coordinate. * Use `gpu_coord_descent` in test. * Reduce number of running rounds. * Remove nthread. * Use githubusercontent for r-appveyor. * Use githubusercontent in travis r tests.
This commit is contained in:
committed by
Philip Hyunsu Cho
parent
c8c472f39a
commit
cecbe0cf71
@@ -3,31 +3,41 @@ import pytest
|
||||
import unittest
|
||||
|
||||
sys.path.append('tests/python/')
|
||||
import test_linear
|
||||
import testing as tm
|
||||
import test_linear # noqa: E402
|
||||
import testing as tm # noqa: E402
|
||||
|
||||
|
||||
class TestGPULinear(unittest.TestCase):
|
||||
|
||||
datasets = ["Boston", "Digits", "Cancer", "Sparse regression",
|
||||
"Boston External Memory"]
|
||||
datasets = ["Boston", "Digits", "Cancer", "Sparse regression"]
|
||||
common_param = {
|
||||
'booster': ['gblinear'],
|
||||
'updater': ['gpu_coord_descent'],
|
||||
'eta': [0.5],
|
||||
'top_k': [10],
|
||||
'tolerance': [1e-5],
|
||||
'alpha': [.005, .1],
|
||||
'lambda': [0.005],
|
||||
'coordinate_selection': ['cyclic', 'random', 'greedy']}
|
||||
|
||||
@pytest.mark.skipif(**tm.no_sklearn())
|
||||
def test_gpu_coordinate(self):
|
||||
variable_param = {
|
||||
'booster': ['gblinear'],
|
||||
'updater': ['coord_descent'],
|
||||
'eta': [0.5],
|
||||
'top_k': [10],
|
||||
'tolerance': [1e-5],
|
||||
'nthread': [2],
|
||||
'alpha': [.005, .1],
|
||||
'lambda': [0.005],
|
||||
'coordinate_selection': ['cyclic', 'random', 'greedy'],
|
||||
'n_gpus': [-1]
|
||||
}
|
||||
for param in test_linear.parameter_combinations(variable_param):
|
||||
parameters = self.common_param.copy()
|
||||
parameters['n_gpus'] = [1]
|
||||
for param in test_linear.parameter_combinations(parameters):
|
||||
results = test_linear.run_suite(
|
||||
param, 200, self.datasets, scale_features=True)
|
||||
param, 150, self.datasets, scale_features=True)
|
||||
test_linear.assert_regression_result(results, 1e-2)
|
||||
test_linear.assert_classification_result(results)
|
||||
|
||||
@pytest.mark.mgpu
|
||||
@pytest.mark.skipif(**tm.no_sklearn())
|
||||
def test_gpu_coordinate_mgpu(self):
|
||||
parameters = self.common_param.copy()
|
||||
parameters['n_gpus'] = [-1]
|
||||
parameters['gpu_id'] = [1]
|
||||
for param in test_linear.parameter_combinations(parameters):
|
||||
results = test_linear.run_suite(
|
||||
param, 150, self.datasets, scale_features=True)
|
||||
test_linear.assert_regression_result(results, 1e-2)
|
||||
test_linear.assert_classification_result(results)
|
||||
|
||||
Reference in New Issue
Block a user