[MT] Implement interaction constraints.#12294
Conversation
There was a problem hiding this comment.
Pull request overview
Implements support for interaction constraints when training multi-target (“vector leaf”) models, and extends the Python test suite to exercise this behavior for both CPU and GPU hist updaters.
Changes:
- Enables interaction constraints for multi-target training by removing prior
LOG(FATAL)guards in CPU quantile-hist and GPU hist updaters. - Updates multi-target split application to propagate per-node interaction-constraint state during tree growth (CPU and GPU).
- Adds CPU/GPU Python tests and enhances the shared test helper to generate deterministic multi-target labels and validate output shapes.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/python/test_interaction_constraints.py | Adds a CPU hist multi-target test case to validate interaction constraints. |
| tests/python-gpu/test_gpu_interaction_constraints.py | Adds a GPU hist multi-target test case to validate interaction constraints. |
| src/tree/updater_quantile_hist.cc | Removes the multi-target “not implemented” fatal for interaction constraints so MT training can proceed. |
| src/tree/updater_gpu_hist.cuh | Resets and updates interaction-constraint state for multi-target GPU hist growth; removes the prior fatal guard. |
| src/tree/hist/evaluate_splits.h | Propagates interaction-constraint state when applying multi-target splits on CPU hist. |
| python-package/xgboost/testing/interaction_constraints.py | Extends the test helper to support multi-target labels and deterministic data generation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
RAMitchell
left a comment
There was a problem hiding this comment.
Looks straightforward. Is there only one test for interaction constraints? Seems a bit light.
| "device": device, | ||
| } | ||
| if n_targets > 1: | ||
| params["multi_strategy"] = "multi_output_tree" |
There was a problem hiding this comment.
Do we also still test the old path?
There was a problem hiding this comment.
The old path is just scalar tree, not much to test as trees don't share the structure.
We have some C++ tests for the constraint itself, the Python test does the integration test. |
ref: #9043