Add s3_xgboost ds-model type - #28
Merged
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds support for serving XGBoost classifier models through the existing ds_models abstraction, enabling models saved via XGBoost’s native JSON format to be fetched from S3 and invoked via predict_proba.
Changes:
- Introduces a new
s3_xgboostds-model loader (S3Xgboost) that loadsapplication/jsonartifacts from S3 and runspredict_proba. - Adds an
xgboostoptional extra (pureskillgg-dsdk[xgboost]) and updates the lockfile accordingly. - Adds an integration-style test that trains an
XGBClassifier, round-trips it through a fake S3 client, and checkspredict_probaparity.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Locks new optional-extra dependencies (xgboost, scikit-learn and transitive deps). |
| pyproject.toml | Defines the xgboost optional extra and adds xgboost/sklearn to dev deps. |
| pureskillgg_dsdk/ds_models/s3_xgboost.py | Implements the s3_xgboost model type (S3 JSON load + predict_proba). |
| pureskillgg_dsdk/ds_models/s3_xgboost_test.py | Tests round-trip loading from S3 body and prediction parity vs local model. |
| pureskillgg_dsdk/ds_models/model.py | Registers s3_xgboost in the ds-model factory. |
| CHANGELOG.md | Documents the new model type and optional extra in release notes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+24
to
+27
| # Requires the xgboost extra: pureskillgg-dsdk[xgboost] | ||
| # pylint: disable=import-outside-toplevel | ||
| import xgboost | ||
|
|
Comment on lines
31
to
+35
| "pytest>=9.0.0,<10.0.0", | ||
| "pytest-cov>=7.0.0,<8.0.0", | ||
| "pytest-watch>=4.2.0,<5.0.0", | ||
| "xgboost>=3.2,<4.0.0", | ||
| "scikit-learn>=1.9,<2.0.0", |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Member
Author
|
Addressed Copilot review:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
New
s3_xgboostmodel type inds_models: loads an XGBoost model saved with the nativesave_model(*.json)format from S3 (res_type: application/json) and invokespredict_proba(model_type: XGBClassifier).xgboost is a declared optional extra —
pureskillgg-dsdk[xgboost](which also pulls scikit-learn, required by the XGBClassifier sklearn API) — with a plain in-function import in the loader. No injection (that pattern exists for hdbscan only because hdbscan''s packaging was broken). It''s not a base dependency because csgo-ppp and other pipeline consumers of dsdk never load models and shouldn''t ship the ~200MB xgboost wheel. Consumers that already depend on xgboost directly (csgo-coach) need nothing beyond dsdk >=3.1.0.Test trains a real tiny XGBClassifier, round-trips it through a fake S3 body, and asserts exact predict_proba parity.
Why
csgo-coach currently bakes
xgb_model_v1.json(win_probability) into its Docker image and loads it from disk, bypassing the ds-models path every other model uses. This type lets that model live in the AI bucket and be registered/versioned in models.yaml like everything else. The XGBoost json format is version-stable, unlike pickles, so this is also the preferred serving route for future ML models.Rollout (dependency chain)
s3_xgboostin models.yaml) → release.xgb_win_probability; pureskillgg/csgo-coach#220 switches win_probability toget_ds_model.A models.json entry with an unknown type is inert for consumers on dsdk <3.1.0 unless
get_ds_modelis called on that specific model, so merge order across consumers is safe.🤖 Generated with Claude Code