Sunday 9 August 2015

Turning your R (or Python) models into APIs



More and more real-world systems are relying on data science and analytical models to deliver sophisticated functionality or improved user experiences. For example, Microsoft combined the power of advanced predictive models and web services to develop the real-time voice translation feature in Skype. Facebook and Google continuously improve their deep learning models for better face recognition features in their photo service.

Some have characterised this trend as a shift from Software-as-a-Service (SaaS) to an era of Models-as-a-Service (MaaS). These models are often written in statistical programming languages (e.g., R, Python), which are especially well suited to analytical tasks.

With analytical models playing an increasingly important role in real-world systems, and with more models being developed in R and Python, we need powerful ways of turning these models into APIs for others to consume.

But how?

It is actually a lot easier than you might think. I wrote a step-by-step guide about deploying analytical models as REST APIs. This guide will walk you through how to set up your own MaaS WITHOUT a team of full-stack developers/engineers. All you need are the R/Python models you develop and a Domino Data Lab account. You can find the full article on ProgrammableWeb here.

You can also find my slides for the related LondonR talk here:




When I created this blog back in 2013, my aim was simply to learn ggplot2. Thanks to the feedback and advice from the R community, I continued to learn new stuff and somehow found an opportunity to work for Domino and Virgin Media. I wouldn't say I have seen enough to make a fair comparison with other programming communities. But so far the support from the R community, for me, has been truly special! I believe blogging is one of the best ways to contribute so I better get back to the writing habit! For the next post, I would like to talk about using R with other Microsoft tools (SQL Server, PowerPoint) in a commercial environment.

London Kaggle Meetup

I met Alex Glaser and Wojtek Kostelecki after my LondonR talk. They have already set up a meetup for Kagglers. We are working on a collaborative project to build / test / stack models on the Domino platform. For more information, join the meetup first. Let's Kaggle together!

Saturday 8 August 2015

A Decade of Premier League Football

The English Premier League is BACK!

Before we get over-excited, let's have a look at the past. Here is a shiny app to visualise some stats from last ten seasons. It is my first attempt at developing data-driven sports stories with R, Shiny and Shiny Dashboard. Those stories ain't new, but I had always wanted to visualise the data instead of just reading them from articles.


It includes the last-minute title decider in 2011-2012 season (I am a red devil. That. Still. Hurts.) ...


... as well as the survival race.


Enjoy. Code is on GitHub.

Got some interesting football stories in mind? Free feel to give me a shout and see if we can create some more data viz.


What's Next?


I am actually more interested in predicting match outcomes and fantasy football. In the coming months, I am going to include more predictive modelling stuff.

On the other hand, I am also working on some new ggplot2 geom (e.g. geom_football, geom_basketball) for sports data visualisation. Hopefully, I can give you an update on this soon.