Example #1
0
    def test_fast_histmaker(self):
        variable_param = {'tree_method': ['hist'],
                          'max_depth': [2, 8],
                          'max_bin': [2, 256],
                          'grow_policy': ['depthwise', 'lossguide'],
                          'max_leaves': [64, 0],
                          'verbosity': [0]}
        for param in parameter_combinations(variable_param):
            result = run_suite(param)
            assert_results_non_increasing(result, 1e-2)

        # hist must be same as exact on all-categorial data
        dpath = 'demo/data/'
        ag_dtrain = xgb.DMatrix(dpath + 'agaricus.txt.train')
        ag_dtest = xgb.DMatrix(dpath + 'agaricus.txt.test')
        ag_param = {'max_depth': 2,
                    'tree_method': 'hist',
                    'eta': 1,
                    'verbosity': 0,
                    'objective': 'binary:logistic',
                    'eval_metric': 'auc'}
        hist_res = {}
        exact_res = {}

        xgb.train(ag_param, ag_dtrain, 10,
                  [(ag_dtrain, 'train'), (ag_dtest, 'test')],
                  evals_result=hist_res)
        ag_param["tree_method"] = "exact"
        xgb.train(ag_param, ag_dtrain, 10,
                  [(ag_dtrain, 'train'), (ag_dtest, 'test')],
                  evals_result=exact_res)
        assert hist_res['train']['auc'] == exact_res['train']['auc']
        assert hist_res['test']['auc'] == exact_res['test']['auc']
