DEV Community

Cover image for How machine learning made me win more on League of Legends
Lan
Lan

Posted on • Edited on

How machine learning made me win more on League of Legends

I surely don't know you, but I'm sure either of these statements is true: you have either played League of Legends before, or you know at least someone who did. That's fact.

The multiplayer online battle arena(MOBA) game has become a fever over the last decade, having reached in 2021 a simultaneous player count record of 11 million players. Since I'm a nerd myself, until last year I used to also be a regular player, just like that one person you know or are.

This year, searching through Kaggle to find cool data that I could work on a data science project, I stumbled upon a dataset that contains information about the first 10 minutes, the early game, of several diamond-tier matches. After looking through the data for a while, I asked myself the question: how well can I predict which team is going to win?

Also, it is of general knowledge in the data science field that, if your model is a good predictor of something, that means it can also tell you which features of your data were more helpful to the prediction(that's called explainability in AI). So, going back to our data: if our model is a good predictor of which team is going to win, it is also a good method to know which game features you should focus more on improving to win more matches and climb up the rank.

For this analysis, I tried a few ML tree models, and ended up with xgboost, which performed the best with a 75% accuracy on test data.

If you wish to go into more technical detail than that, check out the notebook. From now on I will only be showing results.


So, what can we learn from early game?

A plot of feature importance for our model:

Important: Diff On the variable names stands for (BlueTeam - RedTeam) of that quantity.

Alt Text

1 - Gold is what matters.

As seen on the feature importance graph, gold difference is by far the most important variable for our model. The fact that Exp difference is the second most important, probably means that farming is one of the most efficient ways to earn gold(also, it gives you more experience at a lower risk). That probably means you should be paying more attention to farming and lane phase than getting kills.


2 - Don't forget elite monsters.

On the 3rd and 5th position, we have elite monsters, so don't underestimate them. These buffs really can change the outcome of a match.


3 - Blocking vision is just as valuable as setting vision.

A surprising fact is that destroying wards is just as important as placing it. Leaving the enemy team blind is just as important as giving your team vision.


4 - Assists matter.

That doesn't mean that an assist by itself is that relevant to gold difference, but the meaning behind it: play with your team. Teams that are united usually get more kills, map pressure and objectives.


5 - Sacrificing yourself for an elite monster is not always worth it.

Elite monsters are important and can give you huge map pressure, but if that means having your entire team killed for it, maybe it's not that worth it. Play smart.


6 - Early game matters more than you think.

A model with data only from the 10 minutes of a match can predict it's outcome with a 75% accuracy, what does it tell you? The pace and attitude that you set at the beginning, most times, can be the difference between a victory or defeat.


Final considerations

Considering all the lack of information, I think our model performed great, as it correctly guessed the outcome of ~75% matches only looking at a reduced amount of early game data.

Top comments (4)

Collapse
 
kempsteven profile image
Kemp Steven

Thanks I will now play League instead of programming lol

Collapse
 
allands profile image
Lan

go for it hahahah

Collapse
 
juanfrank77 profile image
Juan F Gonzalez

Interesting, this would have helped me climb all the way to Diamond on the NA server. Unfortunately ML back in 2015-2016 wasn't even a thing.

Collapse
 
allands profile image
Lan

It is interesting how simple and yet helpful that conclusion was for me. It is not like we haven't heard it before, but the algorithm convinces you lol