K-Means Clustering, Pokemon Go

Recipe 015: Pokemon Gen 3 K-means Clustering

FerraraTom

Take Charge of your Destiny!

In this data story I’ll be showing you how a self guided machine learning algorithm can select the best Pokemon squad for the Hoenn region.

At the end of this data story you’ll have

six Pokemon to look out for in Pokemon GO

, as well as understand why the Bagon Community Day was the best to date!


025


007_hoenn_region

As seen in the generation 2 games, the generation 3 games brought a wave of changes, especially the data structure.

Listed below are what I feel to be some of the major changes which effect the data of Hoenn region Pokemon.

Main Features added from Generation 2:
A complete overhaul of the Pokemon data structure:
Individual personality value
Abilities and Nature
The IV system went from 0-15 to 0-31
Damage such as Poison, Burn and Leach Seed (passive damage) are resolved at the end of the turn instead of immediately)
135 new Pokemon introduced
103 new moves were introduced
Weather can now be found on the field and activate at the start of a battle
Double Battles

009_pokemon_double_battles

I’d like to call out double battles, as one of the main ingredients in my Pokemon evaluation soup is : Experience Growth Rate.

Double battles allow for more and quicker experience.

In other words all Pokemon can gain more experience earlier on in the game.

021

If you recall when I looked at the data of the Johto Pokemon, we introduced to the very strong bugs.

Now in the Hoenn region we are introduced to weaker bugs.

This was done to counteract the impact of Heracross and Shuckle.

Catch these bugs below for the pokedex completion but you’re not going to have them on your main team.

022

So these weak bugs aside you do get one of (if not the most) powerful dragons: Salamence.  If you play Pokemon Go, you most likely took advantage of in my opinion the best Pokemon Go Community Day to date (Held on 4/13/2019).

008_community_day_01

One of my favorite sayings and motto is “Stay away from the brand names.”  What does this mean and how does it apply to Pokemon?  It means don’t buy into popular opinion, let the facts and data support your choices.

What’s all you hear about on community days?  If you screamed “shinys” then yes… that’s all you hear about.  How many shinys did you catch?

What’s your highest CP shiny?  I’ll trade for shinys.  Don’t be distracted by the brand name of community day, go for more than shinys.  Play in area with several poke stops and has cover from weather.

During the Bagon community day you should have been catching every Bagon spawn

, not only clicking in to see if it’s shiny.  Salamence is the goal, you want to be the mother of dragons (yes, I’m hype for Game of Thrones).

008_community_day


006_scatter_plot

Sticking to the theme of “Stay Away from Brand Names”, applying a k-means clustering algorithm will look for trends in the data and give us a group of Elite Pokemon we should replay Pokemon Ruby and Sapphire with and keep an eye out for in Pokemon Go.

How do we get to the ideal Pokemon team?  Applying a self guided machine learning approach: K-means clustering.  Now you can’t jump ahead and run the algorithm against your data.  First step is standardize your data, because you want to give each of your attributes an equal weight. 

Take for instance:

I want a well balanced team, I don’t want a team elite on attack but weak on defense.

After the data standardize and I run the k-means algorithm, you can see the scatter plot above.  The top right and far right cluster is the segment I want to build my team out of.  All other segments, you can win with but you can 100% steam roll the competition.

Below I’ve included visual representation of the top attackers and defenders in each cluster.


017


018


019


020


This is great, love info graphics… but what do we do this knowledge?  Well we can build a team.

Your team building begins from the very beginning.

I’ll cut to the chase… you should chose Torchic (sorry Swampert fans)

026

Why Torchic? Well I’m concerned about team structure and most importantly a showdown with Slaking (Fighting moves are must).  Below you can see the full recommendation of what your final team should look like.  You should also target all of these in Pokemon GO.

 

024


005

027


028

nintendo, Propensity Modeling, Super Mario

Recipe 014: Smash Brothers Main Selection

FerraraTom

In this recipe I’d like you to chow down on a Smash Brother analytical approach to selecting your main character.  The approach I’m going to introduce you puts an emphasis on what makes a character unique.

