Thursday, 17 September 2015

Tableau and the NBA - moving past a static shot chart

For those who know me, I have always wanted to achieve one thing with data - understand the NBA better. If you were (un)lucky enough to hear me talk in Seattle at the Tableau Public session in 2014 you know that the great basketball analysis I had come up with was this:


The Interactive Shot Chart: click on the image to go to Tableau Public


Don’t get me wrong, I was massively proud of creating this. It was the first time that I had used path, background images and a number of other techniques in Tableau. The visualisation allowed me to understand not just whether a shot was made, but added context to the shot by showing additional information about the pass that led to the shot. However, this was not sustainable. It took me four hours to map one quarter of one game. I’m a dedicated fan but there are limits (even when the Spurs are beating the Lakers).


I made an extra step when I stumbled upon the ‘Shot Logs’ on the NBA.com website. Have a look at all of the richness that is available from this part of the site: 


Stats.nba.com - All thanks to SportsVu data

I have already written about how I got the statistics out of this part of the NBA in the following blog: http://www.theinformationlab.co.uk/2015/08/11/the-nba-letting-you-get-closer-to-the-game/ Despite all the goodies in these pages (and the accompanying Rebound logs) this gave me a lot to analyse but still didn’t get me any closer to what I wanted to really create.


This is why I got really excited when a colleague sent me a link to this article in which Savvas shows how to get the X/Y movement data that I have been striving to get my hands on for the last few years. All of this is available from the NBA API. Savvas uses Python and as I’m not the greatest coder in the world, I took the path of ‘least coding’ and set-up Alteryx to do all the hard work for me.


With Alteryx you have the ability to connect to the API and grab the JSON output. By generating numbers you can, create a whole set of URLs from a base to scroll through the various events within a game. As a game returns circa 2 million rows of data through this macro, I haven’t made the macro to return multiple games. With Alteryx’s text input, it allows me to enter a Game ID once and then can reuse in multiple places throughout the macro. I have used this functionality as a second API call is made to bring back the play-by-play information.





You can download the module from here and see what I did at each stage.   


My favourite visualisation that I have created so far with this data allows you to pick any play throughout the game and watch the play unfold. As the ‘Pages’ shelf in server doesn’t allow you to ‘play’ the visualisation, I have uploaded a YouTube video of how this looks on Tableau Desktop.


But you can also get the workbook and ‘play’ it on your Tableau Desktop by downloading from Tableau Public 




Tuesday, 28 July 2015

The Tour de France - The final placings

Congratulations Chris Froome and Team Sky. An amazing performance to hold on to the Yellow Jersey ahead of Nairo Quintana and team Movistar.

Check out your favourite riders by clicking on the image




Monday, 20 July 2015

The Tour 2015 - end of Week Two

The mountains, it's always the mountains. Check out the change in the General Classification positions throughout the last week stages. The craziness of the graph shows you how much was going on in some epic battles.

Still glad to see Chris Froome and Team Sky doing well with the Welsh wizard (Geraint Thomas) somehow keeping pace with the top climbers in the World.


Sunday, 12 July 2015

Tour de France 2015 - The end of week one

So far so good for Team Sky fans after week one of the Tour de France 2015. Chris Froome is leading the way in to the first rest day after one of the most challenging opening weeks of the tour. Cross winds, crashes, 'pave' and two time-trials have trimmed the Tour field down to 185 riders who will carry on in to the Pyranees for week 2.

Two leaders (Cancellara and Martin) have crashed out in very dramatic fashion so as a Brit, I'll be hoping the same fate doesn't happen to the current leader.

When exploring the visualisation, click on the teams or riders to see how they are progressing through the General Classification


I'll be updating the visualisation as one of the toughest sporting events on the planet continues.

Wednesday, 8 July 2015

Final Keynote - Dr Hannah Fry – The Mathematics of Love

Human behaviour is full of patterns so mathematics can help us describe
Hannah challenged herself to find the question as far away from maths as possible
Peter Bakkus worked out how many women in the world would be ideal for him – he found out it was 26
-        Peter broke down the serialised elements of the population to work out how to go from the total population to the actual number
The science of love shows that you don’t know what you want until you have it
-        Don’t form a list!
The golden ratio is still perceived as a way to denote beauty
-        In architecture as well as beauty, this just isn’t science
Naturally symmetrical faces show a lack of childhood illness as children faces grow less symmetrically when ill
-        But for moving images we prefer asymmetry (we often move the right side of our mouths more than the left when speaking)
Hormones are the biological cause of the characteristics that we deem as beautiful – it’s all about fertility and higher reproduction possibility
Beauty isn’t everything – develop your charm!
To trick people in to thinking you are more attractive than you are then use the irrelevant alternative theory
-        Find a slightly less attractive wingman / wingwoman
You are statistically more likely to have an attractive partner if you approach them rather than waiting for them to come to you

Using OK Cupid data to analyse preference to attractiveness is really interesting
-        Lesson – don’t just rely on average values – look at the distribution
-        Find a ‘quirky’ partner and find less competition so play up on what makes you different
You can use Optimal Stopping theory of working out when to stop dating and settle down
-        For the first 37% of you dating time you reject everyone but after that find the best person you have come across after that 37% of time
-        Can be applied to house buying etc (Zebra fish do this)

Hannah’s favourite tip:
Gottman studied couples who had their contentious conversations filmed mapped the times that the individuals spoke and whether they were therefore low risk or high risk of divorce
-        They found a theory that matched 95% of the time
-        Having a low negativity threshold in your conversations are much stronger together

So the tip: Communicate often, honestly and positively. 

