What’s the Best Pokémon Type? The Power of Metrics (2024)

What’s the Best Pokémon Type? The Power of Metrics (3)

We all know what the best type is (It’s Psychic. Prove me wrong.), but what does the data say?

Sometimes, Data Science is about making hard choices, or earning a company tons of money. Other times though, Data Science can just be a fun hobby in a rainy weekend.

This week I’ve been very busy with a college assignment: a few classmates and I have had to code the PageRank algorithm — the one Google used to use for searches, before AI and NLP ate everything else.

What is PageRank?

PageRank is an algorithm used to get a ranking for connected parts of a system — perfect for ranking websites, its original purpose.

Based on its original task, it measures and ranks the importance or influence of many nodes (websites) that link to each other (edges).

The algorithm takes as its input a directed Graph, and returns a ranking of its nodes -along with some scorings between 0 and 1- with a few criteria:

  • You rank higher if more nodes link to you.
  • Linking to another node is less relevant if you link to more nodes.
  • Being linked by higher ranked nodes is better.

This is coherent with the idea that a big site, like Medium, will be linked by a lot of sources, whereas being linked by a big site (say, Facebook’s home page) also means your site’s pretty relevant. You could also use it to model relevance of scientific papers or publications (using citations as the links), or probabilities that an animal gets eaten in a given ecosystem (with a food chain as graph).

So I’d been meaning to write an article about something fun, and I had this PageRank implementation laying around… I couldn’t miss the chance.

Getting the data

First I got down to getting the data.

Since all I wanted to model was the type relationships, I was about to use Bulbapedia (Pokémon’s Wiki) — but then I figured someone else had probably already coded that bit. Effectively, a few seconds of search got me to this awesome link, from which I took the Python matrix of type advantages in the game.
This uses the types and relationships from the 6th generation. I haven’t gotten around to playing the 7th one yet, so I didn’t mind.

Having the raw matrix already loaded in Python, I had to give it the correct format: The links in the kind of graph PageRank takes as input carry no weight — they’re binary: either you link to something or you don’t (if there are different implementations of PageRank that address this, please let me know in the comments!).

In case you haven’t played Pokémon or you’re fuzzy on the details, each type can either be neutral towards another type (most types are mutually neutral), have an advantage (does 2x the damage), a disadvantage (does 1/2 the damage) or an immunity (receives 0 damage).

The way I moved that format (4 different relationships) to a binary domain was simply doing two different graphs: one for attackers, and one for defenders. I also bunched immunity and resistance into the same category (defensive advantage, if you will) — I hope that won’t offend any hardcore fans.

There’s also another issue: PageRank doesn’t take into account sites linking to themselves, and so we can’t use data about a pokémon type being weak to itself or effective against itself. (Full disclosure: I didn’t realize this in the first draft of this article, a reader made me notice my mistake. Results have changed.)

PageRank Results

Here are the results I got from modeling attacking types. I only linked type A to type B if type A was very effective against type B, without linking any types to themselves (since that goes againt PageRanks preconditions).

What’s the Best Pokémon Type? The Power of Metrics (4)

As I anticipated, Psychic came out in the top 3. Dragon had a pretty bad spot, which surprised me a lot, except one of Dragon’s advantages is being very effective against other dragons, which can’t really be captured by this algorithm. Electric type came out last, though that should be evened out by Water being the most frequent pokémon type.

Meanwhile, the results for defending types were also quite surprising:

What’s the Best Pokémon Type? The Power of Metrics (5)

Dragon comes out last, with Ice close on its tail. On the other hand Fighting and Bug come out on top, being some of the types with the most resistances.
Even though Bug is not a very strong defensive type, it is resistant to three different types, and one of them is Fighting, which came out first on the ranking, so that kinda explains why it would be so close to the top.

(Disclaimer: in the previous draft I said Ice was resistant to Dragon, when it’s just Dragon being weak to Ice. Sorry.)

I feel like the results aren’t too intuitive though, and maybe a different model would work better. For instance, this model can’t capture a type being weak against itself, nor does it deal with how much more frequently a Water-type pokémon will appear than, say, a Dragon type one.

Here’s a link to the raw results, in case you wanna visualize them differently.

Trying out different metrics

I am quite happy with my results on the attacking side, but there’s no way a ranking of defensive pokémon with Fighting on the top can be that good. So I set out to look for other metrics.

I thought maybe a simple metric of

sum (Damage modifier)*(#pokémon of that type) over every type

Could yield more intuitive results, akin to an ‘expected damage’. Let’s see what I got.

I found a redditor who kindly collected the quantity of pokémon of each type, so I am citing him as my source.

For every type, I am counting each pokémon twice if they’re weak against it, 0 if they’re immune, by half if they’re resistant, and once otherwise.

What’s the Best Pokémon Type? The Power of Metrics (6)

This time

  • Bug is the second weakest.
  • Grass comes out last. It came out first in the other ranking.
  • Rock, Ground, Ice and Flying come as the very close top-4.
  • Rock has done well in both attacking metrics.

It would appear even though Grass-type is stronger against many types, there are less pokémon of those types. rock seems to be consistently good though.
In the future, I may look again at these numbers without considering legendary pokémon, since they can’t be used in competitions anyway.

What’s the Best Pokémon Type? The Power of Metrics (7)

If I do the opposite, and calculate the ‘expected damage’ a pokémon should receive based on type alone, these are the key insights:

  • Steel is the best defending pokémon type, probably due to its immunity to Poison and many resistances. It wins by an over 20% margin against the second type.
  • The worst defensive type is, ironically, Ice with a 50% more expected damage than Steel.
  • Ground and Rock, which are consistently good Damage dealers, come across as very bad defending types, which keeps the playground fair.
  • Unsurprisingly, Bug is not only a bad attacker, it is also a bad defender.

Personally, I find these rankings to be more intuitive than the first ones.

For those who want to see the entire results of this analysis, the numbers are available in this gist.

Final conclusions

After seeing these numbers, I feel like I have a better intuition about the pokémon types. To be honest, what has surprised me the most is how fair this system is: the best pokémon by some metrics are the worst by others, and most just fall in the middle. Some of the assumptions most player make have been confirmed: Bug is not a very strong type (its lack of strong attacks would make it even weaker, if that factored into the analysis), Rock and Ground are very good glass-cannons (So keep teaching Earthquake to non-Ground types pokémon), and most types just fall in the middle. Also, Steel makes for a pretty sweet tank.

In the future, I may come back to this and do another, more granular analysis looking into the state of the current meta, or maybe looking at pokémon stats by type, especially dividing them into special tanks, physical tanks, special DPS and physical DPS.

I hope you’ve found this entertaining, and maybe even thought provoking.
I will gladly receive any criticisms or ideas. What do you think about this article, or these results? What other problems do you think could be well modeled by PageRank? What other analysis do you think would be fun to do?
Please let me know the answers to all that in the comments!

Follow me for more Data Science and Analytics articles, and if you liked reading this please consider supporting my writing habits.

What’s the Best Pokémon Type? The Power of Metrics (2024)
Top Articles
Latest Posts
Article information

Author: Aracelis Kilback

Last Updated:

Views: 6316

Rating: 4.3 / 5 (64 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Aracelis Kilback

Birthday: 1994-11-22

Address: Apt. 895 30151 Green Plain, Lake Mariela, RI 98141

Phone: +5992291857476

Job: Legal Officer

Hobby: LARPing, role-playing games, Slacklining, Reading, Inline skating, Brazilian jiu-jitsu, Dance

Introduction: My name is Aracelis Kilback, I am a nice, gentle, agreeable, joyous, attractive, combative, gifted person who loves writing and wants to share my knowledge and understanding with you.