pancakes_smash


 

009_overallclust

Before I start diving into the Smash Brothers data, let’s discuss the k-means clustering approach.  A k-means helps paint a clear picture of our data, in this case specifically it will identify Smash Brothers Characters by their attributes to create picture for who your main should be.  Our characters will be assigned into segments

(tiers… everyone loves to put tiers around Smash Characters but they’re based solely on opinion and player preference)

based on trends in our data, and how closely a character is to the a group.

Take the above picture, without applying this approach we are in the top left quadrant, we only have a faint idea of who should be our main.  As we apply more segments and more trends in the data we’ll eventually end up in the bottom left quadrant.  A clear picture of who our main should be.

Now I keep mentioning trends in our data.  How do we find trends in data where attributes are on the surface completely skewed and non-normalized?  Take for instance a characters weight as a whole number will be larger than a characters acceleration rate in the air (aerial attacks).

We can achieve these trends by standardizing our variables, setting all variables to have a mean of zero.  In doing so this analysis focuses strictly on the trends in our data and we can have a pretty interesting discussion: i.e. Yoshi is more similar to Kirby, than he is to Pac-man.


 

Super Smash Bros Ultimate Mural

 

In preparation for this data story I came across the following article, on Business Insider: “These are the 11 best ‘Super Smash Bros. Ultimate’ characters, according to the world’s number-one ranked player

Here’s an excerpt from the article:

final

And here is ZeRo being named the best overall player:

final_001

This triggered a thought in my head and I haven’t done this on the Pancakes Analytics page yet, but typically you would bring a k-means cluster in production and re-score your segments on an agreed upon cadence.  In this case I’ll treat the release of a new game as the cadence.

I’ll run a k-means clustering on the character attributes in Wii-U version and then a k-means clustering on the same character attributes but for the Switch version.

While going through this process I’ll only be including those characters who were in both games and where the data is clean: i.e. all characters have a weight and all characters have available acceleration data.  Sorry Inkling, you’re not in this segmentation.

001_clust

002_clust

Above are both segmentation cadences and characters will be split into these segment tiers:

  • Floaters (Far right circle)
  • Jack of all Trades (Smack in the middle)
  • Dashers (Faster than your Jack of all Trades segment but not fast enough to be elite in that attribute)
  • Air Tanks (The bottom left circle)
  • Speedsters  (Top left circle)

These aren’t ranked by what tier is the best, but we can make some assumptions.  The Jack of All Trades segment, most likely you won’t be winning matches often but you’ll be competitive.

Smash Brothers is a unique fighting game, so characters do have a weight to them.  Being light weight does have it’s advantages, but the learning curve of playing as a Speedster might be too high risk high reward for you.

The Floaters, if you select someone with a weight advantage in this group, you’ll likely to win your match but you have to master the move set (your smash move).

Air Tanks, is a no brainer I think for any skill set.  If you want to have a high likelihood of lasting till time runs out, be an Air Tank (this won’t guarantee a win, that really depends on your competition).


 

003_gandorf

I’m hoping visual this stood out to you the reader: Ganondorf made a large leap from the Air Tanks to the Floaters.  This doesn’t only speak to Ganondorf but it also tells you information about Bowser as well.

When I speak to this to clients and those wanting to learn about a particular data, this is how it translates:

Ganondorf has more in-common with Jiggly Puff than he does Bowser.   The reason being is he’s quicker and can adapt well in aerial attacks and in falling than Bowser can.

On the flip-side of this I can also say Bowser more accurately represents how he’s viewed from the super Mario franchise, in Super Smash Bros. Ultimate.

Neither one of these characters were “nerfed”, only re-calibrated so there’s a distinct difference between the two.

What do you do with this information?  If you’re main is a Floater, Ganondorf would be a good transitional character if you were looking to play as a character with more weight.  Or say you always play as an Air Tank, because you have the assumption anyone who has Kirby as a main shouldn’t be playing Smash Bros. then Ganondorf is a good transitional main for you when you eventually given in and select Kirby, “by accident”.

