MLB Roster Optimization

Compare linear regression and random forest models, then inspect salary-constrained historical lineups.

Select a historical lineup

Loading…

PositionPlayerArchived salaryRun-production proxy

Each lineup was solved in Python with integer programming: nine unique players, one at each batting position including DH, within the selected cap. The displayed choices are precomputed solutions, not a live MLB draft.

Regression comparison

Training: 1961–1996. Test: 1997–2001. Five chronological training folds keep each season intact. The default model minimizes training CV mean absolute error.

ModelCV MAETest MAETest RMSETest R²
How player scores are formed

Player batting rates use 1997–2001 data, with at least 1,000 AB+BB plate appearances over those five years. Rates are scaled to a team-game AB+BB rate. The regression predicts a team-of-identical-batters run-production proxy. The optimization maximizes the sum of those proxies; it does not predict actual lineup wins or total runs.

Primary positions use only 1997–2001 appearances. Pitchers are excluded; any eligible nonpitcher may fill DH. Archived 2002 salary rows are summed per player. This is a retrospective comparison using archived data, not a reconstruction of contracts available to a particular team.