Skip to content

Add Booster model_type and parquet dataframes to ds_models - #29

Merged
billfreeman44 merged 3 commits into
masterfrom
rank-prediction-model-types
Jul 19, 2026
Merged

Add Booster model_type and parquet dataframes to ds_models#29
billfreeman44 merged 3 commits into
masterfrom
rank-prediction-model-types

Conversation

@billfreeman44

Copy link
Copy Markdown
Member

Why

Shipping predicted FACEIT level / Premier rating to the scoreboard needs three XGBoost artifacts served by the coach: a 10-class softprob classifier, a censored survival:aft booster, and a percentile-target regressor — plus several parquet reference tables (llr grids, headshot-angle lookup, death-danger percentiles) too large for CSV.

What

  • s3_xgboost accepts model_type: Booster: loads with xgboost.Booster and predicts through DMatrix(..., enable_categorical=True) — one code path for regressors, AFT boosters, and softprob classifiers, including models with pandas categorical features. Existing XGBClassifier path untouched.
  • s3_dataframe accepts res_type: application/x-parquet.

Reactor's models.yaml schema already takes model_type/res_type as free strings, so no schema pair needed this time.

Tests

  • Booster round-trip vs local predictions (incl. a categorical feature)
  • Parquet dataframe round-trip

🤖 Generated with Claude Code

billfreeman44 and others added 2 commits July 19, 2026 05:27
Serving support for the rank-prediction models: raw xgboost.Booster
predict via categorical-enabled DMatrix, and parquet s3_dataframe
artifacts for large lookup tables.

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

This PR extends the ds_models S3-backed model loaders to support additional XGBoost artifact types (native Booster) and parquet-backed pandas DataFrames, enabling serving larger lookup tables and non-sklearn XGBoost models through the coach.

Changes:

  • Add model_type: Booster support to s3_xgboost using xgboost.Booster + DMatrix(..., enable_categorical=True) for prediction.
  • Add application/x-parquet support to s3_dataframe via pd.read_parquet on S3 object bytes.
  • Add/extend tests covering Booster prediction round-trip and parquet DataFrame round-trip; update changelog.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pureskillgg_dsdk/ds_models/s3_xgboost.py Adds XGBoost Booster loading/prediction path and centralizes xgboost import handling.
pureskillgg_dsdk/ds_models/s3_xgboost_test.py Adds a Booster-based test case (incl. categorical feature) and adjusts test scaffolding.
pureskillgg_dsdk/ds_models/s3_dataframe.py Adds parquet loading support for S3 DataFrame artifacts.
pureskillgg_dsdk/ds_models/s3_dataframe_test.py New test validating parquet DataFrame round-trip through s3_dataframe.
CHANGELOG.md Documents the new Booster and parquet capabilities.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +28 to 32
if self._model_type == "Booster":
model = xgboost.Booster()
else:
model = xgboost.XGBClassifier()
model.load_model(bytearray(body))
Comment on lines +89 to +91
predictions = ds_model.invoke(frame)
expected = trained.predict(xgboost.DMatrix(frame, enable_categorical=True))
np.testing.assert_array_equal(predictions, expected)
Comment thread CHANGELOG.md
The format is based on [Keep a Changelog](https://keepachangelog.com/)
and this project adheres to [Semantic Versioning](https://semver.org/).

## 3.2.0
Comment thread CHANGELOG.md
The format is based on [Keep a Changelog](https://keepachangelog.com/)
and this project adheres to [Semantic Versioning](https://semver.org/).

## 3.2.0
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@billfreeman44

Copy link
Copy Markdown
Member Author

Addressed the review: unknown model_type now raises at load time in _read_json_model (instead of silently defaulting to XGBClassifier and failing later), and the Booster test uses assert_allclose(rtol=1e-6). The two changelog comments are the repo's release convention working as intended: the top section stays a bare ## 3.2.0 with no date and no version bump in-PR — the version workflow bumps pyproject.toml and the date lands at release, same as every prior release here.

@billfreeman44
billfreeman44 merged commit 0315548 into master Jul 19, 2026
7 checks passed
@billfreeman44
billfreeman44 deleted the rank-prediction-model-types branch July 19, 2026 11:20
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