Deep Learning on AWS with TensorFlow - AWS Online Tech Talks
Deep learning with Tensorflow in R
-
Upload
mikaelhuss -
Category
Data & Analytics
-
view
476 -
download
6
Transcript of Deep learning with Tensorflow in R
Deep Learning and Tensorflow in RMikael Huss, SciLifeLab Stockholm6 Dec 2016, SRUG
Neural networks
Walter Pitts & Warren McCulloch – McCulloch & Pitts neuron model (1943)http://nautil.us/issue/21/information/the-man-who-tried-to-redeem-the-world-with-logic
“McCulloch was a confident, gray-eyed, wild-bearded, chain-smoking philosopher-poet who lived on whiskey and ice cream and never went to bed before 4 a.m. (…) Pitts was a homeless runaway (...)”
Frank Rosenblatt: perceptron (1958)
Multi-layer perceptron
Try to predict the output from the input.The weights are continuously adjusted based on how wrong you are(the difference between the desired output and the actual output)
http://playground.tensorflow.org
What has made deep learning work?
• The access to sufficiently large data sets for training• GPUs and general increases in computing power• Certain practical “tricks”
The pace of adoption helped by GitHub and other code sharing sites, frameworks likeTensorFlow (Google), Torch (Facebook), Theano (University of Toronto) etc
Convolutional neural networks
Convolutional networks (convnets)
Good for image recognition
Filters are learned, not hand-crafted
http://cs231n.github.io/convolutional-networks/
Demo http://cs231n.stanford.edu/
Recurrent neural networksUsed for sequence modelling, e g language models
http://karpathy.github.io/2015/05/21/rnn-effectiveness/
http://colah.github.io/posts/2015-08-Understanding-LSTMs/
Can be used as generative models for language
9
(Stacked) Autoencoder
Le et al (Stanford/Google): “Building high-level features using large scale unsupervised learning”
Generative adversarial networks
Machine generated bedrooms
Walking through “bedroom space”
https://github.com/Newmu/dcgan_code
Tensorflow
• First introduced Nov 2015 by Google• Python and C++ APIs• Numerical computations. “Tensors” should
here be understood as multi-dimensional arrays
• Introduced for R in Nov 2016 by RStudio
Basic Tensorflow mechanics
• First define a computation graph (~ operations that depend on each other)
• Then execute the graph in a “session”.• Computations can be parallelized on CPU
and/or GPU
Example from https://rstudio.github.io/tensorflow/
Example from https://rstudio.github.io/tensorflow/
Define a loss function to specify what you are trying to optimize for, and choose an optimizer.
Initialize things. Need to have a “session”.
Example from https://rstudio.github.io/tensorflow/
Run the model.
For examples of how to build up feed-forward and convolutional networks in this way, see one of many tutorials, e g https://rstudio.github.io/tensorflow/tutorial_mnist_beginners.htmlhttps://rstudio.github.io/tensorflow/tutorial_mnist_pros.html
Visualizing your model structure (Tensorboard)
https://github.com/rstudio/tensorflow/blob/master/inst/examples/mnist/mnist_with_summaries.R
If you don’t want to build a network from scratch …
(there are many others)
https://www.r-bloggers.com/image-classification-in-r-using-trained-tensorflow-models/
VGG16 classification model
R Tensorflow installation
https://gist.github.com/hussius/a94ab500ea7ccbfc2de8ab9a50854bd8
Complication: does not currently work with Anaconda Python versions
Resources
“Hello, Tensorflow”: https://www.oreilly.com/learning/hello-tensorflow
Convolutional network explanation: http://cs231n.github.io/convolutional-networks/
Recursive network explanation http://karpathy.github.io/2015/05/21/rnn-effectiveness/
The VGG16 Shiny app https://github.com/hussius/shiny-imageclassif-tfslim