Visualizing Data Using Chernoff Faces

It makes sense to start New Year on a lighter note. In this post, I will talk about a fun way to visualize multivariate data using a statistical device called Chernoff’s faces. The goal of Chernoff faces is to show a bunch of variables at once via facial features like lips, eyes, and nose size. Most of the time there are better solutions, but the faces can be interesting to work with.

In this post, we will analyse cricket data and we will try to compare 5 Indian batsmen: Sachin, Gambhir, Sehwag, Dhoni and Yuvraj Singh. A natural question that one might ask is how do we compare these 5 players? One can look at several metrics like strike rate, batting average etc and form an opinion. But looking at these metrics in a table might not be very soothing to eyes! One can create Chernoff faces and compare a lot of metrics across these players.

In this particular post, these players were compared on the following metrics:

1. Batting average

2. Strike rate

3. Number of fours per match

4. Number of sixers per match

5. Ratio of Innings to total matches played

To create Chernoff faces these metrics were mapped to certain facial features as given in the table below:

Metrics Facial Features
Batting average Height of face
Strike rate Curve of smile
Number of fours per match Width of eyes
Number of sixers per match Height of eyes
Ratio of Innings to total matches played Width of face

 

The data was collected from crickinfo.comย ย Following R code was used to create the graphic:

setwd(โ€œF:\\Work\\Jigsaw Academy\\Blogs\\January 16โ€)

data<-read.csv(โ€œcrick.csvโ€)

names(data)[1]<-โ€œPlayerโ€

names(data)[5]<-โ€œ4perMatchโ€

names(data)[6]<-โ€œ6perMatchโ€

library(aplpack)

dat<-data.frame(data[3],data[2],A=c(rep(3,5)),B=c(rep(3,5)),C=c(rep(3,5)),data[4],D=c(rep(3,5)),data[5],data[6],E=c(rep(3,5)),G=c(rep(3,5)),H=c(rep(3,5)),I=c(rep(3,5)),J=c(rep(3,5)),K=c(rep(3,5)),L=c(rep(3,5)))

faces(dat,labels=data$Player)

Here is the result:

Screen Shot 2016-01-18 at 11.56.45 AM

As can be seen,ย the happiest face seems to be of Sehwag, no surprise there since he has the highest strike rate, a variable mapped to curve of theย smile. ย Also,ย notice Dhoni has a very long face, this is again due to the fact because the batting average is mapped to the height of face and Dhoni has a very good batting average.

Another thing to notice is the width of eyes for both Dhoni and Yuvraj, its very small, testament to the fact that both these players, although very good stroke makers, made a lot of runs by running between the wickets.

Hope you enjoyed this post. Indeed analytics can be fun!

If you are interested in making a career in the Data Science domain, our 11-month in-personย Postgraduate Certificate Diploma in Data Scienceย course can help you immensely in becoming a successful Data Science professional.ย 

ALSO READ

Related Articles

loader
Please wait while your application is being created.
Request Callback