Repository navigation
sprint3 - #4
Merged
Merged
sprint3#4
Conversation
Ties Task 3.2 (free_transfers_banked) and Task 3.4 (confidence decay) into transfer recommendations: objective now maximizes short-term (gw+1..+3) + long-term (gw+4..+8) confidence-weighted gain minus hit cost, linearized via a slack variable so the solver never pads hits beyond the minimum feasible value. short_term_gain, long_term_gain, and hit_cost are returned as separate fields, never blended, so the Task 3.6 explanation layer can describe divergent short vs. long-term rationale. BREAKING CHANGE: optimize_transfers() signature changed — xp_map replaced by predictions (per-gw point_estimate/confidence), plus new current_gameweek and free_transfers_banked params. recommendations.py patched with a stopgap that spreads its existing single-gw xp_map across the full horizon at confidence 1.0; real multi-gw wiring is Task 3.7.
…(Task 3.6) - Implemented explanation generation directly using the google-genai SDK with gemini-3.5-flash and structured outputs (Pydantic model validation). - Created backend/agent/explain.py containing explanation generation, DB persistence, and recursive groundedness validation logic checking prose numbers against source payload values. - Updated RecommendedTransfer schema and backend/api/recommendations.py to populate and store short_term_gain, long_term_gain, hit_cost, and multi-week predictions in recommendation payload_json. - Added tests/unit/test_explain.py covering mock Gemini SDK responses, success persistence flow, and groundedness check pass/fail assertions. - Added scratch_manual_test_explain.py for easy manual end-to-end live testing.
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.
Description
Implements Sprint 3 changes for transfer recommendation explanations and economics.
Key Changes
Verification
pm run build