You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updates MLB league constants to a 60/40 blend of 2026 actuals and 2025 reference (through May 14) and applies them across models and fallbacks. Centralizes the values in data/calibration_params.json for easier future updates.
New Features
Added league_constants to data/calibration_params.json (wOBA 0.310, OBP 0.317, SLG 0.397, AVG 0.241, ISO 0.155, BABIP 0.292, K% 0.224, BB% 0.091, ERA 4.12, HR/FB% 0.109, O-swing 0.287).
Updated defaults/baselines in fangraphs_layer, pa_model, lineup_chase_layer, prop_enrichment_layer, streak_agent, and tasklets (e.g., K 22.4%, BB 9.1%, O-swing 28.7%, SLG 0.397).
Refreshed PA outcome rates (HR 3.0%, 2B 4.4%, 1B 14.1%, OUT 45.5% residual) and tuned streak/chase logic to the ABS-influenced run environment.
Updated 2025 MLB season baseline statistical constants across the system, including league-average rates for pitcher and batter performance metrics used in probability calculations and predictions.
Refreshed default fallback values for when live statistical data is unavailable, ensuring calculations remain current with latest seasonal baselines.
Reviewing files that changed from the base of the PR and between 52e9c24 and 6607658.
📒 Files selected for processing (7)
data/calibration_params.json
fangraphs_layer.py
lineup_chase_layer.py
pa_model.py
prop_enrichment_layer.py
streak_agent.py
tasklets.py
📝 Walkthrough
Walkthrough
This PR updates league-average baseline constants used as fallbacks throughout the prediction and enrichment pipeline, applying a 60/40 2026/2025 season blend calibration. Changes span seven files: a new calibration reference, base PA outcome rates, FanGraphs defaults for pitchers and batters, probability adjustment baselines, and feature normalization constants.
Changes
League Baseline Calibration Update
Layer / File(s)
Summary
Calibration source and base league rates data/calibration_params.json, pa_model.py
New league_constants reference section documents the 60/40 blend, and LEAGUE_RATES constants for strikeout/walk/home-run/double/single outcome rates are updated to match the blended model.
FanGraphs pitcher and batter fallback defaults and adjustments fangraphs_layer.py, streak_agent.py
LEAGUE_DEFAULTS pitcher and batter fallback statistics (wOBA, K-BB%, FIP, ERA, BABIP, etc.) are updated; pitcher and batter probability delta baselines in streak_agent.py shift to use new FIP (4.12) and wOBA (0.310) targets.
Enrichment and feature vector baseline constants lineup_chase_layer.py, prop_enrichment_layer.py, tasklets.py
Chase score league baselines (O-swing, K%) and pitcher/batter enrichment fallback stats are updated; platoon priors and XGBoost feature vector normalization constants (SLG, BB%, K%) are adjusted.
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~12 minutes
Possibly related PRs
jaayslaughter-cpu/mework#290: Prior update to the same league-average fallback constants in fangraphs_layer.py, lineup_chase_layer.py, and related prediction layers.
jaayslaughter-cpu/mework#318: Earlier calibration update affecting the same fallback constants and feature baselines across fangraphs_layer.py, prop_enrichment_layer.py, and tasklets.py.
jaayslaughter-cpu/mework#408: Concurrent updates to prop_enrichment_layer.py's missing-stats enrichment fallback behavior and chase-score fallback logic.
Poem
🐰 Constants shift as seasons blend,
Sixty-forty split to mend,
From May's snapshot, baselines fly,
New odds and deltas multiply! ✨
✨ Finishing Touches📝 Generate docstrings
Create stacked PR
Commit on current branch
🧪 Generate unit tests (beta)
Create PR with unit tests
Commit unit tests in branch pr-574-league-constants-blend
Tip
💬 Introducing Slack Agent: The best way for teams to turn conversations into code.
Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Generate code and open pull requests
Plan features and break down work
Investigate incidents and troubleshoot customer tickets together
Automate recurring tasks and respond to alerts with triggers
Summarize progress and report instantly
Built for teams:
Shared memory across your entire org—no repeating context
Per-thread sandboxes to safely plan and execute work
Governance built-in—scoped access, auditability, and budget controls
One agent for your entire SDLC. Right inside Slack.
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer TIP This summary will be updated as you push new changes.
We reviewed changes in 52e9c24...6607658 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request updates league-average baseline constants across the codebase—including fangraphs_layer.py, pa_model.py, and tasklets.py—to reflect a 60/40 blend of 2026 and 2025 data. Review feedback identifies several locations where fallback values for metrics like era, xfip, and babip remain inconsistent with the new standards. Additionally, the reviewer noted that normalization logic in tasklets.py needs adjustment to align with the updated averages and suggested formatting woba to three decimal places for consistency.
The reason will be displayed to describe this comment to others. Learn more.
While k_bb_pct has been updated to 0.133, several other league fallbacks in this block (and throughout the file) remain inconsistent with the new blended constants. Specifically, era, xfip, and siera (lines 212, 216, 217) are still using 4.06 instead of the new 4.12 standard defined in fangraphs_layer.py and streak_agent.py. Additionally, babip (line 241) and z_contact (line 243) fallbacks in the batter block are also inconsistent with the updated defaults.
The reason will be displayed to describe this comment to others. Learn more.
The update of the slg fallback to 0.397 creates an inconsistency with the normalization logic in the following line (3150). The calculation (_slg - 0.250) / 0.400 and the associated comment 0.410=avg(0.40) are based on the previous league average. To maintain the same feature scaling for an "average" player, the normalization constants should be adjusted. Similarly, the babip fallback in line 3152 remains at 0.288 instead of the new 0.292 standard.
"notes": "prop_min_prob_overrides: per-prop MIN_PROB gates stricter than global 0.57. fantasy_score set to 0.99 (effectively excluded). hits_allowed excluded pending more data (Brier 0.4531).",
"league_constants": {
"_comment": "60/40 blend 2026/2025 \u2014 May 15 2026. Source: BBRef totals through May 14.",
The reason will be displayed to describe this comment to others. Learn more.
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Usage of assert statement in application logic is discouraged. assert is removed with compiling to optimized byte code. Consider raising an exception instead. Ideally, assert statement should be used only in tests.
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
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.
League Constants — 60/40 Blend (2026 Actuals / 2025 Reference)
Source: Baseball Reference totals through May 14, 2026 (49,542 PA, 30 teams × ~44 games)
What changed
Notable: BB% is up in 2026 (ABS challenge system). O-swing drops from .316 to .287 — batters disciplined vs machine-called strikes.
Files updated (7)
Summary by cubic
Updates MLB league constants to a 60/40 blend of 2026 actuals and 2025 reference (through May 14) and applies them across models and fallbacks. Centralizes the values in
data/calibration_params.jsonfor easier future updates.league_constantstodata/calibration_params.json(wOBA 0.310, OBP 0.317, SLG 0.397, AVG 0.241, ISO 0.155, BABIP 0.292, K% 0.224, BB% 0.091, ERA 4.12, HR/FB% 0.109, O-swing 0.287).fangraphs_layer,pa_model,lineup_chase_layer,prop_enrichment_layer,streak_agent, andtasklets(e.g., K 22.4%, BB 9.1%, O-swing 28.7%, SLG 0.397).Written for commit 6607658. Summary will update on new commits. Review in cubic
Summary by CodeRabbit