Added finding quantiles on GPU. (#3393)
* Added finding quantiles on GPU.
- this includes datasets where weights are assigned to data rows
- as the quantiles found by the new algorithm are not the same
as those found by the old one, test thresholds in
tests/python-gpu/test_gpu_updaters.py have been adjusted.
* Adjustments and improved testing for finding quantiles on the GPU.
- added C++ tests for the DeviceSketch() function
- reduced one of the thresholds in test_gpu_updaters.py
- adjusted the cuts found by the find_cuts_k kernel
This commit is contained in:
committed by
Rory Mitchell
parent
e2f09db77a
commit
cc6a5a3666
@@ -7,12 +7,26 @@ import unittest
|
||||
|
||||
|
||||
class TestGPULinear(unittest.TestCase):
|
||||
|
||||
datasets = ["Boston", "Digits", "Cancer", "Sparse regression",
|
||||
"Boston External Memory"]
|
||||
|
||||
def test_gpu_coordinate(self):
|
||||
tm._skip_if_no_sklearn()
|
||||
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]}
|
||||
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):
|
||||
results = test_linear.run_suite(param, 200, None, scale_features=True)
|
||||
results = test_linear.run_suite(
|
||||
param, 200, self.datasets, scale_features=True)
|
||||
test_linear.assert_regression_result(results, 1e-2)
|
||||
test_linear.assert_classification_result(results)
|
||||
|
||||
@@ -11,11 +11,10 @@ from regression_test_utilities import run_suite, parameter_combinations, \
|
||||
def assert_gpu_results(cpu_results, gpu_results):
|
||||
for cpu_res, gpu_res in zip(cpu_results, gpu_results):
|
||||
# Check final eval result roughly equivalent
|
||||
assert np.allclose(cpu_res["eval"][-1], gpu_res["eval"][-1], 1e-3, 1e-2)
|
||||
|
||||
|
||||
datasets = ["Boston", "Cancer", "Digits", "Sparse regression"]
|
||||
assert np.allclose(cpu_res["eval"][-1], gpu_res["eval"][-1], 1e-2, 1e-2)
|
||||
|
||||
datasets = ["Boston", "Cancer", "Digits", "Sparse regression",
|
||||
"Sparse regression with weights"]
|
||||
|
||||
class TestGPU(unittest.TestCase):
|
||||
def test_gpu_exact(self):
|
||||
|
||||
Reference in New Issue
Block a user