Image result for kirby smash


 

Below are the segments a brief overview of those characters within each segments:

004_floaters

This segment has high variability and you can see this from the oblong shape of the circle.  Ganondorf and Jiggly Puff are driving this shape, all though they are in the same segment and are more similar to each-other than are to other segments, they are the furthest apart within this segment.

Now hold up… wait a second.  Didn’t I just try to prove a point of how similar they are?  Yes, but in relation of whose more similar to Ganondorf: Jiggly Puff or Bowser.  But if I posed the question who is more similar to Ganondorf: Jiggly Puff or Kirby… that answer is Kirby.

This group on average are the slowest by run speed and lightest by weight… they Float.


 

005_jackofalltrades

This segment is the medium of everything.  There’s no uniquely distinct trend in their data.  Now playing as Pikachu vs Mega Man would have so game-play differences but statistically speaking you are starting with same underlying stats.

If you’re new the series this a good group to start with… they’re a Jack of All Trades.

 


 

006_dashers

The Dasher segment is very similar to the Jack of All Trades segment, only slightly faster.  Playing in this group you could potentially do more harm than good, if you’re selecting because you want to stay middle ground. You could… Dash yourself off the area.


 

007_airtanks

Air Tanks are fast in the aerial attacks… and the heaviest?  I’m anticipating this group will be re-calibrated by the next release.  In other words… Bowser has no business being as effective as he is in the air as he weighs, normally these two variable don’t correlate.  I guess all the time battling a plumber who can flip and jumps is finally paying off.


 

008_speedsters

This is your high risk high reward group.  Characters in this segment are the fastest and the lightest.  I personally am awful playing as Sonic, he’s too fast for playing level but a seasoned player could probably mop the floor with Sonic.


for_post

So who should be your main?  In this segment I rely on industry knowledge as well (ZeRo’s tiers as dependent variable).   I’ll build propensity score with the following independent variables:

  • Change in air acceleration
  • Base air acceleration
  • Base speed in the air
  • Base Run Speed
  • Character Weight
  • Ultimate Smash Bros. Cluster
  • Wii-U Smash Bros. Cluster

propb

The output will give me the likelihood ZeRo would rank the character as a top tier character.  The highest influencers on predictability were:

Change in air acceleration

Run speed

The lowest influencers were:

Base air acceleration

Ultimate Smash Bros. Cluster (this highlights the bias towards the Wii-U stats, influencing ZeRo’s rankings)

Drum roll please….

main1

main2

main3

You should have your main be one of the above three.  This is the data solution to selecting your main.

Really looking forward to the comments section on this one 🙂


005

final_002


003_008

Classification Tree, Game of Thrones, Tree Based Models

Recipe: 009 Game of Thrones Survival of the Fittest

FerraraTom


“When you play the game of thrones, you win or you die.” — Cersei

Let’s bring this quote to life in what I like to call a survival tree of the fittest.  This week’s analysis will focus on the character survival in Game of thrones.  Chow down and enjoy!


001


002


003

Winter is coming and you’d like to know your chances of survival in the Game of Thrones universe.

Let’s learn from those who have survived to this point and those who have met their unkindly fate.

To do this I’ll build a classification tree with my event being set to is the character alive (1 for yes, 2 for zero).  Classification trees in general test the null hypothesis, when we reach my tree visualization I’ll assign the color red to instances of were it’s highly probable of a character death.  Green leaves will indicate it’s highly probable a character survives… as long as all this criteria is met.

Think of this tree as a really morbid family tree, but since the data is Game of thrones it fits right into place.

The variables have readily available to me (hopefully they have importance) are as follows:

  • House Affiliation
  • Member of nobility
  • Marital Status
  • Gender
  • Family history of deaths
  • Popularity

004


005

From the initial read I see knowing if a character is popular among fans and if they are male hold the highest importance in determining survival.

Also the variables I have available account for 75% of the variability (a 25% miss-classification rate).

