Skip to main content

Fantasy Premier League Team Optimizer - Win at FPL with lazines

Project description

Fantasy Premier League Team Optimizer - Win at FPL with Laziness

This Python project, "Fantasy Premier League Team Optimizer", employs data-driven methods for analyzing and optimizing Fantasy Premier League (FPL) team selections. It is an essential tool for FPL players who wish to leverage statistical models and optimization algorithms for a competitive advantage.

Why Model Training is Essential

In this application, training a machine learning model is critical as it allows for nuanced understanding and prediction of FPL player performances. By analyzing historical data, the model identifies patterns and trends, offering forecasts about future player performances. These predictions are invaluable for strategic team selection and transfer decisions, providing users with a significant edge in the game.

Modules Overview

backevel

The backevel module is designed to validate the accuracy of the model's predictions against real-world player performances. It serves as a critical tool for assessing the model's effectiveness, enabling users to understand and improve the predictive capability of the system. This module is especially useful for refining the model's algorithms to enhance its future forecasting accuracy.

conf

The conf module is where users can customize the application's settings and parameters. This flexibility allows for personalization according to individual strategies and preferences. It's crucial for users who want to adapt the application's functionality to their unique play style or specific requirements in the FPL.

ml_model

The ml_model module is at the core of the application. It uses machine learning algorithms to analyze historical data and predict future player performances. This predictive capability is what makes the application so powerful for FPL players, offering insights that can inform strategic decisions for team selections and transfers.

optimizer

The optimizer module combines the insights from the ml_model with the constraints defined by the user to suggest the best possible team setups. It is a sophisticated tool that leverages both data-driven predictions and user-defined strategies to maximize the performance of an FPL team.

populator

The populator module is responsible for filling the database with data from external sources. This module ensures that the database has comprehensive and up-to-date information, which is crucial for the accuracy of the model's predictions and the effectiveness of the optimizer.

transfer

In the transfer module, users receive guidance on managing player transfers, influenced by the model's predictions and optimization algorithms. This module helps users make informed decisions about player transfers, combining data-driven insights with strategic planning for improved team performance.

Command Line Interface (CLI) Usage

This application features a CLI, implemented via argparse, for straightforward interaction and execution. Below are command examples for key operations:

# Builds local player database.
python3 -m lazyfpl.populator

# Train ml-model (used to estimate expected points per player).
python3 -m lazyfpl.ml_model

# Backeval the model (optional).
python3 -m lazyfpl.backevel

# Optimize team selection based on various criteria.
python3 -m lazyfpl.optimizer --no-news --min-mtm 60

optimizer

Summary of lazyfpl.optimizer Command Output

The lazyfpl.optimizer command, with the parameters --no-news --min-mtm 60 --include Salah Haaland Alexander-Arnold, generated several team combinations for the Fantasy Premier League, focusing on optimizing the team with specific constraints and player inclusions.

  • Key Players Included: The optimization specifically included Mohamed Salah, Erling Haaland, and Trent Alexander-Arnold, key players known for their high impact in FPL.
  • Player Analysis: The output provided detailed analytics on various players, including expected points (xP), price, total points (TP), and upcoming matches. Notably, Erling Haaland was mentioned with a foot injury and a 50% chance of playing.
  • Team Statistics: The command calculated different metrics like 'Price', 'Size', 'LxP' (Likely points), 'SxP' (Scheduled points), and 'CxP' (Combined points), providing a comprehensive overview of the team's potential performance.
  • Optimization Results: The optimizer assessed numerous combinations of goalkeepers, defenders, midfielders, and forwards, totaling an astronomical number of potential team setups (in the range of 4.4e+15).
  • Team Performance Scores: The summary includes schedule scores, team scores, and total scores (TSscore), indicating the balance between the team's schedule, individual player performance, and overall team synergy.

This summary provides a snapshot of the optimizer's output, showcasing its capabilities in assessing player performances, predicting future outputs, and suggesting optimal team configurations based on the given parameters

Price: 99.4 Size: 15
LxP: 215.2 SxP: 277.7 CxP: 351.3
Schedule score: 15 Team score: 14 TSscore: 20.52
BIS  xP     Price  TP   UD       Team            Position  Player               Upcoming                              News
X    20.9   57.0   65   -0.2     Wolves          FWD       Cunha                Chelsea - Brentford - Everton 
X    19.7   76.0   58   0.6      Newcastle       FWD       Isak                 Luton - Nott'm Forest - Liverpool 
X    17.5   139.0  112  0.9      Man City        FWD       Haaland              Everton - Sheffield Utd - Newcastle Foot injury - 50% chance of playing
X    18.4   49.0   36   -0.2     Fulham          MID       Cairney              Burnley - Bournemouth - Arsenal 
X    16.9   76.0   71   0.9      Man City        MID       Foden                Everton - Sheffield Utd - Newcastle 
     16.1   132.0  127  0.1      Liverpool       MID       Salah                Arsenal - Burnley - Newcastle 
     15.8   57.0   50   -0.5     Nott'm Forest   MID       Gibbs-White          Bournemouth - Newcastle - Man Utd 
     14.7   50.0   42   -0.2     Fulham          MID       J.Palhinha           Burnley - Bournemouth - Arsenal 
