Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kickbase Analytics & Optimization Platform

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.

Dashboard


Overview

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

What is Kickbase?

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.


Key Features

1. Advanced ML Player Point Prediction

ML Predictions

  • Two-stage prediction pipeline:
    • Stage 1: Binary classification (will the player play?)
    • Stage 2: Position-specific regression models (how many points?)

2. Mathematical Lineup Optimization

MILP Optimizer

  • 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

3. Interactive Lineup Management

Lineup Builder

  • Drag-and-drop interface for manual adjustments
  • Visual formation display
  • Live player statistics
  • Quick comparison tools

4. Comprehensive Analytics Suite

Analytics 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

Technology Stack

Machine Learning & Data Science

  • 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)

Optimization

  • PuLP - Linear programming for lineup optimization
  • Mixed-Integer Programming (MIP) - Constraint-based optimal selection

Backend

  • 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)

Frontend

  • 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

Infrastructure

  • Docker & Docker Compose - Containerization
  • Nginx - Reverse proxy and load balancing
  • Redis - Data caching and session management

Development Tools

  • Git - Version control
  • Jupyter Lab - Interactive development environment
  • ESLint & Prettier - Code quality and formatting

Project Structure

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

Getting Started

Prerequisites

  • 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)

Quick Start with Docker

  1. Clone the repository:

    git clone https://github.com/yourusername/kickbase.git
    cd kickbase
  2. Set up environment variables:

    cd web-app
    cp .env.example .env
    # Edit .env with your configuration
  3. Build and run all services:

    docker-compose up -d --build
  4. Access the application:

Local Development Setup

See web-app/README.md for detailed development setup instructions.

Running ML Experiments

  1. Set up Python environment:

    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    pip install -r requirements.txt
  2. Launch Jupyter Lab:

    jupyter lab
  3. Open notebooks:

    • machine_learning_models/player_point_prediction.ipynb
    • simple_starting_optimizer/starting11_optimizer.ipynb

Roadmap & Development Focus

Current Development Priorities

1. Production-Grade ML Pipeline (MLOps)

  • 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

2. Data Infrastructure & Persistence

  • 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

3. Docker & Deployment Improvements

  • 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

4. Advanced ML Features

  • 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

5. Web Application Enhancements

  • 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

6. Trading Bot Automation

  • Automated Trading: Execute trades based on model predictions
  • Risk Management: Portfolio optimization and diversification
  • Backtesting Framework: Validate trading strategies on historical data

Future Ideas

  • Community-driven model ensemble
  • Integration with sports betting APIs
  • Fantasy draft mode optimizer
  • Chrome extension for Kickbase website

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages