Graph Networks for Champion Recommendation (League of Legends)

The answer is dependent.

Yes, if you are looking for a Champion in your preferred lane, no otherwise.

Why is this?Let’s say you were an ADC main, you can assume your Top 3 Champions will be grouped somewhere around the orange section that is highlighted in black.

If we used this Graph to recommend a Champion, it’s pretty much certain that it will only recommend a small selection of Mid laners that are closest to the ADC grouping (Marked in blue).

This isn’t a tailored recommendation.

Rather than taking your particular playstyle from your unique ADC Champions, it simply defaults you to a generic ADC player and assumes you like exactly the same as all other ADCs.

To improve this, we need to return to data gathering.

Data Gathering 2This time around, we are approaching the task differently.

Instead of finding each players Top 5 Champions, we will find each players Top 3 Champions per lane.

This means that for each Champion, we will also have common connections to every lane.

The loop code is rather long so I won’t include it here.

In the end, we are left with a matrix that takes each Champion, and connects it to the top 3 Champions in each lane (15 connections in total).

As well as this, these Edges will now also be weighted by their average Champion mastery as a percentage of that lane.

Example: If you are an ADC main who plays Thresh (80k mastery), Blitzcrank (10k mastery) and Pyke (10k mastery) in Support.

Then Thresh will be given 80%, Blitz 10% and Pyke 10%.

This is inversed and calculated as: Edge A to B Weight = 1 — (Champ B Mastery Points / Total Champ Mastery Points).

This way, the higher the percentage of the players mastery in a lane is on the champion — the lower the edge weighting (also known as the distance between nodes).

Graph Network 2Now we have a new approach to the Graph Network, we can re-create the graph using the same code.

This is far more complex than the previous.

There are a multitude of connections between nodes, and the weighting determines the distance between them.

Although not visually pleasing, it now should offer a stronger recommendation.

Recommendation EngineThe final part is to create the engine.

For this, we return to the Riot API.

By inserting our own Summoner name and Region we can call a list of our most played Champions.

We take our Mains and use Dijkstra’s Algorithm to determine the length from our Champions to every other Champion.

We remove any Champions we already play regularly, group them by lane and voila —we will find the closest Champions to the ones we already play.

Example: I am an AP Mid main, mostly playing Battle Mages such as Vel’Koz and Lux.

My Top lane recommendation was Teemo, my Mid lane was Cassiopeia and my Support was Morgana.

This makes sense, we would have probably arrived here using the simple approach outlined at the beginning of this article.

However, for ADC I was recommended Jhin — and this I cannot explain.

I have never played Jhin, but those who share my love of Battle Mages also seem to enjoy Jhin when they play ADC.

To quote the Virtuoso himself, my audience awaits!For your own recommendations, click here.

ConclusionThank you for reading to the end of the article.

I hope this provided some enlightenment on how Graph Networks can be used in Recommendation Engines.

I may eventually post the full code onto the GitHub, but not until I’m more proud of how it is written.

I plan to post this to Reddit shortly, and I will include the link when I have done so, please feel free to leave your feedback & comments here, or there.

.. More details

Leave a Reply