How marvin3742/ufc-prediction-modeling works
UFC Predictions is a terminal app whose main workflow is fighter matchup input, historical-stat feature construction, model inference, and a winner/confidence result recorded for later review or deletion. The repository also contains parallel UFC Stats scraping and data-preparation paths, plus prebuilt models and datasets. The app excerpt is partial, so links to model/data selection and inference rely on the README’s documented behavior; scraper output and its schema are visible, but downstream ingestion is not established by the excerpts.
Main entry points: app.py Prediction CLI · utils.py Scrape parsing · ufc_crawler.py Unified crawler · cleaned_fights.csv Cleaned tables
Components 25
Prediction app
- Prediction CLI
app.py - Match features
app.py - Prediction history
app.py - Model training
training/baseline.ipynb
Data preparation
- HTML scraper
data_bs4/scripts/webscraper.py - BS4 cleaning
data_bs4/scripts/clean_fighter_data.py - Raw sorting
data/scripts/sort_raw.py - Fighter sorting
data/scripts/sort_fighters.py - Prepared datasets
data_bs4/datasets/v1.csv - Cleaned tables
data/cleaned/cleaned_fights.csv - Database loader
sql/write_to_db.py - Database schema
sql/create_ufc_db.sql
UFC Stats scraping
- Unified crawler
data/ufc_scraper/ufc_scraper/spiders/ufc_crawler.py - Fighter crawler
data/ufc_scraper/ufc_scraper/spiders/fighter_crawler.py - Fight crawler
data/ufc_scraper/ufc_scraper/spiders/fight_crawler.py - Round crawler
data/ufc_scraper/ufc_scraper/spiders/round_crawler.py - Scrape parsing
data/ufc_scraper/ufc_scraper/utils.py - Scraped records
data/ufc_scraper/ufc_scraper/items.py
Prediction artifacts
- Model files
models/knn_v1.joblib - Feature scaler
scalers/scaler_v1.joblib - Logistic model
models/log_reg_v1.joblib
Other components
- Terminal user
- UFC Stats
- PostgreSQL
- Prediction log
Connections 28
- Terminal user → Prediction CLI: enters matchup
README.md - Prediction CLI → Match features: builds features
app.py - Prediction CLI → Model files: selects model
README.md - Prediction CLI → Logistic model: supports models
README.md - Prediction CLI → Prepared datasets: selects dataset
README.md - Match features → Prediction CLI: feeds prediction
README.md - Prediction CLI → Prediction history: records result
app.py - Prediction history → Prediction log: writes JSON
app.py - Prediction CLI → Terminal user: shows confidence
README.md - Model training → Model files: trains models
- Unified crawler → UFC Stats: requests pages
data/ufc_scraper/ufc_scraper/spiders/ufc_crawler.py - Unified crawler → Scraped records: yields records
data/ufc_scraper/ufc_scraper/spiders/ufc_crawler.py - Unified crawler → Scrape parsing: uses parsing
data/ufc_scraper/ufc_scraper/spiders/ufc_crawler.py - Fighter crawler → UFC Stats: requests pages
data/ufc_scraper/ufc_scraper/spiders/fighter_crawler.py - Fighter crawler → Scrape parsing: uses parsing
data/ufc_scraper/ufc_scraper/spiders/fighter_crawler.py - Fight crawler → UFC Stats: requests pages
data/ufc_scraper/ufc_scraper/spiders/fight_crawler.py - Fight crawler → Scrape parsing: uses parsing
data/ufc_scraper/ufc_scraper/spiders/fight_crawler.py - Round crawler → UFC Stats: requests pages
data/ufc_scraper/ufc_scraper/spiders/round_crawler.py - Round crawler → Scrape parsing: uses parsing
data/ufc_scraper/ufc_scraper/spiders/round_crawler.py - HTML scraper → UFC Stats: scrapes stats
README.md - HTML scraper → BS4 cleaning: provides raw data
- BS4 cleaning → Prepared datasets: prepares data
- Raw sorting → Cleaned tables: sorts records
- Fighter sorting → Cleaned tables: sorts fighters
- Database loader → Cleaned tables: reads CSVs
sql/write_to_db.py - Database loader → PostgreSQL: inserts rows
sql/write_to_db.py - Database schema → PostgreSQL: defines tables
- Prediction CLI → Feature scaler: uses scaling