Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou...
Transcript of Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou...
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
Deep learning in R with MXNet
Qiang Kou
Qiang Kou ([email protected]) Deep learning in R with MXNet 1 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
Qiang Kou, KK, 寇强PhD student in mass spectrometry, Indiana UniversityR/C++ developerRcpp core team memberhttps://github.com/dmlc/mxnethttp://mxnet.readthedocs.org/en/latest/index.html
Qiang Kou ([email protected]) Deep learning in R with MXNet 2 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
What is mxnet?
What is MXNet?
Qiang Kou ([email protected]) Deep learning in R with MXNet 3 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
What is mxnet?
Deep learning platforms
http://www.slideshare.net/NVIDIA/nvidia-ces-2016-press-conference
Qiang Kou ([email protected]) Deep learning in R with MXNet 4 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
What is mxnet?
MXNet
MXNet: A Flexible and Efficient Machine Learning Library for Heterogeneous Distributed Systems
Qiang Kou ([email protected]) Deep learning in R with MXNet 5 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
Why MXNet?
Why MXNet?
Qiang Kou ([email protected]) Deep learning in R with MXNet 6 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
Why MXNet?
Why MXNet?
Qiang Kou ([email protected]) Deep learning in R with MXNet 7 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
Why MXNet?
Why not tensorflow?
Qiang Kou ([email protected]) Deep learning in R with MXNet 8 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
Why MXNet?
Qiang Kou ([email protected]) Deep learning in R with MXNet 9 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
Why MXNet?
More efficient
Figure: Compare MXNet to others on a single forward-backward performance.
Qiang Kou ([email protected]) Deep learning in R with MXNet 10 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
Why MXNet?
Windows support
Qiang Kou ([email protected]) Deep learning in R with MXNet 11 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
Why MXNet?
Installation
Qiang Kou ([email protected]) Deep learning in R with MXNet 12 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
Why MXNet?
DRAT repo
For Windows and Mac users
install.packages("drat", repos="https://cran.rstudio.com")drat:::addRepo("dmlc")install.packages("mxnet")
Qiang Kou ([email protected]) Deep learning in R with MXNet 13 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
Why MXNet?
MNIST demo
Qiang Kou ([email protected]) Deep learning in R with MXNet 14 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
Why MXNet?
MNIST demo
The dataset is fromhttps://www.kaggle.com/c/digit-recognizer/data
library(mxnet)train <- read.csv("train.csv", header=TRUE)test <- read.csv("test.csv", header=TRUE)train <- data.matrix(train)test <- data.matrix(test)train.x <- train[,-1]train.y <- train[,1]train.x <- t(train.x/255)test <- t(test/255)
Qiang Kou ([email protected]) Deep learning in R with MXNet 15 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
Why MXNet?
MNIST demo
data <- mx.symbol.Variable("data")fc1 <- mx.symbol.FullyConnected(data, name="fc1", num_hidden=128)act1 <- mx.symbol.Activation(fc1, name="relu1", act_type="relu")fc2 <- mx.symbol.FullyConnected(act1, name="fc2", num_hidden=64)act2 <- mx.symbol.Activation(fc2, name="relu2", act_type="relu")fc3 <- mx.symbol.FullyConnected(act2, name="fc3", num_hidden=10)softmax <- mx.symbol.SoftmaxOutput(fc3, name="sm")
Qiang Kou ([email protected]) Deep learning in R with MXNet 16 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
Why MXNet?
MNIST demo
mx.set.seed(0)model <- mx.model.FeedForward.create(softmax, X=train.x,
y=train.y, ctx=mx.gpu(), num.round=10,array.batch.size=100,learning.rate=0.07, momentum=0.9,eval.metric=mx.metric.accuracy,initializer=mx.init.uniform(0.07),batch.end.callback
= mx.callback.log.train.metric(100))
Qiang Kou ([email protected]) Deep learning in R with MXNet 17 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
Why MXNet?
MNIST demo
Qiang Kou ([email protected]) Deep learning in R with MXNet 18 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
Why MXNet?
A shiny app
Qiang Kou ([email protected]) Deep learning in R with MXNet 19 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
Why MXNet?
A shiny app
Qiang Kou ([email protected]) Deep learning in R with MXNet 20 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
Thanks
Acknowledgment
Qiang Kou ([email protected]) Deep learning in R with MXNet 21 / 22
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
...
.
Thanks
Thanks
Thank you for the time!
Qiang Kou ([email protected]) Deep learning in R with MXNet 22 / 22