Skip to content

test(loss_functions): add XGBoost 3.2 2D input regression tests#867

Merged
egordm merged 3 commits into
release/v4.0.0from
test/xgboost-3.2-loss-function-regression-tests
May 5, 2026
Merged

test(loss_functions): add XGBoost 3.2 2D input regression tests#867
egordm merged 3 commits into
release/v4.0.0from
test/xgboost-3.2-loss-function-regression-tests

Conversation

@egordm
Copy link
Copy Markdown
Collaborator

@egordm egordm commented May 5, 2026

Summary

Adds regression tests verifying that arctan_loss_multi_objective and pinball_loss_multi_objective accept 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

Tests added

  • test_loss_fn__2d_input_matches_1d_input[pinball] — pinball objective with 2D input
  • test_loss_fn__2d_input_matches_1d_input[arctan] — arctan objective with 2D input
  • test_loss_fn__2d_input_with_sample_weights_matches_1d[pinball] — pinball with 2D input + sample weights
  • test_loss_fn__2d_input_with_sample_weights_matches_1d[arctan] — arctan with 2D input + sample weights

Closes #865 (when merged after #866)

@egordm egordm force-pushed the test/xgboost-3.2-loss-function-regression-tests branch from aa7a3a0 to e56b8ec Compare May 5, 2026 07:27
@egordm egordm marked this pull request as ready for review May 5, 2026 07:27
@egordm egordm requested a review from a team May 5, 2026 07:27
@egordm egordm force-pushed the test/xgboost-3.2-loss-function-regression-tests branch 2 times, most recently from 186a713 to 694fdf9 Compare May 5, 2026 07:37
bartpleiter
bartpleiter previously approved these changes May 5, 2026
Copy link
Copy Markdown
Collaborator

@bartpleiter bartpleiter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@egordm egordm force-pushed the test/xgboost-3.2-loss-function-regression-tests branch from 34be5fd to ba26ca3 Compare May 5, 2026 08:06
bartpleiter
bartpleiter previously approved these changes May 5, 2026
Copy link
Copy Markdown
Collaborator

@bartpleiter bartpleiter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Egor Dmitriev <egor.dmitriev@alliander.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 5, 2026

@egordm egordm merged commit 014bc0c into release/v4.0.0 May 5, 2026
4 checks passed
@egordm egordm deleted the test/xgboost-3.2-loss-function-regression-tests branch May 5, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants