Building a Feature Store for MLB Predictions
How I designed a lightweight feature store on S3 to serve real-time batter and pitcher stats to a SageMaker endpoint.
Why a Feature Store
When you’re predicting batter performance for tonight’s game, you need the same features at training time and serving time. Without a consistent store, you end up rewriting the same Pandas logic twice and eventually the two diverge.
The Design
The store is dead simple: a set of Parquet files on S3, partitioned by date. A Lambda function refreshes them each morning after the previous day’s stats are posted.
Training vs Serving
At training time, you point the pipeline at the historical partition range. At serving time, the SageMaker endpoint fetches the latest partition for the current day.
Tradeoffs
The main tradeoff is latency: S3 reads add ~50ms per request. For a system where predictions run once per day before first pitch, this is completely fine.
What I’d Do Differently
If I needed sub-second serving latency I’d push the features into DynamoDB. For now, S3 is cheaper and simple enough to reason about.