https://github.com/alan-turing-institute/airsenal
Machine learning Fantasy Premier League team
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
9 of 39 committers (23.1%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.6%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
Machine learning Fantasy Premier League team
Basic Info
Statistics
- Stars: 329
- Watchers: 23
- Forks: 95
- Open Issues: 106
- Releases: 21
Topics
Metadata Files
README.md
AIrsenal
AIrsenal is a package for using Machine learning to pick a Fantasy Premier League team.
Background and News
For some background information and details see https://www.turing.ac.uk/research/research-programmes/research-engineering/programme-articles/airsenal.
AIrsenal Details for 2025/26 season
We have made a mini-league "Prem-AI League" for players using this software. To join, login to the FPL website, and navigate to the page to join a league: https://fantasy.premierleague.com/leagues then click "Join a League". The code to join is: xoz7vm. Hope to see your AI team there!! :)
Our own AIrsenal team's ID for the 2025/26 season is 742663.
Installation
Installation from source [Recommended]
We recommend using uv for managing Python versions and dependencies. For instructions on how to install uv, go to: https://docs.astral.sh/uv/getting-started/installation/
With uv installed, run these commands in a terminal to download and install AIrsenal:
Linux and macOS
Windows
Docker
AIrsenal on PyPi [Work in Progress]
Optional dependencies
Running Python commands with uv
If using AIrsenal with uv you must either prepend uv run to all the AIrsenal commands below (e.g. uv run airsenal_setup_initial_db), or activate the virtual environment created by uv and then run them as normal. By default the virtual environment can be activated with source .venv/bin/activate.
Configuration
Once you've installed the module, you will need to set the following parameters:
Required:
FPL_TEAM_ID: the team ID for your FPL side.
Recommended:
FPL_LOGIN: your FPL login, usually email (this is required to get any changes made to your team since the last gameweek deadline).FPL_PASSWORD: your FPL password (this is required to get any changes made to your team since the last gameweek deadline).
Optional:
FPL_LEAGUE_ID: a league ID for FPL (this is only required for plotting FPL league standings).AIRSENAL_DB_FILE: Local path to where you would like to store the AIrsenal sqlite3 database. If not setAIRSENAL_HOME/data.dbwill be used by default.
The values for these should be defined either in environment variables with the names given above, or as files in AIRSENAL_HOME (a directory AIrsenal creates on your system to save config files and the database).
To view the location of AIRSENAL_HOME and the current values of all set AIrsenal environment variables run:
bash
airsenal_env get
Use airsenal_env set to set values and store them for future use. For example:
bash
airsenal_env set -k FPL_TEAM_ID -v 123456
See airsenal_env --help for other options.
Getting Started
Note: Most the commands below can be run with the --help flag to see additional options and information.
Run the Full AIrsenal Pipeline
The easiest way to run AIrsenal is to use the pipeline script:
shell
airsenal_run_pipeline
This will create or update the database, compute points predictions, and suggest transfers. Add --help to see the available options, by default predictions and transfers are calculated for the next 3 gameweeks.
Alternatively, you can run each step of AIrsenal independently, as follows:
1. Creating the database
Run the following command to create the AIrsenal database:
shell
airsenal_setup_initial_db
This will fill the database with data from the last 3 seasons, as well as all available fixtures and results for the current season.
2. Updating the database
Once the database has been created, you just need to update it each time before you run predictions or optimisations. This pulls all the latest data from the FPL API, such as recent match results, changes to fixtures, new players, and player injury/suspension statuses.
shell
airsenal_update_db
3. Running predictions
The next step is to predict the expected points for all players for the next fixtures. Player points predictions are computed using two models, a team-level model to predict match scorelines, and a player level model to predict player goal involvements, as well as several heuristics based on historical averages.
This is done using the command
shell
airsenal_run_prediction --weeks_ahead 3
Predicting the next 3 gameweeks of fixtures is the default but this can be configured with the argument above.
4. Transfer or Squad Optimization
Finally, we need to run the optimizer to pick the best transfer strategy over the next weeks (and hence the best team for the next week).
shell
airsenal_run_optimization --weeks_ahead 3
This will take a while, but should eventually provide a printout of the optimal transfer strategy, in addition to the teamsheet for the next match (including who to make captain, and the order of the substitutes). You can also optimise chip usage with the arguments --wildcard_week <GW>, --free_hit_week <GW>, --triple_captain_week <GW> and --bench_boost_week <GW>, replacing <GW> with the gameweek you want to play the chip (or use 0 to try playing the chip in all gameweeks).
Note that airsenal_run_optimization should only be used for transfer suggestions after the season has started. If it's before the season has started and you want to generate a full squad for gameweek one you should instead use:
shell
airsenal_make_squad --num_gameweeks 3
5. Apply Transfers and Lineup
To apply the transfers recommended by AIrsenal to your team on the FPL website run airsenal_make_transfers. This can't be undone! You can also use airsenal_set_lineup to set your starting lineup, captaincy choices, and substitute order to AIrsenal's recommendation (without making any transfers). Note that you must have created the FPL_LOGIN and FPL_PASSWORD files for these to work (as described in the "Configuration" section above).
⚠️ Also note that this command can't currently apply chips such as "free hit" or "wildcard", even if those were specified in the airsenal_run_optimization step. If you do want to use this command to apply the transfers anyway, you can play the chip at any time before the gameweek deadline via the FPL website.
Contributing
We welcome all types of contribution to AIrsenal, for example questions, documentation, bug fixes, new features and more. Please see our contributing guidelines. If you're contributing for the first time but not sure what to do a good place to start may be to look at our current issues, particularly any with the "Good first issue" tag. Also feel free to just say hello!
Issues and New Features
AIrsenal is regularly developed to fix bugs and add new features. If you have any problems during installation or usage please let us know by creating an issue (or have a look through existing issues to see if it's something we're already working on).
You may also like to try the development version of AIrsenal, which has the latest fixes and features. To do this checkout the develop branch of the repo and reinstall:
shell
git checkout develop
git pull
uv sync # or "pip install --force-reinstall ." if not using uv
If there have been database changes you may also need to run airsenal_setup_initial_db --clean after the above.
Development
If you're developing AIrsenal we further recommend using uv.
We also have a pre-commit config to run the code quality tools we use automatically when making commits. To setup the commit hooks run:
shell
pre-commit install --install-hooks
And tests can be run with
shell
pytest airsenal/tests
Owner
- Name: The Alan Turing Institute
- Login: alan-turing-institute
- Kind: organization
- Email: info@turing.ac.uk
- Website: https://turing.ac.uk
- Repositories: 477
- Profile: https://github.com/alan-turing-institute
The UK's national institute for data science and artificial intelligence.
GitHub Events
Total
- Create event: 14
- Release event: 2
- Issues event: 56
- Watch event: 26
- Delete event: 14
- Issue comment event: 109
- Push event: 66
- Pull request review event: 4
- Pull request review comment event: 3
- Pull request event: 31
- Fork event: 10
Last Year
- Create event: 14
- Release event: 2
- Issues event: 56
- Watch event: 26
- Delete event: 14
- Issue comment event: 109
- Push event: 66
- Pull request review event: 4
- Pull request review comment event: 3
- Pull request event: 31
- Fork event: 10
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Jack Roberts | j****s@t****k | 688 |
| nbarlowATI | n****w@t****k | 438 |
| anguswilliams91 | a****1@g****m | 60 |
| rchan | r****n@t****k | 57 |
| callummole | c****e@t****k | 42 |
| Dr Griffith Rees | g****s@g****m | 23 |
| Chahak Mehta | c****3@g****m | 22 |
| radka-j | r****a@g****m | 14 |
| Helen Duncan | h****n@t****k | 12 |
| dependabot[bot] | 4****] | 11 |
| Alfie Bowman | a****n@p****m | 10 |
| Abelarm | l****0@g****m | 10 |
| Matt Craddock | 5****m | 7 |
| chiefsan | s****1@g****m | 7 |
| tdarnell | t****s@d****k | 7 |
| Nicholas Barlow | n****w@N****n | 5 |
| Ian Sealy | g****t@i****m | 5 |
| Luke Hare | l****e@t****k | 5 |
| crangelsmith | c****h@t****k | 5 |
| Louise Bowler | L****r | 4 |
| Luigi | l****i@c****m | 4 |
| Chahak Mehta | c****3@g****m | 3 |
| georgewhewell | g****w@g****m | 3 |
| callistusndemo | c****o | 3 |
| Tarek Allam | t****r@g****m | 3 |
| Callistus Ndemo | c****i@n****u | 3 |
| Helen Duncan | 4****n | 2 |
| Oscar Giles | o****s@t****k | 2 |
| Robert Hickman | r****n@g****m | 2 |
| Tahmeed Tarek | t****k@g****m | 2 |
| and 9 more... | ||
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 122
- Total pull requests: 110
- Average time to close issues: about 1 year
- Average time to close pull requests: about 2 months
- Total issue authors: 52
- Total pull request authors: 18
- Average comments per issue: 2.34
- Average comments per pull request: 0.89
- Merged pull requests: 63
- Bot issues: 1
- Bot pull requests: 40
Past Year
- Issues: 30
- Pull requests: 23
- Average time to close issues: about 1 month
- Average time to close pull requests: 2 days
- Issue authors: 18
- Pull request authors: 6
- Average comments per issue: 1.83
- Average comments per pull request: 0.65
- Merged pull requests: 16
- Bot issues: 1
- Bot pull requests: 1
Top Authors
Issue Authors
- jack89roberts (27)
- mildfuzz (8)
- rohanday3 (7)
- RajeshTailor1 (7)
- nbarlowATI (5)
- markajam (4)
- sam-cutter (4)
- pentatonicfunk (3)
- Zonkil9 (3)
- griff-rees (3)
- rchan26 (3)
- negmeme2001 (3)
- lukehare (2)
- Tdarnell (2)
- SeamusBradbury (2)
Pull Request Authors
- dependabot[bot] (40)
- jack89roberts (35)
- nbarlowATI (8)
- rchan26 (6)
- crangelsmith (4)
- radka-j (2)
- helendduncan (2)
- craddm (2)
- negmeme2001 (2)
- lukehare (1)
- iansealy (1)
- ppapadatis (1)
- vishnuprksh (1)
- whrit (1)
- chahak13 (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- 134 dependencies
- actions/checkout v2 composite
- actions/setup-python v2 composite
- python 3.8-slim-buster build
- actions/checkout main composite