Skip to content

Add s3_xgboost ds-model type - #28

Merged
billfreeman44 merged 4 commits into
masterfrom
add-s3-xgboost-model
Jul 14, 2026
Merged

Add s3_xgboost ds-model type#28
billfreeman44 merged 4 commits into
masterfrom
add-s3-xgboost-model

Conversation

@billfreeman44

@billfreeman44 billfreeman44 commented Jul 13, 2026

Copy link
Copy Markdown
Member

What

New s3_xgboost model type in ds_models: loads an XGBoost model saved with the native save_model(*.json) format from S3 (res_type: application/json) and invokes predict_proba (model_type: XGBClassifier).

xgboost is a declared optional extrapureskillgg-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)

  1. This PR → release 3.1.0 to PyPI.
  2. pureskillgg/reactor#25 (schema allows s3_xgboost in models.yaml) → release.
  3. pureskillgg/csgo-assessment#90 registers xgb_win_probability; pureskillgg/csgo-coach#220 switches win_probability to get_ds_model.

A models.json entry with an unknown type is inert for consumers on dsdk <3.1.0 unless get_ds_model is called on that specific model, so merge order across consumers is safe.

🤖 Generated with Claude Code

billfreeman44 and others added 3 commits July 13, 2026 18:09
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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_xgboost ds-model loader (S3Xgboost) that loads application/json artifacts from S3 and runs predict_proba.
  • Adds an xgboost optional 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 checks predict_proba parity.

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 thread pyproject.toml
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>
@billfreeman44

Copy link
Copy Markdown
Member Author

Addressed Copilot review:

  • Bare import → generic ModuleNotFoundError: fixed — the loader now raises "xgboost is not installed: install the pureskillgg-dsdk[xgboost] extra" from the ImportError.
  • xgboost/sklearn in the dev group: keeping as-is. The lint job needs them resolvable regardless — pylint statically resolves imports (E0401), so s3_xgboost_test.py's top-level import xgboost would fail lint without them. Splitting per-job --extra installs would complicate the shared setup action to save one cached wheel download.

@billfreeman44
billfreeman44 merged commit 8b6be81 into master Jul 14, 2026
7 checks passed
@billfreeman44
billfreeman44 deleted the add-s3-xgboost-model branch July 14, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants