R Tensorflow API
R Tensorflow API
PAGE 1 | AI @ T-MOBILE
What does it mean to put into production?
ANALYSIS BUILD
Running code once Writing code that is
to produce a result continuously running
PAGE 3 | AI @ T-MOBILE
Scenario Customer sends message:
“This high bill shall not pass!”
Method
• Classify the message with machine learning: [bill breakdown]
• Improve the prediction with customer data:
• Recent account activity
• Signal strength
• Bill status [overdue]
PAGE 4 | AI @ T-MOBILE
Model creation with R
PAGE 5 | AI @ T-MOBILE
Model building workflow
2. Save the model to flat files (and log the build with
rmarkdown)
PAGE 6 | AI @ T-MOBILE
Neural networks with R, Keras, and TensorFlow
A Convolutional Neural Network (CNN) processes
initial customer message and customer data
CNN
PAGE 9 | AI @ T-MOBILE
Choosing the language
“If you want machine learning in production you need Python” –literally everyone
1 ❎
2 ❎
3 ✅
PAGE 10 | AI @ T-MOBILE
Idea! Treat R like a full
programming language
(because it is one)
rest_controller.R main.R
#* @get /sum library(plumber)
function(a, b){ r <- plumb("rest_contoller.R")
as.numeric(a) + as.numeric(b) r$run(host='0.0.0.0',port=80)
}
PAGE 12 | AI @ T-MOBILE
Behold: containers!
Example Dockerfilae
# start from the rocker/r-ver:3.5.0 image
FROM rocker/r-ver:3.5.0
# install plumber
RUN R -e "install.packages('plumber')"
• Container—Hitting run on an image # when the container starts, start the main.R
script
ENTRYPOINT ["Rscript", "main.R"]
PAGE 13 | AI @ T-MOBILE
Container Struggles: Python
PAGE 14 | AI @ T-MOBILE
Container Struggles: Security
PAGE 15 | AI @ T-MOBILE
Container Struggles: Size
PAGE 16 | AI @ T-MOBILE
Status: UP
R-native API container
TensorFlow enabled
Lightweight
Secure
PAGE 17 | AI @ T-MOBILE
Lessons learned
PAGE 18 | AI @ T-MOBILE
R vs Python
PAGE 19 | AI @ T-MOBILE
Working Together is Critical
Sr. Manager
ML Engineer
Product
Data Scientist
PAGE 20 | AI @ T-MOBILE
Where are we today
PAGE 21 | AI @ T-MOBILE
R in prod: Apple Business Chat
PAGE 22 | AI @ T-MOBILE
And you can be here too!
PAGE 23 | AI @ T-MOBILE
Materials: nolisllc.com/rstudio19
twitter: @skyetetra @heatherklus
PAGE 24 | AI @ T-MOBILE