- Keras and TensorFlow are the state of the art in deep learning tools and with the keras package you can now access both with a fluent R interface.
- To prepare this data for training we one-hot encode the vectors into binary class matrices using the Keras function: The core data structure of Keras is a model, a way to organize layers.
- We begin by creating a sequential model and then adding layers using the pipe ( ) operator: The argument to the first layer specifies the shape of the input data (a length 784 numeric vector representing a grayscale image).
- Use the function to print the details of the model: Next, compile the model with appropriate loss function, optimizer, and metrics: Use the function to train the model for 30 epochs using batches of 128 images: The object returned by includes loss and accuracy metrics which we can plot: Evaluate the model’s performance on the test data: Keras provides a vocabulary for building deep learning models that is simple, elegant, and intuitive.
- After you’ve become familiar with the basics, these articles are a good next step: Keras provides a productive, highly flexible framework for developing deep learning models.
@rstudio: “R interface to Keras, now on CRAN: #deeplearning #keras #rstats” open tweet »