Skip to content

feat: Implement new xgboost - #156

Open
gandola wants to merge 3 commits into
masterfrom
ft-pg-RLAB-617
Open

gandola wants to merge 3 commits into
masterfrom
ft-pg-RLAB-617

Conversation

@gandola

@gandola gandola commented Sep 18, 2026 •

Copy link
Copy Markdown

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 93.71069% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.74%. Comparing base (18a41e9) to head (96dad3b).

Files with missing lines Patch % Lines
...l/provider/xgboost/XgboostClassificationModel.java 83.33% 5 Missing and 1 partial ⚠️
...i/openml/provider/xgboost/XgboostModelCreator.java 95.40% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #156      +/-   ##
============================================
+ Coverage     81.76%   82.74%   +0.98%     
- Complexity      525      579      +54     
============================================
  Files            52       58       +6     
  Lines          1771     1930     +159     
  Branches        179      193      +14     
============================================
+ Hits           1448     1597     +149     
- Misses          234      242       +8     
- Partials         89       91       +2     

☔ 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.

/**
* Specifies the XGBoost algorithms that can be imported and trained through this provider.
*
* @since 1.0.0

@fdz-joao-santos fdz-joao-santos Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not true, also, not needed.

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