Two weeks ago, rstudio::conf 2018 was held in San Diego. We had 1,100 people attend the sold-out event. In this post, I summarize my experience of the talks on the topic of deep learning with R, including the keynote by J.J. Allaire.
Keynote
The keynote on the second day was J.J. Allaire discussing “Machine Learning with Tensorflow and R”. In this talk, J.J. took us on a tour of how to use TensorFlow with R. He started with the basics, e.g., what is a tensor (it’s an array), and explained how the tensors “flow” in a computation graph in the TensorFlow library. The tensorflow package in R is an interface to the TensorFlow library, meaning you can access the full power of TensorFlow directly from R.
For several years, there has been a great deal of hype about deep learning, with multiple libraries (primarily written in Python and C++). Of these libraries, TensorFlow seems to get the dominant share of interest. R has always been a language that excels in its ability to interact with other languages, including Fortran, C++, and now Python. With the release of the tensorflow package, R users can make full use of all of the functions in TensorFlow.
Advances in deep learning, including algorithms, GPU computing, and availability of large data sets, have combined for the enormous success of deep learning in many fields. This includes near-human-level performance in the fields of image classification, speech recognition, and machine translation, to name a few.
However, J.J. points out that TensorFlow is quite a low-level mathematical library, and that most practitioners would benefit from writing their neural network code using keras, a package that exposes a high-level API. Keras supports multiple back ends, including TensorFlow, CNTK and Theano. You can find out more at the keras package page.
J.J. concluded his talk by demonstrating several ways to deploy a keras or tensorflow model, including publishing to RStudio Connect.
To find out more about J.J.’s talk, you can watch the keynote video or view the slides. You can also download the keras cheat sheet.
Other talks
Following the keynote, the conference split into several tracks. I attended the session1: “interop”, which focused on interoperability between R and several deep-learning frameworks, including deployment options.
The first talk in this session was by Michael Quinn from Google. Michael discussed “large-scale machine learning using TensorFlow, BigQuery and Cloud ML”. Once you have a keras or tensorflow model, you can deploy this to Google Cloud Machine Learning (Cloud ML). What I find interesting about this is that Cloud ML is a service designed for machine learning. Using this service, you can deploy models without having to stand up a virtual machine first. You can do this deployment using R code with the cloudml package
The next talk was by Javier Luraschi from RStudio, who spoke about “Deploying TensorFlow models with tfdeploy”. The tfdeploy package exposes a unified way to deploy models to several platforms, including TensorFlow Serving, Cloud ML, and RStudio Connect. Javier made his talk available as slides as well as code.
The final presentation was by Ali Zaid from Microsoft, who talked about “Reinforcement learning in Minecraft with CNTK-R”. Ali showed how he trained a deep-learning model to control an agent in Minecraft, the popular online game. In his experiment, he taught the agent to navigate a maze, as well as understand the some natural language, e.g., “Pick up the red flowers”. He used the CNTK-R package, which wraps the Microsoft Cognitive Toolkit (CNTK).
Conclusion
In conclusion, I’ll quote directly from J.J. Allaire’s keynote, in which he describes the key takeaways:
TensorFlow is a new general-purpose numerical-computing library with lots to offer the R community.
Deep learning has made great progress and will likely increase in importance in various fields in the coming years.
R now has a great set of APIs and supporting tools for using TensorFlow and doing deep learning.