Tableau on Tour - Paul Banoub – Sweet Viz O’ Mine,Tableau at UBS


 Centre of Excellence at UBS and how it was developed
Paul’s role focuses on building the Tableau Service – Server, Desktop and improved use of visualisation best practices
-        Training & education – sessions design by me! (self-promotion)
-        Industry events – including London User Group – builds the relationship with Tableau
-        Consultancy Partnerships
-        Data Viz Community at the heart of the growth
This session is about the human side of the CoE and how to keep it growing, analysing it and turbo charging the improvement.
Try before you buy  (10 Server Interactor, 20 desktops) was how UBS started. Gave licences to people for only a couple of weeks but then took them away to allow someone else to try.
-        Obviously various people purchased to allow the growth to kick-off
-        Getting the Tableau Trail available for internal download was a big step forward
-        PoC should be about the full end-to-end experience and gaining analytical benefit
Establish the community
-        Users were slowly building < 100 in first year, < 300 in year two and now 1,300 in year three
Service Review Group
-        Get senior stakeholders on board and keep asking them questions
Create a great vibe
-        In a Tableau’s deployment case – use the Tableau vibe!
-        Make the content short and sweet
-        The Jive Connection page gives a hub to share activity and content
Maintaining & Growing Service
-        Invite people as soon as you have contact with someone
-        Get Tableau to help you bring you links in your own organisation who you might not be aware of
-        Tableau Touchpoint – get great at demoing and keep shouting about it
Making it fun, Make it Useful
-        Clearly show people how they can get started
-        Make it a Platform – allow others to tell their story and sell their own work that the service has enabled
-        Make it Passionate – be a little controversial
-        By getting others involved – a senior director got involved to write the .tps colour files for the team who had no direct involvement in the team
Introspection
-        Use Postgres database to mine the actual data showing how your service is being used
-        Mark Jackson created some great content
-        Dave Hart from Interworks created a cracking set of custom admin views for UBS
The service has now grown to “where it isn’t a toy anymore”

Update regularly to keep users knowledgeable and informed about your service and where it is developing

Dr John Medina - Keynote

Molecular Biologist
We don’t know how the brain works to pick up a glass of water and drink it or write your name
-        The gap has been filled with lots of mythology
-        10% of your brain is being used is rubbish, it’s 40-50% when you are at rest
Human brain designed to solving problems in outdoor settings in changing conditions
-        Classrooms and offices are the antithesis of this

How to create a successful presentation:
1.      The attentional spotlight
2.      Three characteristics
3.      Integrating text and pictures

1.      The attentional spotlight
This is where you can filter everything else out around you and focus on one thing
Attentional spotlight theory – the brain is a generator and the speaker is the spotlight controller
-        Generator effects: Time of day; Quality of Sleep; State of Hunger
-        Spotlight: Emotional stimulus;
Two key parts of the brain in the Attentional Spotlight:
A.     Medial Parietal – scanning across your vision to determine if you have seen what you are seeing before and whether it is important
B.     Brodmann Area Ten (BA10): Allows you to switch attention to something. Only allows one switch at the time.
Because BA10 can’t switch more than once at the time – therefore you can’t multi-task

2.      Three known characteristics
A.     Chunking (temporal property)
a.      If you present a string of information, your brain looks for a pattern and then tries to create patterns
b.      Your brain wants to be given time to break up the information, store it and then take in the next amount of information
                                                    i.     How long is this? 10 minutes before the brain checks out. Attention builds up over time up to 10 mins but then drops off after 10 minutes
                                                   ii.     Give 10 minutes presentations – or break it up in to 10 minute chunks

B.     Meaning before detail
a.      Human brain processes meaning before detail. It looks at the Tiger’s mouth and not the individual teeth
b.      6 questions of meaning for the brain
                                                    i.     Will it eat me?
                                                   ii.     Can I eat it?
                                                  iii.     Can I have sex with it? (reproduction rather than just fun)
                                                  iv.     Will it have sex with me?
                                                   v.     Have I seen it before? (pattern matching)
                                                  vi.     Have I never seen it before?
c.      Resilience – Trauma at the genetic level – genes are better at protecting you from trauma. You shouldn’t describe the science – describe the resilience and why it matters
d.      Pattern matching – if you detect patterns your brain gives you a ‘dopamine lollipop’ ie a reward for
e.      Have to give your audience an emotionally competent stimulus every 10 minutes

C.     The importance of narratives
a.      Don’t know why the brain likes episodic memory but it does!
b.      You need 3 ingredients: 
                                                    i.     Timeline
                                                   ii.     Character (maybe you)
                                                  iii.     Event – often social but crisis
c.      63% of speech is recalled with a story. 5% recalled a statistic
d.      “The King died and then the Queen died” – brain loses attention
e.      “The King died and then the Queen died of grief” – Brain lights up – you have a story
Rules for the hooks
-        ECS should be short
-        ECS should be relevant – even illustrative
-        ECS more memorable if you can turn it in to a story

3.      Integrated Text and Pictures
Text and pictures should be present and if possible move
Rules
A.     Limit the amount of text – brain still wants to go through individual words and letters of the individual words
a.      The eye spends time looking at each letter and then the first and last letter. The brain doesn’t get better – words act as a cognitive bottleneck
b.      140 characters is similar to the amount of text information is put on to a slide
                                                    i.     Replace text with picture
                                                   ii.     50% is vision, 2% auditory and 8% to touch (% of cortex through surface area)
c.      256 images shown vs 256 words – wait 3 days and test with a set of images of what was seen before and not. Pictures correct 90% - Text only 10%. For a year it is 63% for images, text is c. 10% still

The little that we know about brain science allows us to tweak presentations to make some improvements – it’s not fully known yet though!