Using Keras for Deep Learning with R

This is a companion discussion topic for the original entry at

Photo by Preethi Viswanathan on Unsplash

We are excited to announce new developments in Keras for R. Together with our current integration with torch, data scientists can use the most popular and powerful deep learning frameworks all within R.

Expand data science capabilities with deep learning

Data scientists use machine learning to create models that improve without explicit instructions. Deep learning is a subset of machine learning. It is particularly powerful in applications such as image recognition, natural language processing, and audio processing.

Deep learning allows data scientists to create more accurate and efficient models, sometimes even outperforming human cognition. With improved machine learning capabilities, data scientists can provide better answers to their data questions.

Add essential tools to your toolkit

Data scientists have done significant work to develop the deep learning sector. Among deep learning libraries, Keras stands out for its productivity, flexibility, and user-friendly API. TensorFlow is a machine learning platform that is both extremely adaptable and well-suited for production. Together, users can use these libraries to train and deploy powerful deep learning models.

The Keras for R package provides an R interface to Keras. With it, data scientists can leverage the power of Keras and Tensorflow in R.

Train neural networks with easy-to-write code

Keras for R allows data scientists to run deep learning models in an R interface. They can write in their preferred programming language while taking full advantage of the deep learning methods and architecture.

  • The package provides familiar syntax. Users can write natural-feeling, idiomatic-looking code with Keras for R (including the pipe operator!). Take a look: the image classification example on the Tensorflow for R website uses code very familiar to those who use the tidyverse syntax.

Scrolling through a Tensorflow for R tutorial

  • The package supports users in translating Python code. Using %py_class%, data scientists can directly subclass Python objects, making it much easier to translate Python code found on the web.
NonNegative(keras$constraints$Constraint) %py_class% {
  "__call__" <- function(x) {
    w * k_cast(w >= 0, k_floatx())

No need to switch between environments or languages — users can use Keras functionality all within R.

What’s next?

We will continue developing Keras for R to help R users develop sophisticated deep learning models in R. Stay tuned for:

  • A new version of Deep Learning for R, with updated functionality and architecture;
  • More expansion of Keras for R’s extensive low-level refactoring and enhancements; and
  • More detailed introductions to the powerful new features.

Check out the “Keras for R is Back!” post to learn about the state of the ecosystem and the package’s new functionalities. Subscribe to the RStudio AI Blog for the latest news, insights, and examples of using AI-related technologies with R.

This topic was automatically closed after 179 days. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.