Let’s say you moved to Westeros, out of the gate you have a 25.4% chance of meeting your end.  At those odds I’m taking my chances but I should stay under the radar as much as I can, because the data warrants it.

If you become a popular character or are an integral part of the story, your death becomes more meaningful and your probability of survival is worse than a coin flip.

So let’s say you’re a like-able character (you can’t help it), not all is loss, as long as you’re a female.  The highest survival rate is the popular female character group.  This is a classic tale of high risk high reward.

006


007

A classification tree is a great way to visual your data and now I’ll walk us through this Game of Thrones survival tree.

Let’s start at the very top, the tree assumes everyone has a 75% of survival.  Now as the tree splits this Is where the interesting part begins, and our data story begins to unfold.

If you are a popular character you flow to the left side of the tree, your survival rate of 75% now drops to 48%.

Staying to the left side of the tree there is another important split, are you a male or female?  Female characters have a higher probability of surviving (87% if you’re popular and 76% if you’re under the radar).

If you’re a male and you’re popular you have a 42% chance of survival (We’re looking at your Peter Dinklage).

Now here’s the largest caveat to take with this classification tree: I’m assuming it will no longer be relevant after the final season.  Winter is coming and most likely our characters will see their end by hands of White Walkers.


008

What have we learned from diving into the Game of Thrones Data?

Everyone has starts off at a 75% survival rate and as your popularity grows your survival rate lessons by 27%.  If you’re a male your survival drops again by 33%.  If you’re a popular female character you are 45% more likely to survive versus your male counterparts.

An interesting tidbit…If you become popular and you are a female (hopefully the mother of dragons) you boast the highest survival rate of anyone in this universe, 87%.

 

After you have consumed this meal, I hope you take these findings and enjoy your episode of Game of Thrones. J  Also as always enjoy the featured pancake recipe below!


006

https://gameofthrones.fandom.com/wiki/Game_of_Thrones_Wiki


005

009


003_008

disney, Mickey Mouse, Regression Modeling, Theme Parks

Recipe: 006 Walt Disney World Parks and Resorts Revenue Influencer

FerraraTom

It all started with a mouse.  This mouse is turning 90 this year and Mickey Mouse has made his impact on society.  To celebrate, what better meal to cook us this week than Walt Disney World Data?  I’ll be challenging myself to

identify influencers on the Parks and Resorts Division’s yearly revenue.


001


002


003

004

With Mickey Mouse turning 90 years old this year, what better meal to cook us this week than Walt Disney World Data?  I’ll be challenging myself to identify influencers on the Parks and Resorts Division’s yearly revenue.

My first approach was to identify what happens during the year the revenue occurs?

The number of Animated Movies released by Disney

The number of Animated Movies featuring Disney Princesses

The number of Attractions add at all four main theme parks and then parsing this information out by the individual park

The first run was not an effective model: most of the variability in the data was not accounted for, and there were no independent variables of significance.

So my next approach was how do I capture word of mouth on movies and attractions?  Secondly, how do I incorporate when Disney starts charging admission to children (currently 2 yrs and younger, enter the parks for free)?

To knock out two birds with one stone, I settled on let me test a rolling 3-year average of all behaviors.  The results were very favorable, 67% of the variability is explained and I have interesting independent variables of significance to make a telling data story


005

If you’re a subscriber to this blog and enjoy the Stacks of Stats, you’ll recognize my preference for Q graphs.

There’s some curls at the tails but most of the data fits well, so there won’t be a need to run a more complex model.

Let’s take a bite into the initial read before accessing the financial impact of all these fun Disney variables.

I’ll caveat this, significance is in the eye of the beholder, and is up to interpretation of the  storyteller and data scientist.  The first read shows the 3-year average of total park attractions having the highest relationship to revenue and inversely the amount of attractions opened at EPCOT has significance but a negative impact on yearly revenue.

I’ll dive more into the individual impacts later, but I want to utilize my upper and lower bounds.


006

