Overview

  • Intro to TensorFlow

  • Deep Learning

  • R Interfaces to TensorFlow

  • Supporting Tools

  • Learning More

What is TensorFlow?

A general purpose numerical computing library

  • Originally developed by researchers and engineers working on the Google Brain Team for the purposes of conducting machine learning and deep neural networks research.
  • Open source software (Apache v2.0 license)
  • Hardware independent
  • Supports automatic differentiation
  • Distributed execution and large datasets

Why should R users care?

  • A new general purpose numerical computing library!
    • Hardware independent
    • Distributed execution
    • Large datasets
    • Automatic differentiation
  • Very general built-in optimization algorithms (SGD, Adam) that don't require that all data is in RAM

  • Robust foundation for machine learning and deep learning applications

  • TensorFlow models can be deployed with a low-latency C++ runtime

  • R has a lot to offer as an interface language for TensorFlow

TensorFlow Basics

  • Tensors

  • Data flow

  • Runtime execution

  • Some example uses

What are tensors?

Data stored in multidimensional arrays

Dimension R object
0D 42
1D c(42, 42, 42)
2D matrix(42, nrow = 2, ncol = 2)
3D array(42, dim = c(2,3,2))
4D array(42, dim = c(2,3,2,3))

Some examples

Data Tensor
Vector data 2D tensors of shape (samples, features)
Timeseries data 3D tensors of shape (samples, timesteps, features)
Images 4D tensors of shape (samples, height, width, channels)
Video 5D tensors of shape (samples, frames, height, width, channels)


Note that samples is always the first dimension

2D tensors

Vector data

head(data.matrix(iris), n = 10)
      Sepal.Length Sepal.Width Petal.Length Petal.Width Species
 [1,]          5.1         3.5          1.4         0.2       1
 [2,]          4.9         3.0          1.4         0.2       1
 [3,]          4.7         3.2          1.3         0.2       1
 [4,]          4.6         3.1          1.5         0.2       1
 [5,]          5.0         3.6          1.4         0.2       1
 [6,]          5.4         3.9          1.7         0.4       1
 [7,]          4.6         3.4          1.4         0.3       1
 [8,]          5.0         3.4          1.5         0.2       1
 [9,]          4.4         2.9          1.4         0.2       1
[10,]          4.9         3.1          1.5         0.1       1

3D tensors

Timeseries or sequence data

4D tensors

Image data

What is tensor "flow"?

A dataflow graph with nodes representing units of computation