DEV Community

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

Posted on

How machine learning made me win more on League of Legends

You have either played league of legends before, or you know at least one person who did: that's a fact. The game has become a fever over the last few years, and until last year I used to be a regular player, just like that one person you know.

This year, I found this dataset that has information about the first 10 minutes of matches, and I thought to myself: how well can I predict with data science which team is going to win? And if so, what are the most important features of the dataset? I'm sure that could represent some valuable information, at least for new players.

For this analysis, I implemented a few ML tree models. The metric I used is accuracy, and the model that performed the best was xgboost, with 75% accuracy.

If you want more details on decisions about every step, check out the notebook. I will only be showing the results here.

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

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.

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.

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.

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.

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.

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.

Discussion (6)

kempsteven profile image
Kemp Steven

Thanks I will now play League instead of programming lol

allands profile image
Lan Author

go for it hahahah

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.

allands profile image
Lan Author

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