-
Notifications
You must be signed in to change notification settings - Fork 20
/
strategy_support.R
63 lines (55 loc) · 2.13 KB
/
strategy_support.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
##' Set a suitable hyperparameter function for chosen physiological model
##' @title Hyperparameters for FF16 physiological model
##' @param type Any strategy name as a string, e.g.: \code{"FF16"}.
##' @rdname Hyperparameter_functions
##' @export
# if you update this function (even syntactic changes) update the function update_smc_support in the scaffolder
make_hyperpar <- function(type) {
switch(type,
FF16=make_FF16_hyperpar,
FF16r=make_FF16_hyperpar,
stop("Unknown type ", type))
}
param_hyperpar <- function(parameters) {
type <- attr(parameters$strategy_default, "class")
switch(type,
FF16_Strategy=FF16_hyperpar,
FF16r_Strategy=FF16r_hyperpar,
stop("Unknown type ", type))
}
##' @rdname Hyperparameter_functions
##' @export
# if you update this function (even syntactic changes) update the function update_smc_support in the scaffolder
hyperpar <- function(type) {
switch(type,
FF16=FF16_hyperpar,
FF16r=FF16r_hyperpar,
stop("Unknown type ", type))
}
make_environment <- function(type, ...) {
switch(type,
FF16=FF16_make_environment(...),
FF16r=FF16r_make_environment(...),
stop("Unknown type ", type))
}
cohort_schedule_max_time_default <- function(p) {
cl <- class(p)[[1]]
switch(cl,
"Parameters<FF16,FF16_Env>"=`cohort_schedule_max_time_default__Parameters___FF16__FF16_Env`,
"Parameters<FF16r,FF16r_Env>"=`cohort_schedule_max_time_default__Parameters___FF16r__FF16r_Env`,
stop("Unknown type: ", cl))(p)
}
cohort_schedule_default <- function(p) {
cl <- class(p)[[1]]
switch(cl,
"Parameters<FF16,FF16_Env>"=`cohort_schedule_default__Parameters___FF16__FF16_Env`,
"Parameters<FF16r,FF16r_Env>"=`cohort_schedule_default__Parameters___FF16r__FF16r_Env`,
stop("Unknown type: ", cl))(p)
}
make_cohort_schedule <- function(p) {
cl <- class(p)[[1]]
switch(cl,
"Parameters<FF16,FF16_Env>"=`make_cohort_schedule__Parameters___FF16__FF16_Env`,
"Parameters<FF16r,FF16r_Env>"=`make_cohort_schedule__Parameters___FF16r__FF16r_Env`,
stop("Unknown type: ", cl))(p)
}