machine learning and deep learning with r
TRANSCRIPT
![Page 1: Machine Learning and Deep Learning with R](https://reader031.vdocuments.us/reader031/viewer/2022013120/58a4ee6a1a28abd8548b5e39/html5/thumbnails/1.jpg)
Machine Learning and Deep Learning with R
Poo Kuan Hoong
February 15, 2017
![Page 2: Machine Learning and Deep Learning with R](https://reader031.vdocuments.us/reader031/viewer/2022013120/58a4ee6a1a28abd8548b5e39/html5/thumbnails/2.jpg)
Deep Learning so far. . .
![Page 3: Machine Learning and Deep Learning with R](https://reader031.vdocuments.us/reader031/viewer/2022013120/58a4ee6a1a28abd8548b5e39/html5/thumbnails/3.jpg)
Introduction
I In the past 10 years, machine learning and Artificial Intelligence(AI) have shown tremendous progress
I The recent success can be attributed to:I Explosion of dataI Cheap computing cost - CPUs and GPUsI Improvement of machine learning models
I Much of the current excitement concerns a subfield of it called“deep learning”.
![Page 4: Machine Learning and Deep Learning with R](https://reader031.vdocuments.us/reader031/viewer/2022013120/58a4ee6a1a28abd8548b5e39/html5/thumbnails/4.jpg)
Human Brain
![Page 5: Machine Learning and Deep Learning with R](https://reader031.vdocuments.us/reader031/viewer/2022013120/58a4ee6a1a28abd8548b5e39/html5/thumbnails/5.jpg)
Neural Networks
I Deep Learning is primarily about neural networks, where anetwork is an interconnected web of nodes and edges.
I Neural nets were designed to perform complex tasks, such asthe task of placing objects into categories based on a fewattributes.
I Neural nets are highly structured networks, and have threekinds of layers - an input, an output, and so called hiddenlayers, which refer to any layers between the input and theoutput layers.
I Each node (also called a neuron) in the hidden and outputlayers has a classifier.
![Page 6: Machine Learning and Deep Learning with R](https://reader031.vdocuments.us/reader031/viewer/2022013120/58a4ee6a1a28abd8548b5e39/html5/thumbnails/6.jpg)
Neural Network Layers
![Page 7: Machine Learning and Deep Learning with R](https://reader031.vdocuments.us/reader031/viewer/2022013120/58a4ee6a1a28abd8548b5e39/html5/thumbnails/7.jpg)
Deep Learning
I Deep learning refers to artificial neural networks that arecomposed of many layers.
I It’s a growing trend in Machine Learning due to some favorableresults in applications where the target function is very complexand the datasets are large.
![Page 8: Machine Learning and Deep Learning with R](https://reader031.vdocuments.us/reader031/viewer/2022013120/58a4ee6a1a28abd8548b5e39/html5/thumbnails/8.jpg)
Deep Learning: Benefits
I RobustI No need to design the features ahead of time - features are
automatically learned to be optimal for the task at handI Robustness to natural variations in the data is automatically
learned
I GeneralizableI The same neural net approach can be used for many different
applications and data typesI Scalable
I Performance improves with more data, method is massivelyparallelizable
![Page 9: Machine Learning and Deep Learning with R](https://reader031.vdocuments.us/reader031/viewer/2022013120/58a4ee6a1a28abd8548b5e39/html5/thumbnails/9.jpg)
Deep Learning: Weaknesses
I Deep Learning requires a large dataset, hence long trainingperiod.
I In term of cost, Machine Learning methods like SVMs andother tree ensembles are very easily deployed even by relativemachine learning novices and can usually get you reasonablygood results.
I Deep learning methods tend to learn everything. It’s betterto encode prior knowledge about structure of images (or audioor text).
I The learned features are often difficult to understand. Manyvision features are also not really human-understandable (e.g,concatenations/combinations of different features).
I Requires a good understanding of how to model multiplemodalities with traditional tools.
![Page 10: Machine Learning and Deep Learning with R](https://reader031.vdocuments.us/reader031/viewer/2022013120/58a4ee6a1a28abd8548b5e39/html5/thumbnails/10.jpg)
Deep Learning: Applications
![Page 11: Machine Learning and Deep Learning with R](https://reader031.vdocuments.us/reader031/viewer/2022013120/58a4ee6a1a28abd8548b5e39/html5/thumbnails/11.jpg)
Deep Learning: R Libraries
I MXNet: The R interface to the MXNet deep learning library.I darch: An R package for deep architectures and restricted
Boltzmann machines.I deepnet: An R package implementing feed-forward neural
networks, restricted Boltzmann machines, deep belief networks,and stacked autoencoders.
I h2o: The R interface to the H2O deep-learning framework.
![Page 12: Machine Learning and Deep Learning with R](https://reader031.vdocuments.us/reader031/viewer/2022013120/58a4ee6a1a28abd8548b5e39/html5/thumbnails/12.jpg)
MXNet
I Founded by: Uni. Washington & Carnegie Mellon Uni (~1.5years old)
I Supports most OS: Runs on Amazon Linux, Ubuntu/Debian,OS X, and Windows OS
I State of the art model support: Flexible and efficient GPUcomputing and state-of-art deep learning i.e. CNN, LSTM to R.
I Ultra Scalable: Seamless tensor/matrix computation withmultiple GPUs in R.
I Ease of USe: Construct and customize the state-of-art deeplearning models in R, and apply them to tasks, such as imageclassification and data science challenges
I Multi-language: Supports the Python, R, Julia and Scalalanguages
I Ecosystem: Vibrant community from Academia and Industry
![Page 13: Machine Learning and Deep Learning with R](https://reader031.vdocuments.us/reader031/viewer/2022013120/58a4ee6a1a28abd8548b5e39/html5/thumbnails/13.jpg)
MXNet Architecture
I You can specify the Context of the function to be executedwithin. This usually includes whether the function should berun on a CPU or a GPU, and if you specify a GPU, which GPUto use.
![Page 14: Machine Learning and Deep Learning with R](https://reader031.vdocuments.us/reader031/viewer/2022013120/58a4ee6a1a28abd8548b5e39/html5/thumbnails/14.jpg)
MXNet R Package
I The R Package can be downloaded using the followingcommands:
install.packages("drat", repos="https://cran.rstudio.com")drat:::addRepo("dmlc")install.packages("mxnet")
![Page 15: Machine Learning and Deep Learning with R](https://reader031.vdocuments.us/reader031/viewer/2022013120/58a4ee6a1a28abd8548b5e39/html5/thumbnails/15.jpg)
Amazon & MXNet for Deep Learning
![Page 16: Machine Learning and Deep Learning with R](https://reader031.vdocuments.us/reader031/viewer/2022013120/58a4ee6a1a28abd8548b5e39/html5/thumbnails/16.jpg)
MNIST Handwritten DatasetI The MNIST database consists of handwritten digits.I The training set has 60,000 examples, and the test set has
10,000 examples.I The MNIST database is a subset of a larger set available from
NIST. The digits have been size-normalized and centered in afixed-size image
I For this demo, the Kaggle pre-processed training and testingdataset were used. The training dataset, (train.csv), has 42000rows and 785 columns.
![Page 17: Machine Learning and Deep Learning with R](https://reader031.vdocuments.us/reader031/viewer/2022013120/58a4ee6a1a28abd8548b5e39/html5/thumbnails/17.jpg)
Demo
I Sourcecode available here https://github.com/kuanhoong/deeplearning-malaysia
![Page 18: Machine Learning and Deep Learning with R](https://reader031.vdocuments.us/reader031/viewer/2022013120/58a4ee6a1a28abd8548b5e39/html5/thumbnails/18.jpg)
Result
![Page 19: Machine Learning and Deep Learning with R](https://reader031.vdocuments.us/reader031/viewer/2022013120/58a4ee6a1a28abd8548b5e39/html5/thumbnails/19.jpg)
Lastly. . .