AGG-131: score feature rows with HH/CG LightGBM boosters - #13
Merged
Conversation
Load two boosters (hh_beeline_bezzalog_2026_05_04_model, cg_beeline_bezzalog_2026_05_04_model) once at startup from KZ_SCORING_HH_MODEL_PATH / KZ_SCORING_CG_MODEL_PATH and enrich each row returned by /single and /multi with HH_score and CG_score. Feature vectors are projected onto booster.feature_name() in order; missing keys are passed to LightGBM as NaN so tree splits treat them as native missing values. Predictions are returned as raw PD (0..1) per AGG-131. Leaving a path empty disables that model — the response schema is unchanged, so the enrichment is fully backward-compatible. The chart gets an optional models.volume that mounts any k8s volume source (PVC, ConfigMap, Secret, ...) at a configurable mountPath, so operators can update the model files without rebuilding the image. Closes AGG-131. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Resolve conflicts introduced by main-branch changes (SALT_PKB hex-decode, X-API-Key auth gate, pipeline secrets context key): - config.py: keep both hh_model_path/cg_model_path (feature) and api_token (main) fields. - lookup.py: apply scoring first, then _shape() the result — scoring mutates rows in place, so both the list (iin-only) and single-dict (iin+phone) shapes carry HH_score/CG_score. - tests/conftest.py: keep env-setdefault + noqa: E402 layout from main, add BoosterScorer/ScoringService import. - tests/test_endpoints.py, tests/test_lookup.py: switch scoring tests from fake_secrets.value (hex-encoded) to fake_secrets.salt_bytes (raw), so the row_id derived on the test side matches what LookupService derives after hex-decoding. 87/87 tests pass. Co-authored-by: multica-agent <github@multica.ai>
anthrax63
added a commit
that referenced
this pull request
Aug 4, 2026
The 0.4.1 tag was reused twice (PR #13 boosters, PR #14 chart extras) after v0.4.1 shipped, making Argo unable to detect a rollable image. Bump the tag chain (pyproject, __init__, Chart appVersion) to 0.5.0 so GHA publishes a fresh `v0.5.0` image and the kartel-deploy overlay can pin to it. Co-authored-by: DevOps (Aivo agent) <devops@aivoagent.bot> Co-authored-by: multica-agent <github@multica.ai>
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.
Summary
hh_beeline_bezzalog_2026_05_04_model,cg_beeline_bezzalog_2026_05_04_model) once at process start fromKZ_SCORING_HH_MODEL_PATH/KZ_SCORING_CG_MODEL_PATH./singleand/multiwithHH_scoreandCG_score— rawbooster.predict()output in[0, 1](per the note in AGG-131 that keepsnew_model_pdsemantics).booster.feature_name()in order; missing keys becomeNaNso LightGBM handles them as native missing values.models.volumethat mounts any k8s volume source (PVC / ConfigMap / Secret / …) at a configurable mountPath, so ops can update model files without rebuilding the image.Closes AGG-131. Depends on AGG-128 (PR #35 in
aggregion/kz-scoring) for the full feature-set that the boosters read.Test plan
pytest -q(50 passed) — new coverage intests/test_scoring.py(unit-level:_to_float,BoosterScorer,ScoringService, real-LightGBM round-trip),tests/test_lookup.py(integration throughLookupService),tests/test_endpoints.py(/single//multiendpoint-level scoring).ruff check .— clean.helm lint chart— clean.helm template chart --set models.volume.enabled=true --set models.volume.persistentVolumeClaim.claimName=…— mounts and env wire up.new_model_pdcolumn inОписание переменных модели.xlsx. If he expects a0..1000score, a scalar transform on top is a one-line follow-up.🤖 Generated with Claude Code