test(loss_functions): add XGBoost 3.2 2D input regression tests#867
Merged
egordm merged 3 commits intoMay 5, 2026
Merged
Conversation
aa7a3a0 to
e56b8ec
Compare
186a713 to
694fdf9
Compare
bartpleiter
previously approved these changes
May 5, 2026
Collaborator
bartpleiter
left a comment
There was a problem hiding this comment.
Looks good to me, but please look at the sonar output
Adds regression tests verifying both arctan_loss_multi_objective and pinball_loss_multi_objective accept 2D (n_samples, n_quantiles) inputs as passed by XGBoost 3.2, producing identical results to the flat 1D arrays used in older versions. Tests intentionally FAIL on the unfixed code and PASS after PR #866 is merged into release/v4.0.0. Closes #865 (once #866 is merged and these pass) Signed-off-by: Egor Dmitriev <egor.dmitriev@alliander.com> Signed-off-by: Egor Dmitriev <egor.dmitriev@alliander.com> Signed-off-by: Egor Dmitriev <egor.dmitriev@alliander.com> Signed-off-by: Egor Dmitriev <egor.dmitriev@alliander.com> Signed-off-by: Egor Dmitriev <egor.dmitriev@alliander.com> Signed-off-by: Egor Dmitriev <egor.dmitriev@alliander.com>
34be5fd to
ba26ca3
Compare
Signed-off-by: Egor Dmitriev <egor.dmitriev@alliander.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Adds regression tests verifying that
arctan_loss_multi_objectiveandpinball_loss_multi_objectiveaccept 2D(n_samples, n_quantiles)input arrays as passed by XGBoost 3.2+, and produce results identical to the flat 1D arrays used in older versions.Context
XGBoost 3.2 changed the calling convention for custom objectives with multi-output trees: arrays are now passed as 2D
(n_samples, n_outputs)instead of the flat 1D(n_samples * n_outputs,)used previously. This was tracked in #865 and fixed in #866.Relationship to #866
release/v4.0.0before fix: handle both 1D and 2D input shapes in XGBoost custom objectives #866).Tests added
test_loss_fn__2d_input_matches_1d_input[pinball]— pinball objective with 2D inputtest_loss_fn__2d_input_matches_1d_input[arctan]— arctan objective with 2D inputtest_loss_fn__2d_input_with_sample_weights_matches_1d[pinball]— pinball with 2D input + sample weightstest_loss_fn__2d_input_with_sample_weights_matches_1d[arctan]— arctan with 2D input + sample weightsCloses #865 (when merged after #866)