Repository navigation
[python-package] Maximize interval-regression-accuracy and ams@k in early stopping - #12621
MohammadHijjawi97 wants to merge 1 commit into
Conversation
…arly stopping. `EarlyStopping` infers the optimization direction from a list of metric prefixes when `maximize` is not specified. The higher-is-better built-in metrics `interval-regression-accuracy` and `ams@k` were missing, so early stopping minimized them and stopped at the first iteration. Fixes dmlc#12612
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. WalkthroughWhen Assessment against linked issues:
Suggested reviewers: Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The Python early-stopping change is mergeable after normal checks; no actionable issue remains identified. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change corrects model-selection behavior for two existing metrics. It does not appear to add a new access path or privilege, but it changes training outcomes when the metric direction is left unspecified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Comment |
|
Thanks. I opened a different PR to fix all language bindings: #12664 |
|
Thanks @trivialfis, fixing it across all bindings in #12664 makes sense. Closing this one in favor of it. |
Fixes #12612.
When
maximizeis not given,EarlyStoppinginfers the direction from a hard-coded list of metric prefixes. The built-in higher-is-better metricsinterval-regression-accuracy(survival:aft) andams@kwere missing from that list. They were minimized, so training stopped afterearly_stopping_rounds + 1rounds withbest_iteration = 0. This affectsxgb.train,xgb.cvand the sklearn estimators, which all go throughEarlyStopping.This adds
"ams@"and"interval-regression-accuracy"to the list. The C++ side only acceptsamsin theams@kform, so theams@prefix is enough. I checked the other registered metrics, and none of the remaining ones are higher-is-better.Added
test_early_stopping_maximize_inferredintests/python/test_callback.py, covering both metrics. It fails without the fix (best_iterationstays 0) and passes with it.Note: the R package has the same inference in
R-package/R/callbacks.R. I kept this PR to the Python package and can follow up there if that's useful.