MCPcopy Create free account
hub / github.com/dmlc/xgboost / CheckSamplingMask

Function CheckSamplingMask

tests/cpp/tree/test_sampler.h:38–45  ·  view source on GitHub ↗

Check that sampling mask was correctly applied from split gradient to value gradient.

Source from the content-addressed store, hash-verified

36
37// Check that sampling mask was correctly applied from split gradient to value gradient.
38inline 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
47inline void CheckSampling(float subsample, bst_target_t n_targets, bool check_sum,
48 std::vector<GradientPairPrecise> const& sum_sampled_gpair,

Callers 1

TESTFunction · 0.85

Calls 2

CheckSampledRowsFunction · 0.85
ShapeMethod · 0.80

Tested by

no test coverage detected