-
Notifications
You must be signed in to change notification settings - Fork 12
/
_drake.R
executable file
·94 lines (77 loc) · 2.43 KB
/
_drake.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# load R packages --------------------------------------------------------------
source("code/099-packages.R")
# create log directory
fs::dir_create("log")
library("drake")
library("magrittr")
library("conflicted")
conflict_prefer("target", "drake", quiet = TRUE)
conflict_prefer("pull", "dplyr", quiet = TRUE)
conflict_prefer("filter", "dplyr", quiet = TRUE)
suppressMessages(library("R.utils"))
Sys.setenv(DISPLAY = ":99")
options(
# set this to "slurm" if you have access to a Slurm cluster
clustermq.scheduler = "multicore",
clustermq.template = "~/papers/2019-feature-selection/slurm_clustermq.tmpl"
)
# load mlr extra learner -------------------------------------------------------
source("https://raw.githubusercontent.com/mlr-org/mlr-extralearner/master/R/RLearner_regr_ranger_mtry_pow.R") # nolint
# source functions -------------------------------------------------------------
R.utils::sourceDirectory("R")
R.utils::sourceDirectory("code")
# Combine all plans ------------------------------------------------------------
plan_paper <- bind_plans(
download_data_plan,
hyperspectral_processing_plan,
data_preprocessing_plan,
tasks_plan,
filter_eda_plan,
param_sets_plan,
learners_plan,
filter_wrapper_plan,
resampling_plan,
tune_ctrl_plan,
tune_wrapper_plan,
benchmark_plan,
bm_aggregated_plan,
feature_imp_plan,
reports_plan_paper
)
# paper ------------------------------------------------------------------------
# config for long running tasks
drake_config(plan_paper,
targets = c(
# replace this with the target name that should be computed
# c("eda_wfr")
"benchmark_no_models"
),
verbose = 1,
lazy_load = "eager",
packages = NULL,
log_make = "log/drake-BM.log",
caching = "main",
template = list(
log_file = "log/worker-BM%a.log", n_cpus = 4,
memory = 3500, job_name = "paper2-BM",
partition = "all"
),
prework = list(
quote(load_packages()),
# seed for parallel tasks
quote(set.seed(1, "L'Ecuyer-CMRG")),
# intra-target parallelization (when running CV with mlr)
quote(parallelStart(
mode = "multicore",
cpus = 4,
level = "mlr.resample",
# level = "mlr.selectFeatures", # for mlr feature importance calculation
mc.cleanup = TRUE,
mc.preschedule = FALSE
))
),
garbage_collection = TRUE,
jobs = 1,
parallelism = "clustermq",
keep_going = FALSE, recover = FALSE, lock_envir = FALSE, lock_cache = FALSE
)