A machine learning-based draft pick assistant for League of Legends, trained to suggest optimal champion picks and roles based on professional play data.
- Predicts optimal champions and roles using AI
- Trained on historical LCK draft data under a Transformer Model
- Modular architecture: scraping, preprocessing, training
- Easily extendable for new patches or metas
Install dependencies with:
pip install -r requirements.txtYou can run this project fully in the cloud using Google Colab — no local installation needed.
Open Colab to get started immediately.
-
Clone the Repository
git clone https://github.com/AsperaDesu/LoL-AI-Draft-Picker.git cd LoL-AI-Draft-Picker -
Run data_scraper.py You may modify the URL variable to have a dataset of a different tournament.
import json from tqdm import tqdm URL = "https://lol.fandom.com/wiki/Special:RunQuery/PickBanHistory?PBH%5Bpage%5D=LCK+2024+Summer&PBH%5Btextonly%5D=Yes&_run=" HEADERS = {"User-Agent": "Mozilla/5.0"}
-
Output
A new
.jsonfile will be created in thedata/folder. It contains scraped pick and ban data. -
Train the Model
Run every cell in training.ipynb to start training the model.
If you don't want to retrain the model from scratch, you can use the pre-trained weights provided:
-
In training.ipynb, skip the training cell and run the very bottom cell:
model.load_state_dict(torch.load('model_weights.pth')) model.eval()
This skips the training process and lets you instantly run inference.
This is a project created to test my knowledge from Andrej Karpathy's NN Playlist. Noticably, the implementation of Self Attention and Transformer in this project is majorly inspired from what he had covered.
-
Input Masking Inspired from how Transformers are masked where inputs are only known until the
N-th element. -
Winner Emb The usage of
winner_embis to encourage the model to optimize towards the winning draft and less to the losing one. -
Class Emb To make the model understand the composition of the team.
- Contains special token
START
- Contains special token
-
Position Emb To distinguish first pick, last pick and anything in between
-
Type Emb Differentiates Pick and Ban
- Contains special token
START
- Contains special token
-
Score Linear Projection To estimate a score to measure how "optimal" a champion is on that current patch and pass it down to a projection layer.
-
Team Emb Blue versus Red Team's turn is different so we factor that in to the input
- Contains special token
START
- Contains special token
-
Champ Emb Every champ has different skillset, counter, and countered by.
- Contains special token
<start>
- Contains special token
-
Joint Logits Stores logits with the last two shape of (champ_vocab, ROLES) so the model's output contains how synergeous a champion is to all possible roles.
-
Champ and Role Loss While not used/returned during forward function, it is used to help guide the model effectively.
-
Top K Sampling during Simulation Due to concerns that the set of champions that are appropriate to pick/ban combined don't have a high enough probability to make it consistent, we only sample the 20 highest logits.
import matplotlib.pyplot as plt
lossi = torch.tensor(lossi)
loss_50 = lossi.view(-1, 50)
loss_50_mean = loss_50.mean(dim=1)
plt.figure(figsize=(10, 6))
plt.plot(loss_50_mean)- Add full flex-pick role probability modeling
- Model can reevaluate roles after a flex pick
- Deploy as a public web app or Discord bot
- Closer attention to Trio ([Top, Mid, Jungle], [Bot, Support, Jungle]) and Duo (Bot and Support) synergies
This project is licensed under the MIT License.
Made by @AsperaDesu — mind behind the project
