Add basic unittests for gpu-hist method. (#3785)
* Split building histogram into separated class. * Extract `InitCompressedRow` definition. * Basic tests for gpu-hist. * Document the code more verbosely. * Removed `HistCutUnit`. * Removed some duplicated copies in `GPUHistMaker`. * Implement LCG and use it in tests.
This commit is contained in:
committed by
Rory Mitchell
parent
184efff9f9
commit
516457fadc
@@ -75,7 +75,8 @@ inline void CheckGradientMax(const std::vector<GradientPair>& gpair) {
|
||||
auto* ptr = reinterpret_cast<const float*>(gpair.data());
|
||||
float abs_max =
|
||||
std::accumulate(ptr, ptr + (gpair.size() * 2), 0.f,
|
||||
[=](float a, float b) { return max(abs(a), abs(b)); });
|
||||
[=](float a, float b) {
|
||||
return std::max(abs(a), abs(b)); });
|
||||
|
||||
CHECK_LT(abs_max, std::pow(2.0f, 16.0f))
|
||||
<< "Labels are too large for this algorithm. Rescale to less than 2^16.";
|
||||
@@ -254,6 +255,7 @@ XGBOOST_DEVICE float inline LossChangeMissing(const GradientPairT& scan,
|
||||
const float& parent_gain,
|
||||
const GPUTrainingParam& param,
|
||||
bool& missing_left_out) { // NOLINT
|
||||
// Put gradients of missing values to left
|
||||
float missing_left_loss =
|
||||
DeviceCalcLossChange(param, scan + missing, parent_sum, parent_gain);
|
||||
float missing_right_loss =
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user