-
Notifications
You must be signed in to change notification settings - Fork 3
/
_targets.R
75 lines (71 loc) · 1.45 KB
/
_targets.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
library(targets)
library(tarchetypes)
source("R/functions.R")
options(tidyverse.quiet = TRUE)
# Uncomment below to use local multicore computing
# when running tar_make_clustermq().
options(clustermq.scheduler = "multicore")
# Uncomment below to deploy targets to parallel jobs
# on a Sun Grid Engine cluster when running tar_make_clustermq().
# options(clustermq.scheduler = "sge", clustermq.template = "sge.tmpl")
tar_option_set(
packages = c(
"keras",
"recipes",
"rmarkdown",
"rsample",
"tidyverse",
"yardstick"
)
)
# Define the pipeline. A pipeline is just a list of targets.
list(
tar_target(
data_file,
"data/customer_churn.csv",
format = "file",
deployment = "main"
),
tar_target(
data,
split_data(data_file),
format = "qs",
deployment = "main"
),
tar_target(
recipe,
prepare_recipe(data),
format = "qs",
deployment = "main"
),
tar_target(
units,
c(16, 32),
deployment = "main"
),
tar_target(
act,
c("relu", "sigmoid"),
deployment = "main"
),
tar_target(
run,
test_model(data, recipe, units1 = units, act1 = act),
pattern = cross(units, act),
format = "fst_tbl"
),
tar_target(
best_run,
run %>%
top_n(1, accuracy) %>%
head(1),
format = "fst_tbl",
deployment = "main"
),
tar_target(
best_model,
train_best_model(best_run, recipe),
format = "keras"
),
tar_render(report, "report.Rmd")
)