Skip to content

feat: Implement new xgboost - #156

Merged
gandola merged 1 commit into
masterfrom
ft-pg-RLAB-617
Oct 19, 2026
Merged

gandola merged 1 commit into
masterfrom
ft-pg-RLAB-617

Conversation

@gandola

@gandola gandola commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Adds a new OpenML provider, openml-xgboost, built directly on the upstream XGBoost JVM binding (ml.dmlc:xgboost4j_2.12:3.4.0) to be a replacement of the H2O-embedded XGBoost.

Phase 1 covers:

  • Model import — loadModel / loadSchema / validateForLoad.
  • Real-time single-instance scoring — classify / getClassDistribution via Booster.inplace_predict.
  • In-process (non-Spark) training — fit via XGBoost.train.

Key classes

  • XgboostModelProvider — TrainingMachineLearningProvider, algorithm XGBOOST_BINARY_CLASSIFIER.
  • XgboostModelCreator — loadModel / fit / validateForLoad / validateForFit.
  • XgboostClassificationModel — scoring; native handle guarded by a synchronized block (the Booster handle is not thread-safe).
  • XgboostSchemaUtils — shared feature-row builder used by both training and scoring (guarantees identical encoding).

Native runtime

  • xgboost4j bundles native libs for linux/{x86_64,aarch64}, macos/{x86_64,aarch64}, windows/x86_64 — ARM/Graviton works out of the box.
  • Requires OpenMP (libgomp/libomp) at runtime.
  • No musl/Alpine native binary is published — native-dependent tests are Assume-guarded and skip gracefully there.

Dependency handling (Kryo)

xgboost4j_2.12 transitively pulls Kryo 5, whose com.esotericsoftware.kryo.Kryo collides on the classpath with the Kryo 4 (kryo-shaded) used by Spark/consumers (Kryo 5 removed the nested Kryo.DefaultInstantiatorStrategy). Since Booster implements com.esotericsoftware.kryo.KryoSerializable, kryo must still be
present at class-load. Resolution: exclude kryo from the xgboost4j dependency and re-declare it in provided scope — available for this module's own compile/tests, not propagated transitively to consumers (which supply their own Kryo).

Testing

  • 20 tests; native-dependent ones Assume-skip where the native lib can't load (musl).
  • Coverage: 154/159 lines, 38/40 branches. Remaining gaps are the jackson-backed loadSchema one-line delegation and two native-exception catch blocks.
  • Verified train + save/reload produces identical scores; validation rejects string/free-text feature fields.

@codecov

codecov Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.42932% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.38%. Comparing base (18a41e9) to head (511bc6f).

Files with missing lines Patch % Lines
...l/provider/xgboost/XgboostClassificationModel.java 95.00% 2 Missing ⚠️
...i/openml/provider/xgboost/XgboostModelCreator.java 99.07% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #156      +/-   ##
============================================
+ Coverage     81.76%   83.38%   +1.62%     
- Complexity      525      589      +64     
============================================
  Files            52       58       +6     
  Lines          1771     1962     +191     
  Branches        179      195      +16     
============================================
+ Hits           1448     1636     +188     
- Misses          234      237       +3     
  Partials         89       89              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gandola
gandola requested a review from a team October 13, 2026 18:00

@jpleitao jpleitao left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall the code looks good, just added some comments regarding (i) the set of parameters being exposed, (ii) default values for some parameters, and (iii) validations

@jpleitao jpleitao left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All comments have been address, nothing further to point out (don't seem to be able to resolve threads, so leaving them open but the PR is fine by me)

@gandola
gandola removed the request for review from a team October 17, 2026 10:01
@gandola
gandola merged commit c865a0d into master Oct 19, 2026
3 checks passed
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.

3 participants