X    31.1   43.0   22   -0.2     Fulham          DEF       Tosin                Burnley - Bournemouth - Arsenal 
X    20.6   44.0   45   -0.1     Bournemouth     DEF       Senesi               Nott'm Forest - Fulham - Spurs 
X    18.2   82.0   75   0.1      Liverpool       DEF       Alexander-Arnold     Arsenal - Burnley - Newcastle 
X    17.9   44.0   38   -0.5     Nott'm Forest   DEF       Toffolo              Bournemouth - Newcastle - Man Utd 
X    17.9   44.0   23   0.2      Aston Villa     DEF       Diego Carlos         Sheffield Utd - Man Utd - Burnley 
X    16.1   46.0   57   -0.1     Bournemouth     GKP       Neto                 Nott'm Forest - Fulham - Spurs 
     15.9   55.0   46   0.9      Man City        GKP       Ederson M.           Everton - Sheffield Utd - Newcastle 

Price: 99.7 Size: 15
LxP: 215.2 SxP: 278.0 CxP: 351.6
Schedule score: 15 Team score: 14 TSscore: 20.52
BIS  xP     Price  TP   UD       Team            Position  Player               Upcoming                              News
X    20.9   57.0   65   -0.2     Wolves          FWD       Cunha                Chelsea - Brentford - Everton 
X    19.7   76.0   58   0.6      Newcastle       FWD       Isak                 Luton - Nott'm Forest - Liverpool 
X    17.5   139.0  112  0.9      Man City        FWD       Haaland              Everton - Sheffield Utd - Newcastle Foot injury - 50% chance of playing
X    18.4   49.0   36   -0.2     Fulham          MID       Cairney              Burnley - Bournemouth - Arsenal 
X    16.9   76.0   71   0.9      Man City        MID       Foden                Everton - Sheffield Utd - Newcastle 
     16.1   132.0  127  0.1      Liverpool       MID       Salah                Arsenal - Burnley - Newcastle 
     15.8   57.0   50   -0.5     Nott'm Forest   MID       Gibbs-White          Bournemouth - Newcastle - Man Utd 
     15.0   53.0   59   -0.2     Fulham          MID       Andreas              Burnley - Bournemouth - Arsenal 
X    31.1   43.0   22   -0.2     Fulham          DEF       Tosin                Burnley - Bournemouth - Arsenal 
X    20.6   44.0   45   -0.1     Bournemouth     DEF       Senesi               Nott'm Forest - Fulham - Spurs 
X    18.2   82.0   75   0.1      Liverpool       DEF       Alexander-Arnold     Arsenal - Burnley - Newcastle 
X    17.9   44.0   38   -0.5     Nott'm Forest   DEF       Toffolo              Bournemouth - Newcastle - Man Utd 
X    17.9   44.0   23   0.2      Aston Villa     DEF       Diego Carlos         Sheffield Utd - Man Utd - Burnley 
X    16.1   46.0   57   -0.1     Bournemouth     GKP       Neto                 Nott'm Forest - Fulham - Spurs 
     15.9   55.0   46   0.9      Man City        GKP       Ederson M.           Everton - Sheffield Utd - Newcastle 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lazyfpl-0.0.3.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lazyfpl-0.0.3-py3-none-any.whl (25.2 kB view details)

Uploaded Python 3

File details

Details for the file lazyfpl-0.0.3.tar.gz.

File metadata

  • Download URL: lazyfpl-0.0.3.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.6 Darwin/23.2.0

File hashes

Hashes for lazyfpl-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e16dc3b74dfaa43e77cb314c6b136d32e860565a78285a2cf4c669740568300b
MD5 09acceb120df6c5eb133732e4d74dbad
BLAKE2b-256 159259f2e59dd62901ea174d56783fc356d3c347a2457e8bfd4171707190aefb

See more details on using hashes here.

File details

Details for the file lazyfpl-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: lazyfpl-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 25.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.6 Darwin/23.2.0

File hashes

Hashes for lazyfpl-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2eecd9ed98a20bc25463a99d413b7c0d25728982033112231dca332b1c2987ad
MD5 a99d7a6c06a7877bf38d73864ccd4e1e
BLAKE2b-256 4b3ebcecc32fa2aa87fa15c2a70e79640a834f9a586554f108e85a7e4203059a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page