Check that sampling mask was correctly applied from split gradient to value gradient.
| 36 | |
| 37 | // Check that sampling mask was correctly applied from split gradient to value gradient. |
| 38 | inline void CheckSamplingMask(linalg::MatrixView<GradientPair> h_split, |
| 39 | linalg::MatrixView<GradientPair> h_value, float subsample) { |
| 40 | auto n_samples = h_value.Shape(0); |
| 41 | std::size_t sampled_count = CheckSampledRows(h_split, h_value); |
| 42 | // Verify approximately the right fraction of rows are sampled |
| 43 | double sampled_fraction = static_cast<double>(sampled_count) / static_cast<double>(n_samples); |
| 44 | ASSERT_NEAR(sampled_fraction, subsample, 0.05); |
| 45 | } |
| 46 | |
| 47 | inline void CheckSampling(float subsample, bst_target_t n_targets, bool check_sum, |
| 48 | std::vector<GradientPairPrecise> const& sum_sampled_gpair, |
no test coverage detected