Restore clang tidy test. (#8861)
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
/**
|
||||
* Copyright 2019-2023 by XGBoost Contributors
|
||||
*/
|
||||
#include <gtest/gtest.h>
|
||||
#include <xgboost/tree_model.h>
|
||||
#include <xgboost/tree_updater.h>
|
||||
@@ -18,7 +21,7 @@ std::unique_ptr<HostDeviceVector<GradientPair>> GenerateGradients(std::size_t ro
|
||||
xgboost::SimpleLCG gen;
|
||||
xgboost::SimpleRealUniformDistribution<bst_float> dist(0.0f, 1.0f);
|
||||
|
||||
for (auto i = 0; i < rows; ++i) {
|
||||
for (std::size_t i = 0; i < rows; ++i) {
|
||||
auto grad = dist(&gen);
|
||||
auto hess = dist(&gen);
|
||||
h_gradients[i] = GradientPair{grad, hess};
|
||||
|
||||
@@ -19,10 +19,8 @@ TEST(Updater, Prune) {
|
||||
int constexpr kCols = 16;
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> cfg;
|
||||
cfg.emplace_back(std::pair<std::string, std::string>("num_feature",
|
||||
std::to_string(kCols)));
|
||||
cfg.emplace_back(std::pair<std::string, std::string>(
|
||||
"min_split_loss", "10"));
|
||||
cfg.emplace_back("num_feature", std::to_string(kCols));
|
||||
cfg.emplace_back("min_split_loss", "10");
|
||||
|
||||
// These data are just place holders.
|
||||
HostDeviceVector<GradientPair> gpair =
|
||||
@@ -73,7 +71,7 @@ TEST(Updater, Prune) {
|
||||
0, 0.5f, true, 0.3, 0.4, 0.5,
|
||||
/*loss_chg=*/19.0f, 0.0f,
|
||||
/*left_sum=*/0.0f, /*right_sum=*/0.0f);
|
||||
cfg.emplace_back(std::make_pair("max_depth", "1"));
|
||||
cfg.emplace_back("max_depth", "1");
|
||||
pruner->Configure(cfg);
|
||||
pruner->Update(&gpair, p_dmat.get(), position, trees);
|
||||
|
||||
@@ -83,7 +81,7 @@ TEST(Updater, Prune) {
|
||||
0, 0.5f, true, 0.3, 0.4, 0.5,
|
||||
/*loss_chg=*/18.0f, 0.0f,
|
||||
/*left_sum=*/0.0f, /*right_sum=*/0.0f);
|
||||
cfg.emplace_back(std::make_pair("min_split_loss", "0"));
|
||||
cfg.emplace_back("min_split_loss", "0");
|
||||
pruner->Configure(cfg);
|
||||
pruner->Update(&gpair, p_dmat.get(), position, trees);
|
||||
ASSERT_EQ(tree.NumExtraNodes(), 2);
|
||||
|
||||
Reference in New Issue
Block a user