Status: 🚧 Under Active Development - Many features are experimental and subject to change
A comprehensive ML-powered analytics and optimization platform for Kickbase fantasy football. Leverages machine learning, mathematical optimization, and real-time data analysis to provide competitive insights and automated lineup recommendations.
This project provides end-to-end analytics for the Kickbase fantasy football platform, combining:
- Machine Learning: Multi-stage ensemble models for player performance prediction
- Mathematical Optimization: Mixed-Integer Programming (MIP) for optimal lineup selection
- Real-time Analytics: Live market analysis, player valuations, and competitive intelligence
- Full-Stack Web Application: Interactive dashboard built with React and FastAPI
Kickbase is a fantasy football game focused on the German Bundesliga, where managers build squads, trade players on a real-time market, and compete for the highest weekly points.
- Two-stage prediction pipeline:
- Stage 1: Binary classification (will the player play?)
- Stage 2: Position-specific regression models (how many points?)
- Mixed-Integer Linear Programming (MILP) using PuLP
- Optimizes starting XI selection considering:
- Predicted player points
- Budget constraints per manager
- Formation requirements (GK, DEF, MID, FWD)
- Transfer market availability
- Injury probabilities
- Real-time integration with Kickbase API
- Drag-and-drop interface for manual adjustments
- Visual formation display
- Live player statistics
- Quick comparison tools
- Matchup Analyzer: Identifies teams that concede most points to specific positions
- Player Scouting: Discovers undervalued players within budget constraints
- Value Ratings: Calculates over/undervalued players using points-per-euro metrics
- Form Comparison: Visual comparison of recent player performance
- Performance Radar Charts: Multi-dimensional player analysis
- Schedule Strength Analysis: Fixture difficulty forecasting
- Python 3.13
- Jupyter Notebooks - Exploratory analysis and model development
- Pandas & NumPy - Data manipulation and numerical computing
- Scikit-learn - Feature engineering, preprocessing, evaluation
- XGBoost, LightGBM - Gradient boosting models
- FLAML - Fast AutoML for hyperparameter tuning
- AutoGluon - Automated ensemble learning (experimental)
- PuLP - Linear programming for lineup optimization
- Mixed-Integer Programming (MIP) - Constraint-based optimal selection
- FastAPI - Modern async API framework
- Uvicorn - ASGI server
- Pydantic - Data validation and settings management
- Redis - Caching layer for API responses
- Kickbase API - Unofficial API client (reverse-engineered)
- React 18 - UI framework
- Vite - Build tool and dev server
- TailwindCSS - Utility-first styling
- React Router - Client-side routing
- TanStack Query (React Query) - Server state management
- Axios - HTTP client
- Recharts - Data visualization
- Docker & Docker Compose - Containerization
- Nginx - Reverse proxy and load balancing
- Redis - Data caching and session management
- Git - Version control
- Jupyter Lab - Interactive development environment
- ESLint & Prettier - Code quality and formatting
kickbase/
│
├── api/ # API documentation & testing
│ ├── Kickbase-API/ # Reverse-engineered API docs
│ └── api_test.ipynb # API endpoint exploration
│
├── machine_learning_models/ # ML model development
│ ├── auto_ml_player_point_prediction.ipynb # AutoML experiments
│ ├── player_point_prediction.ipynb # Production model training
│ ├── prepare_and_train_models.py # Model training pipeline
│ └── export_models_simple.py # Model export utilities
│
├── simple_starting_optimizer/ # Early optimization prototypes
│ ├── starting11_optimizer.ipynb # MILP lineup optimizer
│ └── index.html # Visualization demo
│
├── web-app/ # Full-stack application
│ ├── frontend/ # React application
│ │ ├── src/
│ │ │ ├── components/ # Reusable UI components
│ │ │ ├── pages/ # Page-level components
│ │ │ ├── services/ # API integration
│ │ │ └── contexts/ # React context providers
│ │ ├── Dockerfile
│ │ └── package.json
│ │
│ ├── backend/ # FastAPI application
│ │ ├── app/
│ │ │ ├── api/ # API route handlers
│ │ │ ├── services/ # Business logic
│ │ │ ├── ml_models/ # Model inference
│ │ │ └── main.py # Application entry point
│ │ ├── Dockerfile
│ │ └── requirements.txt
│ │
│ ├── nginx/ # Reverse proxy configuration
│ │ ├── Dockerfile
│ │ └── nginx.conf
│ │
│ ├── docker-compose.yml # Production orchestration
│ ├── docker-compose.dev.yml # Development setup
│ └── README.md # Detailed web-app docs
│
├── Kickbase-Trading-Advisor/ # Trading bot (experimental)
│ ├── kickbase_api/ # Python API client
│ ├── features/ # Trading features
│ └── daily_predictions.py # Automated predictions
│
├── data/ # Data storage (gitignored)
│ ├── raw_player_data.pkl # Historical player data
│ ├── matches_all.csv # Match history
│ └── matches_played.csv # Completed matches
│
├── models/ # Trained models (gitignored)
│
├── images/ # Screenshots and documentation
│
├── .gitignore # Git ignore rules
└── README.md # This file
- Docker (v20.10+) and Docker Compose (v2.0+)
- Python 3.13+ (for local development)
- Node.js 18+ (for frontend development)
- Kickbase account (for API access)
-
Clone the repository:
git clone https://github.com/yourusername/kickbase.git cd kickbase -
Set up environment variables:
cd web-app cp .env.example .env # Edit .env with your configuration
-
Build and run all services:
docker-compose up -d --build
-
Access the application:
- Web App: http://localhost
- API Docs: http://localhost:8000/docs
- Backend API: http://localhost:8000
See web-app/README.md for detailed development setup instructions.
-
Set up Python environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate pip install -r requirements.txt
-
Launch Jupyter Lab:
jupyter lab
-
Open notebooks:
machine_learning_models/player_point_prediction.ipynbsimple_starting_optimizer/starting11_optimizer.ipynb
- Model Versioning & Registry: Implement MLflow or Weights & Biases
- Automated Retraining Pipeline: Schedule weekly model updates with new match data
- A/B Testing Framework: Compare model performance across different approaches
- Model Monitoring: Track prediction accuracy and data drift
- Feature Store: Centralized feature computation and storage
- Database Integration: Migrate from pickle files to PostgreSQL or MongoDB
- Player historical data
- Match statistics
- Market transactions
- User predictions and results
- Data Pipeline: Automated ETL for Kickbase API
- Scheduled data collection (daily)
- Data validation and quality checks
- Incremental updates
- Data Versioning: DVC or similar for dataset version control
- Multi-stage Docker builds: Reduce image sizes
- Health checks & monitoring: Proper container health monitoring
- CI/CD Pipeline: GitHub Actions for automated testing and deployment
- Production deployment: Kubernetes or AWS ECS configuration
- Secrets management: Proper handling of API keys and credentials
- Deep Learning Models: Experiment with LSTM/Transformer architectures
- Transfer Learning: Leverage models trained on similar sports data
- Explainable AI: SHAP values for feature importance
- Injury Prediction: ML model for injury risk assessment
- Market Value Prediction: Forecast player price changes
- User Authentication: Multi-user support with saved preferences
- Historical Performance Tracking: Track prediction accuracy over time
- Mobile Responsiveness: Optimize for mobile devices
- Real-time Notifications: Alerts for market opportunities
- Social Features: League comparison and sharing
- Automated Trading: Execute trades based on model predictions
- Risk Management: Portfolio optimization and diversification
- Backtesting Framework: Validate trading strategies on historical data
- Community-driven model ensemble
- Integration with sports betting APIs
- Fantasy draft mode optimizer
- Chrome extension for Kickbase website




