File: makeParamFuns.R

package info (click to toggle)
r-cran-paramhelpers 1.14.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 992 kB
  • sloc: ansic: 102; sh: 13; makefile: 2
file content (108 lines) | stat: -rw-r--r-- 4,623 bytes parent folder | download | duplicates (3)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#' @rdname Param
#' @export
makeNumericParam = function(id, lower = -Inf, upper = Inf, allow.inf = FALSE,
  default, trafo = NULL, requires = NULL, tunable = TRUE, special.vals = list()) {
  makeParam(id = id, type = "numeric", learner.param = FALSE, lower = lower,
    upper = upper, allow.inf = allow.inf,
    default = default, trafo = trafo, requires = requires, tunable = tunable, special.vals = special.vals)
}

#' @rdname Param
#' @export
makeNumericVectorParam = function(id, len, lower = -Inf, upper = Inf, cnames = NULL,
  allow.inf = FALSE, default, trafo = NULL, requires = NULL,
  tunable = TRUE, special.vals = list()) {
  makeParam(id = id, type = "numericvector", learner.param = FALSE, len = len, lower = lower,
    upper = upper, cnames = cnames, allow.inf = allow.inf,
    default = default, trafo = trafo, requires = requires, tunable = tunable, special.vals = special.vals)
}

#' @rdname Param
#' @export
makeIntegerParam = function(id, lower = -Inf, upper = Inf, default, trafo = NULL,
  requires = NULL, tunable = TRUE, special.vals = list()) {
  makeParam(id = id, type = "integer", learner.param = FALSE, lower = lower,
    upper = upper, default = default,
    trafo = trafo, requires = requires, tunable = tunable, special.vals = special.vals)
}

#' @rdname Param
#' @export
makeIntegerVectorParam = function(id, len, lower = -Inf, upper = Inf, cnames = NULL,
  default, trafo = NULL, requires = NULL, tunable = TRUE, special.vals = list()) {
  makeParam(id = id, type = "integervector", learner.param = FALSE, len = len, lower = lower, upper = upper,
    cnames = cnames, default = default, trafo = trafo,
    requires = requires, tunable = tunable, special.vals = special.vals)
}

#' @rdname Param
#' @export
makeLogicalParam = function(id, default, requires = NULL, tunable = TRUE, special.vals = list()) {
  values = list("TRUE" = TRUE, "FALSE" = FALSE)
  makeParam(id = id, type = "logical", learner.param = FALSE,
    values = values, default = default,
    trafo = NULL, requires = requires, tunable = tunable, special.vals = special.vals)
}

#' @rdname Param
#' @export
makeLogicalVectorParam = function(id, len, cnames = NULL, default,
  requires = NULL, tunable = TRUE, special.vals = list()) {
  values = list("TRUE" = TRUE, "FALSE" = FALSE)
  makeParam(id = id, type = "logicalvector", learner.param = FALSE, len = len,
    values = values, cnames = cnames, default = default,
    trafo = NULL, requires = requires, tunable = tunable, special.vals = special.vals)
}

#' @rdname Param
#' @export
makeDiscreteParam = function(id, values, trafo = NULL, default,
  requires = NULL, tunable = TRUE, special.vals = list()) {
  makeParam(id = id, type = "discrete", learner.param = FALSE,
    values = values, default = default,
    trafo = trafo, requires = requires, tunable = tunable, special.vals = special.vals)
}

#' @rdname Param
#' @export
makeDiscreteVectorParam = function(id, len, values, trafo = NULL, default, requires = NULL,
  tunable = TRUE, special.vals = list()) {
  makeParam(id = id, type = "discretevector", learner.param = FALSE, len = len,
    values = values, default = default,
    trafo = trafo, requires = requires, tunable = tunable, special.vals = special.vals)
}

#' @rdname Param
#' @export
makeFunctionParam = function(id, default = default, requires = NULL, special.vals = list()) {
  makeParam(id = id, type = "function", learner.param = FALSE,
    values = NULL, default = default, trafo = NULL,
    requires = requires, tunable = FALSE, special.vals = special.vals)
}

# FIXME: what happens if NA is later used for untyped params? because we might interpret this as
# missing value wrt. dependent params
#' @rdname Param
#' @export
makeUntypedParam = function(id, default, requires = NULL, tunable = TRUE, special.vals = list()) {
  makeParam(id = id, type = "untyped", learner.param = FALSE,
    values = NULL, default = default, trafo = NULL,
    requires = requires, tunable = TRUE, special.vals = special.vals)
}

#' @rdname Param
#' @export
makeCharacterParam = function(id, default, requires = NULL, special.vals = list()) {
  makeParam(id = id, type = "character", learner.param = FALSE,
    default = default, trafo = NULL,
    requires = requires, tunable = FALSE, special.vals = special.vals)
}

#' @rdname Param
#' @export
makeCharacterVectorParam = function(id, len, cnames = NULL, default,
  requires = NULL, special.vals = list()) {
  makeParam(id = id, type = "charactervector", learner.param = FALSE, len = len,
    cnames = cnames, default = default,
    trafo = NULL, requires = requires, tunable = FALSE, special.vals = special.vals)
}