This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
training.R
51 lines (36 loc) · 1.61 KB
/
training.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
################################################################################
# HACKATHON PARTICIPANTS -- DO NOT EDIT THIS FILE #
################################################################################
response <- commandArgs(trailingOnly = TRUE)[1]
source(paste0("prepare_", response, "_data.R"))
source(paste0(response, "_model.R"))
################################################################################
# build the training data set and record the time required to do so.
tic <- Sys.time()
training_data <- do.call(paste0("prepare_", response, "_data"), list(training = TRUE))
toc <- Sys.time()
cat("seconds elapsed to prepare",
response,
"training data |",
as.numeric(difftime(toc, tic, units = "secs")),
"\n",
file = "./output/evaluation.txt",
sep = " ",
append = TRUE)
################################################################################
# Train the model and record the time required to do so.
tic <- Sys.time()
trained_model <- do.call(paste0(response, "_model"), list(data = training_data))
toc <- Sys.time()
saveRDS(trained_model, file = paste0("./output/trained_", response, "_model.rds"))
cat("seconds elapsed to train the",
response,
"model |",
as.numeric(difftime(toc, tic, units = "secs")),
"\n",
file = "./output/evaluation.txt",
sep = " ",
append = TRUE)
################################################################################
# End of File #
################################################################################