deep learning in r with mxnet - bitbucket · deep learning in r with mxnet qiang kou...

22
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Deep learning in R with MXNet Qiang Kou [email protected] Qiang Kou ([email protected]) Deep learning in R with MXNet 1 / 22

Upload: others

Post on 22-May-2020

15 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 22

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Deep learning in R with MXNet

Qiang Kou

[email protected]

Qiang Kou ([email protected]) Deep learning in R with MXNet 1 / 22

Page 2: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) 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

Page 3: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 22

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

What is mxnet?

What is MXNet?

Qiang Kou ([email protected]) Deep learning in R with MXNet 3 / 22

Page 4: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 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

Page 5: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 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

Page 6: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 22

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Why MXNet?

Why MXNet?

Qiang Kou ([email protected]) Deep learning in R with MXNet 6 / 22

Page 7: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 22

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Why MXNet?

Why MXNet?

Qiang Kou ([email protected]) Deep learning in R with MXNet 7 / 22

Page 8: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 22

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Why MXNet?

Why not tensorflow?

Qiang Kou ([email protected]) Deep learning in R with MXNet 8 / 22

Page 9: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 22

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Why MXNet?

Qiang Kou ([email protected]) Deep learning in R with MXNet 9 / 22

Page 10: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 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

Page 11: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 22

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Why MXNet?

Windows support

Qiang Kou ([email protected]) Deep learning in R with MXNet 11 / 22

Page 12: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 22

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Why MXNet?

Installation

Qiang Kou ([email protected]) Deep learning in R with MXNet 12 / 22

Page 13: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 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

Page 14: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 22

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Why MXNet?

MNIST demo

Qiang Kou ([email protected]) Deep learning in R with MXNet 14 / 22

Page 15: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 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

Page 16: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 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

Page 17: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 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

Page 18: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 22

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Why MXNet?

MNIST demo

Qiang Kou ([email protected]) Deep learning in R with MXNet 18 / 22

Page 19: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 22

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Why MXNet?

A shiny app

Qiang Kou ([email protected]) Deep learning in R with MXNet 19 / 22

Page 20: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 22

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Why MXNet?

A shiny app

Qiang Kou ([email protected]) Deep learning in R with MXNet 20 / 22

Page 21: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 22

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Thanks

Acknowledgment

Qiang Kou ([email protected]) Deep learning in R with MXNet 21 / 22

Page 22: Deep learning in R with MXNet - Bitbucket · Deep learning in R with MXNet Qiang Kou qkou@umail.iu.edu Qiang Kou (qkou@umail.iu.edu) Deep learning in R with MXNet 1 / 22

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Thanks

Thanks

Thank you for the time!

Qiang Kou ([email protected]) Deep learning in R with MXNet 22 / 22