Skip to content

fix: XGBoostEstimator honors random_seed config#1551

Merged
thinkall merged 1 commit into
microsoft:mainfrom
immu4989:flaml-fix-xgboost-native-reproducibility
May 21, 2026
Merged

fix: XGBoostEstimator honors random_seed config#1551
thinkall merged 1 commit into
microsoft:mainfrom
immu4989:flaml-fix-xgboost-native-reproducibility

Conversation

@immu4989
Copy link
Copy Markdown
Contributor

@immu4989 immu4989 commented May 20, 2026

Why are these changes needed?

Seed random_state on XGBoostEstimator.__init__ so its native-API xgb.train(self.params, ...) path produces deterministic results across runs and honors the FLAML-internal random_seed config. Uses the same defensive pattern shipped in #1541, #1546, #1547, and #1549 — pop the random_seed key from self.params, and only set random_state when the caller has not already provided one.

XGBoostEstimator is the non-sklearn-API XGBoost class — not bound to a user-facing string in generic_task.py, but reachable via:

  • Direct instantiation (e.g. flaml/automl/automl.py uses it internally for the best-config retrain path)
  • User subclassing (FLAML's own test_regression.py defines MyXGB1 / MyXGB2 subclasses that exercise this exact pattern)

This is the last XGBoost item on tracking issue #1540; the sklearn-API variants XGBoostSklearnEstimator and XGBoostLimitDepthEstimator were closed by #1549.

Related issue number

Tracking issue: #1540
Pattern reference: #1549 (XGBoostSklearnEstimator), #1547 (RandomForest), #1541 (SGD), #1546 (LRL1)

Checks

@thinkall thinkall merged commit 5917f75 into microsoft:main May 21, 2026
13 checks passed
@immu4989 immu4989 deleted the flaml-fix-xgboost-native-reproducibility branch May 21, 2026 03:56
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