Example #2
0
    def test_fast_histmaker(self):
        variable_param = {'tree_method': ['hist'],
                          'max_depth': [2, 8],
                          'max_bin': [2, 256],
                          'grow_policy': ['depthwise', 'lossguide'],
                          'max_leaves': [64, 0],
                          'verbosity': [0]}
        for param in parameter_combinations(variable_param):
            result = run_suite(param)
            assert_results_non_increasing(result, 1e-2)

        # hist must be same as exact on all-categorial data
        dpath = HOME_DIR + 'demo/data/'
        ag_dtrain = xgb.DMatrix({username: dpath + 'agaricus.txt.train.enc'})
        ag_dtest = xgb.DMatrix({username: dpath + 'agaricus.txt.test.enc'})
        ag_param = {'max_depth': 2,
                    'tree_method': 'hist',
                    'eta': 1,
                    'verbosity': 0,
                    'objective': 'binary:logistic',
                    'eval_metric': 'auc'}
        hist_res = {}
        exact_res = {}

        #TODO(rishabh): support for evals_result
        """
Example #3
0
 def test_gpu_hist(self):
     for param in test_param:
         param['tree_method'] = 'gpu_hist'
         gpu_results = run_suite(param, select_datasets=datasets)
         assert_results_non_increasing(gpu_results, 1e-2)
         param['tree_method'] = 'hist'
         cpu_results = run_suite(param, select_datasets=datasets)
         assert_gpu_results(cpu_results, gpu_results)
Example #4
0
 def test_gpu_hist_mgpu(self):
     variable_param = {'n_gpus': [-1], 'max_depth': [2, 10],
                       'max_leaves': [255, 4],
                       'max_bin': [2, 256],
                       'grow_policy': ['lossguide']}
     for param in parameter_combinations(variable_param):
         param['tree_method'] = 'gpu_hist'
         gpu_results = run_suite(param, select_datasets=datasets)
         assert_results_non_increasing(gpu_results, 1e-2)
Example #5
0
 def test_gpu_exact(self):
     variable_param = {'max_depth': [2, 6, 15], }
     for param in parameter_combinations(variable_param):
         param['tree_method'] = 'gpu_exact'
         gpu_results = run_suite(param, select_datasets=datasets)
         assert_results_non_increasing(gpu_results, 1e-2)
         param['tree_method'] = 'exact'
         cpu_results = run_suite(param, select_datasets=datasets)
         assert_gpu_results(cpu_results, gpu_results)
Example #6
0
 def test_gpu_hist_mgpu(self):
     variable_param = {'n_gpus': [-1], 'max_depth': [2, 10],
                       'max_leaves': [255, 4],
                       'max_bin': [2, 256],
                       'grow_policy': ['lossguide']}
     for param in parameter_combinations(variable_param):
         param['tree_method'] = 'gpu_hist'
         gpu_results = run_suite(param, select_datasets=datasets)
         assert_results_non_increasing(gpu_results, 1e-2)
Example #7
0
 def test_specified_gpu_id_gpu_update(self):
     variable_param = {'gpu_id': [1],
                       'max_depth': [8],
                       'max_leaves': [255, 4],
                       'max_bin': [2, 64],
                       'grow_policy': ['lossguide'],
                       'tree_method': ['gpu_hist']}
     for param in parameter_combinations(variable_param):
         gpu_results = run_suite(param, select_datasets=datasets)
         assert_results_non_increasing(gpu_results, 1e-2)
Example #8
0
 def test_external_memory(self):
     for param in reversed(test_param):
         param['tree_method'] = 'gpu_hist'
         param['gpu_page_size'] = 1024
         gpu_results = run_suite(param, select_datasets=["Boston"])
         assert_results_non_increasing(gpu_results, 1e-2)
         ext_mem_results = run_suite(param, select_datasets=["Boston External Memory"])
         assert_results_non_increasing(ext_mem_results, 1e-2)
         assert_gpu_results(gpu_results, ext_mem_results)
         break
Example #9
0
 def test_specified_gpu_id_gpu_update(self):
     variable_param = {'n_gpus': [1],
                       'gpu_id': [1],
                       'max_depth': [8],
                       'max_leaves': [255, 4],
                       'max_bin': [2, 64],
                       'grow_policy': ['lossguide'],
                       'tree_method': ['gpu_hist', 'gpu_exact']}
     for param in parameter_combinations(variable_param):
         gpu_results = run_suite(param, select_datasets=datasets)
         assert_results_non_increasing(gpu_results, 1e-2)
Example #10
0
 def test_gpu_hist(self):
     variable_param = {'n_gpus': [-1], 'max_depth': [2, 8],
                       'max_leaves': [255, 4],
                       'max_bin': [2, 256], 'min_child_weight': [0, 1],
                       'lambda': [0.0, 1.0],
                       'grow_policy': ['lossguide']}
     for param in parameter_combinations(variable_param):
         param['tree_method'] = 'gpu_hist'
         gpu_results = run_suite(param, select_datasets=datasets)
         assert_results_non_increasing(gpu_results, 1e-2)
         param['tree_method'] = 'hist'
         cpu_results = run_suite(param, select_datasets=datasets)
         assert_gpu_results(cpu_results, gpu_results)
Example #11
0
 def test_gpu_hist(self):
     test_param = parameter_combinations({'n_gpus': [1], 'max_depth': [2, 8],
                                          'max_leaves': [255, 4],
                                          'max_bin': [2, 256],
                                          'grow_policy': ['lossguide']})
     test_param.append({'single_precision_histogram': True})
     test_param.append({'min_child_weight': 0,
                        'lambda': 0})
     for param in test_param:
         param['tree_method'] = 'gpu_hist'
         gpu_results = run_suite(param, select_datasets=datasets)
         assert_results_non_increasing(gpu_results, 1e-2)
         param['tree_method'] = 'hist'
         cpu_results = run_suite(param, select_datasets=datasets)
         assert_gpu_results(cpu_results, gpu_results)
Example #12
0
 def test_gpu_hist(self):
     test_param = parameter_combinations({'n_gpus': [1], 'max_depth': [2, 8],
                                          'max_leaves': [255, 4],
                                          'max_bin': [2, 256],
                                          'grow_policy': ['lossguide']})
     test_param.append({'single_precision_histogram': True})
     test_param.append({'min_child_weight': 0,
                        'lambda': 0})
     for param in test_param:
         param['tree_method'] = 'gpu_hist'
         gpu_results = run_suite(param, select_datasets=datasets)
         assert_results_non_increasing(gpu_results, 1e-2)
         param['tree_method'] = 'hist'
         cpu_results = run_suite(param, select_datasets=datasets)
         assert_gpu_results(cpu_results, gpu_results)
Example #13
0
 def test_colmaker(self):
     variable_param = {'updater': ['grow_colmaker'], 'max_depth': [2, 8]}
     for param in parameter_combinations(variable_param):
         result = run_suite(param)
         assert_results_non_increasing(result, 1e-2)
Example #14
0
 def test_colmaker(self):
     variable_param = {'updater': ['grow_colmaker'], 'max_depth': [2, 8]}
     for param in parameter_combinations(variable_param):
         result = run_suite(param)
         assert_results_non_increasing(result, 1e-2)
 def test_histmaker(self):
     tm._skip_if_no_sklearn()
     variable_param = {'updater': ['grow_histmaker'], 'max_depth': [2, 8]}
     for param in parameter_combinations(variable_param):
         result = run_suite(param)
         assert_results_non_increasing(result, 1e-2)
Example #16
0
 def test_histmaker(self):
     tm._skip_if_no_sklearn()
     variable_param = {'updater': ['grow_histmaker'], 'max_depth': [2, 8]}
     for param in parameter_combinations(variable_param):
         result = run_suite(param)
         assert_results_non_increasing(result, 1e-2)