test(df): require the same forest from two fits with the same seed #3937
Please check also for binary and regression, make the example as small as possible, and make it more prone to mathematical divergences (e.g. duplicated columns, highly correlated, etc.).
This is an example with very poor predictability. Please create data with a strong pattern.
question: a same-seed test whose input depends on the standard library's distribution
cpp/oneapi/dal/algo/decision_forest/test/fixture.hpp:374 (check_same_seed_same_forest): the grid values are drawn with std::uniform_int_distribution, whose algorithm the standard leaves implementation-defined. libstdc++, libc++ and MSVC can produce different data from the same seed, so a same-seed failure seen on one platform may not reproduce on another, which weakens the reproducibility purpose of the test.
How to check: not run (read only; provenance introduced (read)).
Expected: a reproducibility test whose input is identical on every platform, since its purpose is to reproduce a report.
Fix: map the raw rng() output to the grid directly (for example rng() % 17 - 8), so the input does not depend on the library's distribution.
question: the comment says the features repeat the response, but no column equals it
cpp/oneapi/dal/algo/decision_forest/test/fixture.hpp:359 (check_same_seed_same_forest): the response is s = u + 0.5 * v, and no column equals s. Columns 0-3 repeat or scale u and column 5 is v. The comment's "the features repeat it" misdescribes the data that is meant to induce ties.
How to check: not run (read only; provenance introduced (read)).
Expected: the comment describes the data: the features repeat u and v, and the response mixes them.
Fix: reword the comment to match the data.
Verdict: comment only, no blocking finding. Head 245afbe8e, merge base ed085192b. This is a draft and test-only PR. Not built or run here; the findings come from reading the head tree.
CI on head: one failing job, Enforce Labels (no label on the PR). It has no base run to compare with; it is a metadata check, not a code result.
Findings (threads are inline): 2 questions, both about the test fixture (the standard-library distribution used for the grid, and a comment that misdescribes the data).
Raised before:
Coverage: checked the diff against the head tree, CI verdicts and prior threads. Not looked at: the built test binary, GPU behaviour. The PR's fixture.hpp is also changed by #3911, #3910 and #3889 in the same decision-forest test batch; nothing in this review is rooted in those sibling PRs.
Added in 245afbe8e: binary and 3-class classification and regression, each with the best and random splitters. The features are exact, scaled, mirrored and near duplicates of one grid value, so split gains and thresholds tie. The data is 64 rows x 6 columns with 8 trees; if you want a specific smaller size, I can cut it.
Fixed in 245afbe8e: the response is now a function of the features (u + 0.5 * v, bucketed into classes for classification), with no noise.
Fixed in bbf689805: the grid is now rng() % 17 - 8 on the raw std::mt19937 output, which the standard fixes, so the data is the same with every standard library.
Fixed in bbf689805: the comment now says the response is a pattern of u and v, the features repeat u and add v.
david-cortes-intel
Alexandr-Solovev
Description
Adds a oneAPI decision forest test that fits the same data twice with the same seed and requires bitwise-identical trees (feature index, threshold, leaf response and sample count of every node) and inference responses. It covers classification and regression, the best and random splitters, and float and double.
This came out of the reproducibility report in uxlfoundation/scikit-learn-intelex#1916. The DF suite has no same-seed check: the existing engine tests only require different streams to give different forests.
On CPU the test passes on
mainwithout any change. The trees depend only on the seed and the tree index, since every tree gets its own engine before the parallel loop. So the test is a regression guard there: it passed on all host CPUs and with the test pinned to 1 CPU. Its main value is the DPC++ run on GPU, where the histogram kernels accumulate with floating-point atomics and near-tie splits could differ between runs. If it fails there, the fix goes in a follow-up PR.The OOB results and variable importance are not compared: on CPU they currently depend on the merge order of the thread-local buffers, which #3911 fixes and tests.
Tests:
bazel test --config=host //cpp/oneapi/dal/algo/decision_forest:test_batch_host(8 new cases). The DPC++ cases need a GPU run.No public API or ABI changes.
---
<details>
<summary>Checklist:</summary>
Completeness and readability
Testing
Performance
</details>
🤖 Generated with Claude Code