The repository contains R, RStudio, Python, Anaconda and the reticulate package
10K+
| image | description | from | size | metrics | build status |
|---|---|---|---|---|---|
| reticulate | R-3.3.3, RStudio, Python 3.4.2, Anaconda and the reticulate package | rocker/rstudio:3.3.3 | |||
| tensorflowr | Adds tensorflow and keras, installed in python virtualenv and conda environment | andrie/reticulate |
This repository will be useful to test any R code that connects to Python using the reticulate package. The repository uses rocker/rstudio:3.3.3 as the base, and adds:
devtools, roxygen2 and rmarkdownRcppreticulate, an interface layer between R and python, installed from CRANThis repository builds two environments that contain tensorflow (tensorflow.org) and keras (keras.io):
Python virtual environment, containing:
/tensorflowtensorflow, keras and h5pysource /tensorflow/bin/activate
Anaconda environment (conda env) containing:
tensorflowtensorflow, keras and h5pysource activate tensorflow
The R package reticulate (available on CRAN) communicates between R and python.
The reticulate package needs to know where python is installed, so the repository writes environment variables into the Renviron file to configure reticulate correctly:
TENSORFLOW_PYTHON = "/tensorflow/bin/python"
RETICULATE_PYTHON = "/tensorflow/bin/python"
To pull and build the image, use:
docker pull andrie/tensorflowr
Since the repository contains rocker/rstudio, you can run RStudio in your web browser by pointing to https://localhost:8787 if you map the ports. The following line creates a container and names it tensorflowr, so you can easily refer to this later.
docker run -d --name tensorflowr -p 8787:8787 andrie/tensorflowr
To execute code inside the running container:
docker exec -ti tensorflowr bash
To test tensorflow, try the Hallo world example from the tensorflow R package:
library(tensorflow)
sess = tf$Session()
hello <- tf$constant('Hello, TensorFlow!')
sess$run(hello)
To test keras, try the code from the kerasR vignette:
library(kerasR)
mod <- Sequential()
mod$add(Dense(units = 50, input_shape = 13))
mod$add(Activation("relu"))
mod$add(Dense(units = 1))
keras_compile(mod, loss = 'mse', optimizer = RMSprop())
boston <- load_boston_housing()
X_train <- scale(boston$X_train)
Y_train <- boston$Y_train
X_test <- scale(boston$X_test)
Y_test <- boston$Y_test
keras_fit(mod, X_train, Y_train,
batch_size = 32, epochs = 200,
verbose = 1, validation_split = 0.1)
pred <- keras_predict(mod, normalize(X_test))
sd(as.numeric(pred) - Y_test) / sd(Y_test)
© Andrie de Vries
Content type
Image
Digest
Size
1013.1 MB
Last updated
over 9 years ago
docker pull andrie/reticulate