The output of this model shows the impact in millions USD.  Analyzing the cone, this is where our fairy tale begins to take shape.

Potentially the average amount of attractions introduced at the all four major parks can drive in $1.6 million USD.

With the Magic Kingdom driving most of this impact:

New attractions added at the Magic Kingdom can drive in $4.5 million USD.

The average amount of the Disney Princess movies does have more of an impact than factoring Disney releasing an animated movie as the only criteria.  What’s intriguing is the variability of our upper and lower bounds, there is a possibility there could be a loss of $50.6M.

007

What could be driving the inverse affect?  Multiple reasons:

1.The quality of the movie releases

2.The presence or in this case non-presence of a meet and greet at the theme park

3.The global economic climate (Less international travel impacts this!)


008

What have learned from diving into the Walt Disney Data?

There’s a reason WDW is investing in new IP based rides at Epcot and Hollywood Studios: they’ve been launching the rides outdated with their audience and they drive the lowest impact currently on yearly revenue.  I anticipate Epcot to see a steady growth on impact when Guardians of the Galaxy and Ratatouille open and a few years have passed.

Finally a Princess Animated Movie drives in 1 million USD more than a regular animated move release.

009

What could be the reasoning?  I’d guesstimate rides introduced at the Magic Kingdom (drives in +4.5M USD) is having a downstream affect on the Princess impact.  Most Princess interactions take place at the Magic Kingdom.

After you have consumed this meal, I hope you take these findings and with Mickey Mouse a Happy 90th Birthday. J  Also as always enjoy the featured pancake recipe below!


005

010

006

https://disneyworld.disney.go.com/


003_008

E-Sports, Logistic Regression, Overwatch

Recipe: 005 Overwatch League Inaugural Season Logistic Regression

FerraraTom

I’m excited to tackle the Overwatch League and my first dig into E-sports in general.  I’ve attended several conventions, including gaming conventions, and I will get this out of the way now:

I thought I was decent at video games… these athletes have shown I’m a very causal player.  This is a good thing, it was a pleasure to witness their craft.

The focus of this week is the probability of an individual player making the playoffs.  Throw into this meal where statistics based around player preferences and game-play performance.  To determine the variables throw into the final mix I threw in some confounding factors and profiling stats before going very heavy on player performance.


001


002


003


004


005


006


006

https://overwatchleague.com/en-us/

https://playoverwatch.com/en-us/


005

 

007


003_008

Classification Tree, Harry Potter, Tree Based Models

Recipe: 003 Harry Potter: Did Voldemort Get-cha? Classification Tree

 

FerraraTom“It does not do well to dwell on dreams and forget to live.” – Albus Dumbledore – Harry Potter and the Sorcerer’s Stone

In this post we won’t dwell but we’ll analyze and learn.  I ask that you play along and imagine yourself receiving your acceptance letter to Hogwarts (well let’s be honest here we’ve all imagined this at one point or another).

So you’ve hopped off the Hogwarts’s Express, ready for your studies and the fight the dark arts. Oh wait… nobody told you about the dark arts and all the threats looming your way? Ever wonder was the budget only allowed for owls to deliver acceptance letters? This week we’ll dive into the greatest threat in the Harry Potter Universe, Lord Voldemort.


003_001


003_002


003_003


003_004


003_005


003_006


003_007


003_008

Regression Modeling

Recipe: 002 Marvel Cinematic Universe Regression Model

 


FerraraTomThere’s is no argument against the Marvel Cinematic Universe being a financial success.  I’ll try to identify variables which can equate to box office success. The goal is to fit a regression model to Box Office USD for Marvel Cinematic Movie releases.
*At the time of cooking Ant-man and the Wasp did not have finalized Box Office USD data (This movie was excluded.) – TF


002001


002002


002003


002004


002005


002006


Thanks for stopping and chowing down on this Recipe (click the link for a reader’s friendly pdf version of this recipe)

Now try this delicious pancake recipe (with the Ironman Gold and Red finish) courtesy of Crème De La Crumb (Link Below):

002007