Skip to content

wlandau/learndrake

Repository files navigation

Launch RStudio Cloud Launch RStudio Binder superseded lifecycle

Consider targets

The targets R package is the long-term successor of drake, and it is more robust and easier to use. Please visit https://books.ropensci.org/targets/drake.html for full context and advice on transitioning. A short course on targets is available at https://github.com/wlandau/targets-tutorial.

The drake short course

learndrake is a free online short course on the drake R package. With guided web-based hands-on exercises, you will gradually build up a drake-powered machine learning project and practice the fundamentals of drake. If you run into trouble or have questions along the way, please post an issue at https://github.com/wlandau/learndrake to ask for help.

How to take the course

  1. Read the intro slides at https://wlandau.github.io/learndrake and watch the video recording at https://ropensci.org/commcalls/2019-09-24.
  2. Sign up for a free RStudio Cloud account at https://rstudio.cloud.
  3. Log into the public RStudio Cloud workspace at https://rstudio.cloud/project/627076. You are now running an instance of RStudio Server with everything you need.
  4. In the “Files” pane of the IDE, locate the numbered folders with *.Rmd notebooks inside. Work through the notebooks in order.
Topic Notebook
Custom functions 1-functions/1-functions.Rmd
drake plans 2-plans/2-plans.Rmd
Changing workflows 3-changes/3-changes.Rmd
Static branching 4-static/4-static.Rmd
Dynamic branching 5-dynamic/5-dynamic.Rmd
Files and R Markdown 6-files/6-files.Rmd

Notebooks 3-changes/3-changes.Rmd and 4-static/4-static.Rmd rely on the following Shiny apps.

App Notebook
https://colorado.rstudio.com/rsc/learndrake/changes/ 3-changes/3-changes.Rmd
https://colorado.rstudio.com/rsc/learndrake/static/ 4-static/4-static.Rmd
https://colorado.rstudio.com/rsc/learndrake/planner/ 4-static/4-static.Rmd

The learndrake package

The learndrake R package contains the materials of the short course. It helps students take the workshop locally if they so choose, and it helps educators and administrators host the workshop from alternative platforms.

Installation

You can install learndrake from GitHub.

install.packages("remotes")
remotes::install_github("wlandau/learndrake")

To run the exercises locally, you will also need TensorFlow and Keras.

keras::install_keras()
# Check if the installation succeeded.
tensorflow::tf_config()

If you are using RStudio version 1.2.5003 and encounter this fatal error, consider downgrading TensorFlow to version 1.13.1. Note: install_keras() silently tries to upgrade TensorFlow to version >= 2, so you will need to run it with tensorflow = "1.13.1.

Usage

The functions in learndrake deploy and serve the course materials.

Function Purpose
save_notebooks() Save the *.Rmd notebooks to your computer.
view_slides() Open the intro slides in a web browser.
save_slides() Save the intro slides to your computer.
launch_app() Launch a supporting Shiny app.
save_app() Save the code files of a supporting Shiny app.

Accompanying resources

This short course focuses mostly on drake’s mental model and core concepts.

  • How to break up a project into functions.
  • How to think about and create drake plans.
  • How drake decides what is up to date and what is outdated.

The following resources cover important topics that did not make it into the syllabus.

In practice

  • Miles McBain’s excellent blog post explains the motivating factors and practical issues {drake} addresses for most projects, how to set up a project as quickly and painlessly as possible, and how to overcome common obstacles.
  • Miles’ dflow package generates the file structure for a boilerplate drake project. It is a more thorough alternative to drake::use_drake().
  • drake is heavily function-oriented by design, and Miles’ fnmate package automatically generates boilerplate code and docstrings for functions you mention in drake plans.

High-performance computing

Thanks

Thanks to For
Edgar Ruiz Uniting drake and keras at https://github.com/sol-eng/tensorflow-w-r and providing valuable advice on the construction of the course.
Matt Dancho Publishing the original blog post with the course’s underlying case study.
Eric Nantz Reviewing the materials and providing feedback.