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:
parent
c8c472f39a
commit
cecbe0cf71
@ -49,7 +49,7 @@ install:
|
|||||||
- ps: |
|
- ps: |
|
||||||
if($env:target -eq 'rmingw' -or $env:target -eq 'rmsvc') {
|
if($env:target -eq 'rmingw' -or $env:target -eq 'rmsvc') {
|
||||||
#$ErrorActionPreference = "Stop"
|
#$ErrorActionPreference = "Stop"
|
||||||
Invoke-WebRequest http://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "$Env:TEMP\appveyor-tool.ps1"
|
Invoke-WebRequest https://raw.githubusercontent.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "$Env:TEMP\appveyor-tool.ps1"
|
||||||
Import-Module "$Env:TEMP\appveyor-tool.ps1"
|
Import-Module "$Env:TEMP\appveyor-tool.ps1"
|
||||||
Bootstrap
|
Bootstrap
|
||||||
$DEPS = "c('data.table','magrittr','stringi','ggplot2','DiagrammeR','Ckmeans.1d.dp','vcd','testthat','lintr','knitr','rmarkdown')"
|
$DEPS = "c('data.table','magrittr','stringi','ggplot2','DiagrammeR','Ckmeans.1d.dp','vcd','testthat','lintr','knitr','rmarkdown')"
|
||||||
|
|||||||
@ -3,31 +3,41 @@ import pytest
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
sys.path.append('tests/python/')
|
sys.path.append('tests/python/')
|
||||||
import test_linear
|
import test_linear # noqa: E402
|
||||||
import testing as tm
|
import testing as tm # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
class TestGPULinear(unittest.TestCase):
|
class TestGPULinear(unittest.TestCase):
|
||||||
|
|
||||||
datasets = ["Boston", "Digits", "Cancer", "Sparse regression",
|
datasets = ["Boston", "Digits", "Cancer", "Sparse regression"]
|
||||||
"Boston External Memory"]
|
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())
|
@pytest.mark.skipif(**tm.no_sklearn())
|
||||||
def test_gpu_coordinate(self):
|
def test_gpu_coordinate(self):
|
||||||
variable_param = {
|
parameters = self.common_param.copy()
|
||||||
'booster': ['gblinear'],
|
parameters['n_gpus'] = [1]
|
||||||
'updater': ['coord_descent'],
|
for param in test_linear.parameter_combinations(parameters):
|
||||||
'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(
|
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_regression_result(results, 1e-2)
|
||||||
test_linear.assert_classification_result(results)
|
test_linear.assert_classification_result(results)
|
||||||
|
|||||||
@ -72,7 +72,7 @@ class TestLinear(unittest.TestCase):
|
|||||||
'feature_selector': ['cyclic', 'shuffle',
|
'feature_selector': ['cyclic', 'shuffle',
|
||||||
'greedy', 'thrifty']}
|
'greedy', 'thrifty']}
|
||||||
for param in parameter_combinations(variable_param):
|
for param in parameter_combinations(variable_param):
|
||||||
results = run_suite(param, 200, self.datasets, scale_features=True)
|
results = run_suite(param, 150, self.datasets, scale_features=True)
|
||||||
assert_regression_result(results, 1e-2)
|
assert_regression_result(results, 1e-2)
|
||||||
assert_classification_result(results)
|
assert_classification_result(results)
|
||||||
|
|
||||||
|
|||||||
@ -94,7 +94,7 @@ if [ ${TASK} == "r_test" ]; then
|
|||||||
sudo ln -s /usr/local/lib/gcc/7 /usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0
|
sudo ln -s /usr/local/lib/gcc/7 /usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl -OL http://raw.github.com/craigcitro/r-travis/master/scripts/travis-tool.sh
|
curl -OL https://raw.githubusercontent.com/craigcitro/r-travis/master/scripts/travis-tool.sh
|
||||||
chmod 755 ./travis-tool.sh
|
chmod 755 ./travis-tool.sh
|
||||||
./travis-tool.sh bootstrap
|
./travis-tool.sh bootstrap
|
||||||
make Rpack
|
make Rpack
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user