How ksy1022/predicting_the_performance_of_mlb_fa works
This is a research pipeline for predicting MLB free-agent performance from player statistics and contract data. The principal workflow assembles free-agent events and contracts with pre/post performance windows, creates hitter and pitcher datasets, trains two- and three-class classifiers, evaluates model and cutoff behavior, and produces research figures and tables. The README documents the overall pipeline; sampled source confirms selected dataset-building, model-labeling, and VIF behavior. Some subsystem links therefore rely on README documentation rather than inspected calls.
Main entry points: processed Processed datasets · final_2_class_model.py Two-class models · build_hitter_dataset.py Hitter dataset · outputs Experiment results
Components 24
Data collection
- FA events
src/preprocessing/collect_mlb_fa_events.py - MLB statistics
src/preprocessing/collect_mlb_stats.py - Contract merge
src/preprocessing/merge_spotrac_contracts.py - Contract cleaning
src/preprocessing/clean_spotrac_contracts.py - Raw inputs
data/raw
Dataset preparation
- FA list
src/preprocessing/build_fa_list.py - Player windows
data/interim/player_windows - Processed datasets
data/processed - Hitter dataset
src/preprocessing/build_hitter_dataset.py - Pitcher dataset
src/preprocessing/build_pitcher_dataset.py
Modeling
- Two-class models
src/modeling/final_2_class_model.py - Three-class models
src/modeling/final_3_class_model.py - Stacking features
src/feature_engineering/feature_engineering_stacking.py
Evaluation
- VIF experiments
src/evaluation/Multicollinearity/fa_experiment_vif.py - VIF selection
src/evaluation/Multicollinearity/multicollinearity_handler.py - VIF two-class
src/evaluation/Multicollinearity/vif_2class_analysis.py - VIF three-class
src/evaluation/Multicollinearity/vif_3class_analysis.py - Cutoff comparison
src/evaluation/compare_2class_cutoffs.py - Three-class cutoffs
src/evaluation/compare_3class_cutoffs.py - Validation split
src/evaluation/fa_model_validation_split.py - Experiment results
outputs
Reporting
- Figures and tables
src/visualization - Figure generation
src/visualization/figure_mpl.py
Other components
- Researcher
Connections 30
- Researcher → FA events: runs collection
README.md - Researcher → MLB statistics: runs collection
README.md - Researcher → Contract merge: runs merge
README.md - Researcher → Contract cleaning: runs cleaning
README.md - FA events → FA list: builds FA list
README.md - MLB statistics → Player windows: writes windows
src/preprocessing/collect_mlb_stats.py - Contract merge → Contract cleaning: prepares contracts
README.md - Contract cleaning → Processed datasets: writes contracts
README.md - FA list → Hitter dataset: supports matching
- Player windows → Hitter dataset: provides windows
README.md - Processed datasets → Hitter dataset: provides contracts
README.md - Player windows → Pitcher dataset: provides windows
src/preprocessing/build_pitcher_dataset.py - Processed datasets → Pitcher dataset: provides contracts
src/preprocessing/build_pitcher_dataset.py - Hitter dataset → Processed datasets: writes hitter data
README.md - Pitcher dataset → Processed datasets: writes pitcher data
src/preprocessing/build_pitcher_dataset.py - Processed datasets → Two-class models: loads datasets
src/modeling/final_2_class_model.py - Processed datasets → Three-class models: loads datasets
src/modeling/final_3_class_model.py - Processed datasets → Stacking features: engineers features
src/feature_engineering/feature_engineering_stacking.py - Two-class models → Experiment results: writes metrics
- Three-class models → Experiment results: writes metrics
- VIF experiments → VIF selection: applies selection
src/evaluation/Multicollinearity/fa_experiment_vif.py - VIF two-class → VIF selection: uses selection
src/evaluation/Multicollinearity/vif_2class_analysis.py - VIF three-class → VIF selection: uses selection
src/evaluation/Multicollinearity/vif_3class_analysis.py - VIF experiments → Experiment results: writes experiment results
- Two-class models → Cutoff comparison: evaluates cutoffs
- Three-class models → Three-class cutoffs: evaluates cutoffs
- Two-class models → Validation split: compares validation
- Experiment results → Figure generation: loads metrics
src/visualization/figure_mpl.py - Processed datasets → Figure generation: loads datasets
src/visualization/figure_mpl.py - Figure generation → Figures and tables: creates figures