About

In this chapter, you will test your knowledge and build a complete pipeline from scratch. Requirements:

  1. Create a dataset and recipe target for each dataset in data/.
  2. Fit a model to each dataset for each activation function (relu, sigmoid, softmax) for a total of 9 models.
  3. Identify the highest-accuracy model. (No need to retrain it at the end.)

Tips:

  1. As you write code, remember the incremental development strategy discussed in 2-pipelines.Rmd: write the first targets, then explore them, then add new targets gradually. Remember to check the graph and the manifest early and often.
  2. Formal branching, e.g. tar_target(pattern = map(...)) will help in some places, but not others. Throughout this short course, sometimes we branched over hyperparameters, while other times we branched over datasets. If you try to use branching everywhere, you risk overcomplicating the problem. And if you use branching nowhere, you will need to type out every single model by hand, which is not the recommended solution here.
  3. You may wish to use static branching functions tar_map() and tar_combine() from the tarchetypes package, but this is not required.
  4. This chapter includes a modified set of functions in 7-challenge/functions.R. test_model() now omits some hyperparameters but includes the sizes of the training and testing datasets. Here is an example collection of model runs. So the model runs should look like the rows of this data frame.
readRDS("7-challenge/runs.rds")

Setup

Start with a fresh data store.

library(targets)
tar_destroy()

Begin with a blank _targets.R file.

unlink("_targets.R")
tar_edit()

One possible solution is at the bottom of 7-challenge/solution_targets.R.



kenshuri/targets-tuto documentation built on April 19, 2021, 9:58 a.m.