Resources for using R with Amazon SageMaker
This document lists resources that can help you learn how to use Amazon SageMaker features with the R software environment. The following sections introduce SageMaker's built-in R kernel, explain how to get started with R on SageMaker, and provide several example notebooks.
The examples are organized in three levels: beginner, intermediate, and advanced. They
start with Getting Started with R on SageMaker
For information on how to bring your own custom R image to Studio, see Bring your own SageMaker image. For a similar blog article, see Bringing your own R environment to Amazon SageMaker Studio
Topics
RStudio support in SageMaker
Amazon SageMaker supports RStudio as a fully-managed integrated development environment (IDE) integrated with Amazon SageMaker domain. With RStudio integration, you can launch an RStudio environment in the domain to run your RStudio workflows on SageMaker resources. For more information, see RStudio on Amazon SageMaker.
R kernel in SageMaker
SageMaker notebook instances support R using a pre-installed R kernel. Also, the R kernel has the reticulate library, an R to Python interface, so you can use the features of SageMaker Python SDK from within an R script.
-
reticulatelibrary
: provides an R interface to the Amazon SageMaker Python SDK . The reticulate package translates between R and Python objects.
Example notebooks
Prerequisites
-
Getting Started with R on SageMaker
– This sample notebook describes how you can develop R scripts using Amazon SageMaker‘s R kernel. In this notebook you set up your SageMaker environment and permissions, download the abalone dataset from the UCI Machine Learning Repository , do some basic processing and visualization on the data, then save the data as .csv format to S3.
Beginner Level
-
SageMaker Batch Transform using R Kernel
– This sample Notebook describes how to conduct a batch transform job using SageMaker’s Transformer API and the XGBoost algorithm. The notebook also uses the Abalone dataset.
Intermediate Level
-
Hyperparameter Optimization for XGBoost in R
– This sample notebook extends the previous beginner notebooks that use the abalone dataset and XGBoost. It describes how to do model tuning with hyperparameter optimization . You will also learn how to use batch transform for batching predictions, as well as how to create a model endpoint to make real-time predictions. -
Amazon SageMaker Processing with R
– SageMaker Processing lets you preprocess, post-process and run model evaluation workloads. This example shows you how to create an R script to orchestrate a Processing job.
Advanced Level
-
Train and Deploy Your Own R Algorithm in SageMaker
– Do you already have an R algorithm, and you want to bring it into SageMaker to tune, train, or deploy it? This example walks you through how to customize SageMaker containers with custom R packages, all the way to using a hosted endpoint for inference on your R-origin model.