How areebfazli/football_prediction works
Project type and purpose
• This is a lightweight machine‐learning prediction service, implemented in Python, that provides REST API endpoints (via app.py) to predict goals and assists using two linear models and two deep‐learning models.
• It also contains Jupyter notebooks under models/ for offline training and experimentation.
File structure
• Top level
– .devcontainer/ : developer environment settings (VS Code Remote‐Container)
– app.py : main Flask/FastAPI (or similar) entry point for serving predictions
– requirements.txt : Python dependencies (e.g., Flask/FastAPI, scikit-learn, tensorflow/keras)
• models/
– app.py : utility module to load models, scalers, and run inference
– fnn_*.ipynb, lr_*.ipynb : Jupyter notebooks for training various models
– saved_model/ : serialized artifacts for each model variant
· col_order.pkl, scaler_X.pkl, scaler_y.pkl, weights.npy, fnn_model.keras
• No external database is pictured—models and preprocessing objects are stored on disk.
README
• Confirms exactly four predictive models (2 linear, 2 DNN) for goals and assists.
• No mention of persistence layers beyond file storage or external APIs.
Main components and their interactions
a. Client Layer
– HTTP client (e.g., CURL, frontend UI, Postman) sends prediction requests
b. API/Inference Service
– app.py (Flask/FastAPI)
• Receives request → parses input JSON features
• Calls model‐loader utilities in models/app.py
c. Preprocessing & Model Loader
– models/app.py
• Loads col_order and scaler_X, scaler_y from saved_model/*
• Applies feature ordering and scaling
d. Model Inference
– Four model artifacts (linear_gradient_descent, linear_normal_equation, fnn_basic, fnn_tuned)
• Each implements a predict() interface
• Output predictions of goals and assists
e. Response Layer
– Inference service assembles model outputs and returns JSON to client
– Jupyter notebooks under models/
• Read raw data (e.g., goals_predict.csv) → train/test splits → fit models → serialize artifacts to models/saved_model
Architectural patterns & design principles
• Separation of concerns:
– API layer vs. preprocessing vs. model definitions vs. training notebooks
• Stateless inference service:
– All model state is loaded on startup or per‐request from file system
• Modular model artifacts:
– Each algorithm variant lives in its own subfolder under saved_model/
• Reproducible dev environment via .devcontainer