Skip to content

Commit

Permalink
refactor: same order for lower and upper in p_int and p_dbl w/ omitti…
Browse files Browse the repository at this point in the history
…ng argument name
  • Loading branch information
m-muecke committed Feb 6, 2024
1 parent 00d8b14 commit 4512ccb
Show file tree
Hide file tree
Showing 19 changed files with 74 additions and 76 deletions.
8 changes: 4 additions & 4 deletions R/LearnerClustAffinityPropagation.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ LearnerClustAP = R6Class("LearnerClustAP",
param_set = ps(
s = p_uty(tags = c("required", "train")),
p = p_uty(default = NA, tags = "train", custom_check = crate(function(x) check_numeric(x))),
q = p_dbl(lower = 0, upper = 1, tags = "train"),
maxits = p_int(lower = 1L, default = 1000L, tags = "train"),
convits = p_int(lower = 1L, default = 100L, tags = "train"),
lam = p_dbl(lower = 0.5, upper = 1, default = 0.9, tags = "train"),
q = p_dbl(0, 1, tags = "train"),
maxits = p_int(1L, default = 1000L, tags = "train"),
convits = p_int(1L, default = 100L, tags = "train"),
lam = p_dbl(0.5, 1, default = 0.9, tags = "train"),
includeSim = p_lgl(default = FALSE, tags = "train"),
details = p_lgl(default = FALSE, tags = "train"),
nonoise = p_lgl(default = FALSE, tags = "train"),
Expand Down
4 changes: 2 additions & 2 deletions R/LearnerClustAgnes.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ LearnerClustAgnes = R6Class("LearnerClustAgnes",
levels = c("average", "single", "complete", "ward", "weighted", "flexible", "gaverage"),
tags = "train"
),
trace.lev = p_int(lower = 0L, default = 0L, tags = "train"),
k = p_int(lower = 1L, default = 2L, tags = "predict"),
trace.lev = p_int(0L, default = 0L, tags = "train"),
k = p_int(1L, default = 2L, tags = "predict"),
par.method = p_uty(tags = "train", custom_check = crate(function(x) {
if (!(test_numeric(x) || test_list(x))) {
return("`par.method` needs to be a numeric vector")
Expand Down
6 changes: 3 additions & 3 deletions R/LearnerClustCMeans.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ LearnerClustCMeans = R6Class("LearnerClustCMeans",
centers = p_uty(
tags = c("required", "train"), default = 2L, custom_check = crate(check_centers)
),
iter.max = p_int(lower = 1L, default = 100L, tags = "train"),
iter.max = p_int(1L, default = 100L, tags = "train"),
verbose = p_lgl(default = FALSE, tags = "train"),
dist = p_fct(levels = c("euclidean", "manhattan"), default = "euclidean", tags = "train"),
method = p_fct(levels = c("cmeans", "ufcl"), default = "cmeans", tags = "train"),
m = p_dbl(lower = 1, default = 2, tags = "train"),
rate.par = p_dbl(lower = 0, upper = 1, tags = "train"),
m = p_dbl(1, default = 2, tags = "train"),
rate.par = p_dbl(0, 1, tags = "train"),
weights = p_uty(default = 1L, tags = "train", custom_check = crate(function(x) {
if (test_numeric(x) && all(x > 0) || check_count(x, positive = TRUE)) {
TRUE
Expand Down
6 changes: 3 additions & 3 deletions R/LearnerClustCobweb.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ LearnerClustCobweb = R6Class("LearnerClustCobweb",
#' Creates a new instance of this [R6][R6::R6Class] class.
initialize = function() {
param_set = ps(
A = p_dbl(default = 1, lower = 0, tags = "train"),
C = p_dbl(default = 0.002, lower = 0, tags = "train"),
S = p_int(default = 42L, lower = 1L, tags = "train")
A = p_dbl(0, default = 1, tags = "train"),
C = p_dbl(0, default = 0.002, tags = "train"),
S = p_int(1L, default = 42L, tags = "train")
)

super$initialize(
Expand Down
6 changes: 3 additions & 3 deletions R/LearnerClustDBSCAN.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ LearnerClustDBSCAN = R6Class("LearnerClustDBSCAN",
#' Creates a new instance of this [R6][R6::R6Class] class.
initialize = function() {
param_set = ps(
eps = p_dbl(lower = 0, tags = c("required", "train")),
minPts = p_int(lower = 0L, default = 5L, tags = "train"),
eps = p_dbl(0, tags = c("required", "train")),
minPts = p_int(0L, default = 5L, tags = "train"),
borderPoints = p_lgl(default = TRUE, tags = "train"),
weights = p_uty(tags = "train", custom_check = crate(function(x) check_numeric(x))),
search = p_fct(levels = c("kdtree", "linear", "dist"), default = "kdtree", tags = "train"),
bucketSize = p_int(lower = 1L, default = 10L, tags = "train"),
bucketSize = p_int(1L, default = 10L, tags = "train"),
splitRule = p_fct(
levels = c("STD", "MIDPT", "FAIR", "SL_MIDPT", "SL_FAIR", "SUGGEST"), default = "SUGGEST", tags = "train"
),
Expand Down
4 changes: 2 additions & 2 deletions R/LearnerClustDBSCANfpc.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ LearnerClustDBSCANfpc = R6Class("LearnerClustDBSCANfpc",
#' Creates a new instance of this [R6][R6::R6Class] class.
initialize = function() {
param_set = ps(
eps = p_dbl(lower = 0, tags = c("required", "train")),
MinPts = p_int(lower = 0L, default = 5L, tags = "train"),
eps = p_dbl(0, tags = c("required", "train")),
MinPts = p_int(0L, default = 5L, tags = "train"),
scale = p_lgl(default = FALSE, tags = "train"),
method = p_fct(levels = c("hybrid", "raw", "dist"), tags = "train"),
seeds = p_lgl(default = TRUE, tags = "train"),
Expand Down
4 changes: 2 additions & 2 deletions R/LearnerClustDiana.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ LearnerClustDiana = R6Class("LearnerClustDiana",
param_set = ps(
metric = p_fct(default = "euclidean", levels = c("euclidean", "manhattan"), tags = "train"),
stand = p_lgl(default = FALSE, tags = "train"),
trace.lev = p_int(lower = 0L, default = 0L, tags = "train"),
k = p_int(lower = 1L, default = 2L, tags = "predict")
trace.lev = p_int(0L, default = 0L, tags = "train"),
k = p_int(1L, default = 2L, tags = "predict")
)
param_set$set_values(k = 2L)

Expand Down
20 changes: 10 additions & 10 deletions R/LearnerClustEM.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ LearnerClustEM = R6Class("LearnerClustEM",
#' Creates a new instance of this [R6][R6::R6Class] class.
initialize = function() {
param_set = ps(
I = p_int(default = 100L, lower = 1L, tags = "train"),
ll_cv = p_dbl(default = 1e-6, lower = 1e-6, tags = "train"),
ll_iter = p_dbl(default = 1e-6, lower = 1e-6, tags = "train"),
M = p_dbl(default = 1e-6, lower = 1e-6, tags = "train"),
max = p_int(default = -1L, lower = -1L, tags = "train"),
N = p_int(default = -1L, lower = -1L, tags = "train"),
num_slots = p_int(default = 1L, lower = 1L, tags = "train"),
S = p_int(default = 100L, lower = 0L, tags = "train"),
X = p_int(default = 10L, lower = 1L, tags = "train"),
K = p_int(default = 10L, lower = 1L, tags = "train"),
I = p_int(1L, default = 100L, tags = "train"),
ll_cv = p_dbl(1e-6, default = 1e-6, tags = "train"),
ll_iter = p_dbl(1e-6, default = 1e-6, tags = "train"),
M = p_dbl(1e-6, default = 1e-6, tags = "train"),
max = p_int(-1L, default = -1L, tags = "train"),
N = p_int(-1L, default = -1L, tags = "train"),
num_slots = p_int(1L, default = 1L, tags = "train"),
S = p_int(0L, default = 100L, tags = "train"),
X = p_int(1L, default = 10L, tags = "train"),
K = p_int(1L, default = 10L, tags = "train"),
V = p_lgl(default = FALSE, tags = "train"),
output_debug_info = p_lgl(default = FALSE, tags = "train")
)
Expand Down
10 changes: 5 additions & 5 deletions R/LearnerClustFanny.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ LearnerClustFanny = R6Class("LearnerClustFanny",
#' Creates a new instance of this [R6][R6::R6Class] class.
initialize = function() {
param_set = ps(
k = p_int(lower = 1L, default = 2L, tags = c("required", "train")),
memb.exp = p_dbl(lower = 1, default = 2, tags = "train"),
k = p_int(1L, default = 2L, tags = c("required", "train")),
memb.exp = p_dbl(1, default = 2, tags = "train"),
metric = p_fct(default = "euclidean", levels = c("euclidean", "manhattan", "SqEuclidean"), tags = "train"),
stand = p_lgl(default = FALSE, tags = "train"),
maxit = p_int(lower = 0L, default = 500L, tags = "train"),
tol = p_dbl(lower = 0, default = 1e-15, tags = "train"),
trace.lev = p_int(lower = 0L, default = 0L, tags = "train")
maxit = p_int(0L, default = 500L, tags = "train"),
tol = p_dbl(0, default = 1e-15, tags = "train"),
trace.lev = p_int(0L, default = 0L, tags = "train")
)
param_set$set_values(k = 2L)

Expand Down
4 changes: 2 additions & 2 deletions R/LearnerClustFarthestFirst.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ LearnerClustFarthestFirst = R6Class("LearnerClustFF",
#' Creates a new instance of this [R6][R6::R6Class] class.
initialize = function() {
param_set = ps(
N = p_int(default = 2L, lower = 1L, tags = "train"),
S = p_int(default = 1L, lower = 1L, tags = "train"),
N = p_int(1L, default = 2L, tags = "train"),
S = p_int(1L, default = 1L, tags = "train"),
output_debug_info = p_lgl(default = FALSE, tags = "train")
)

Expand Down
4 changes: 1 addition & 3 deletions R/LearnerClustFeatureless.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ LearnerClustFeatureless = R6Class("LearnerClustFeatureless",
#' @description
#' Creates a new instance of this [R6][R6::R6Class] class.
initialize = function() {
param_set = ps(
num_clusters = p_int(lower = 1L, default = 1L, tags = c("required", "train", "predict"))
)
param_set = ps(num_clusters = p_int(1L, default = 1L, tags = c("required", "train", "predict")))
param_set$set_values(num_clusters = 1L)

super$initialize(
Expand Down
2 changes: 1 addition & 1 deletion R/LearnerClustHclust.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ LearnerClustHclust = R6Class("LearnerClustHclust",
diag = p_lgl(default = FALSE, tags = c("train", "dist")),
upper = p_lgl(default = FALSE, tags = c("train", "dist")),
p = p_dbl(default = 2, tags = c("train", "dist")),
k = p_int(lower = 1L, default = 2L, tags = "predict")
k = p_int(1L, default = 2L, tags = "predict")
)

# param deps
Expand Down
6 changes: 3 additions & 3 deletions R/LearnerClustKKMeans.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ LearnerClustKKMeans = R6Class("LearnerClustKKMeans",
levels = c("vanilladot", "polydot", "rbfdot", "tanhdot", "laplacedot", "besseldot", "anovadot", "splinedot"),
tags = "train"
),
sigma = p_dbl(lower = 0, tags = "train"),
degree = p_int(default = 3L, lower = 1L, tags = "train"),
scale = p_dbl(default = 1, lower = 0, tags = "train"),
sigma = p_dbl(0, tags = "train"),
degree = p_int(1L, default = 3L, tags = "train"),
scale = p_dbl(0, default = 1, tags = "train"),
offset = p_dbl(default = 1, tags = "train"),
order = p_int(default = 1L, tags = "train"),
alg = p_fct(levels = c("kkmeans", "kerninghan"), default = "kkmeans", tags = "train"),
Expand Down
6 changes: 3 additions & 3 deletions R/LearnerClustKMeans.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ LearnerClustKMeans = R6Class("LearnerClustKMeans",
centers = p_uty(
tags = c("required", "train"), default = 2L, custom_check = crate(check_centers)
),
iter.max = p_int(lower = 1L, default = 10L, tags = c("train")),
iter.max = p_int(1L, default = 10L, tags = c("train")),
algorithm = p_fct(
levels = c("Hartigan-Wong", "Lloyd", "Forgy", "MacQueen"), default = "Hartigan-Wong", tags = c("train")
),
nstart = p_int(lower = 1L, default = 1L, tags = c("train")),
trace = p_int(lower = 0L, default = 0L, tags = c("train"))
nstart = p_int(1L, default = 1L, tags = c("train")),
trace = p_int(0L, default = 0L, tags = c("train"))
)
param_set$set_values(centers = 2L)

Expand Down
4 changes: 2 additions & 2 deletions R/LearnerClustMeanShift.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ LearnerClustMeanShift = R6Class("LearnerClustMeanShift",
}
})),
subset = p_uty(tags = "train", custom_check = crate(function(x) check_numeric(x))),
scaled = p_int(lower = 0L, default = 1, tags = "train"),
iter = p_int(lower = 1L, default = 200L, tags = "train"),
scaled = p_int(0L, default = 1, tags = "train"),
iter = p_int(1L, default = 200L, tags = "train"),
thr = p_dbl(default = 0.01, tags = "train")
)

Expand Down
16 changes: 8 additions & 8 deletions R/LearnerClustMiniBatchKMeans.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ LearnerClustMiniBatchKMeans = R6Class("LearnerClustMiniBatchKMeans",
#' Creates a new instance of this [R6][R6::R6Class] class.
initialize = function() {
param_set = ps(
clusters = p_int(default = 2L, lower = 1L, tags = "train"),
batch_size = p_int(lower = 1L, default = 10L, tags = "train"),
num_init = p_int(lower = 1L, default = 1L, tags = "train"),
max_iters = p_int(lower = 1L, default = 100L, tags = "train"),
init_fraction = p_dbl(lower = 0, upper = 1, default = 1, tags = "train"),
clusters = p_int(1L, default = 2L, tags = "train"),
batch_size = p_int(1L, default = 10L, tags = "train"),
num_init = p_int(1L, default = 1L, tags = "train"),
max_iters = p_int(1L, default = 100L, tags = "train"),
init_fraction = p_dbl(0, 1, default = 1, tags = "train"),
initializer = p_fct(
levels = c("optimal_init", "quantile_init", "kmeans++", "random"), default = "kmeans++", tags = "train"
),
early_stop_iter = p_int(lower = 1L, default = 10L, tags = "train"),
early_stop_iter = p_int(1L, default = 10L, tags = "train"),
verbose = p_lgl(default = FALSE, tags = "train"),
CENTROIDS = p_uty(default = NULL, tags = "train"),
tol = p_dbl(default = 1e-04, lower = 0, tags = "train"),
tol_optimal_init = p_dbl(default = 0.3, lower = 0, tags = "train"),
tol = p_dbl(0, default = 1e-04, tags = "train"),
tol_optimal_init = p_dbl(0, default = 0.3, tags = "train"),
seed = p_int(default = 1L, tags = "train")
)
param_set$set_values(clusters = 2L)
Expand Down
6 changes: 3 additions & 3 deletions R/LearnerClustPAM.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ LearnerClustPAM = R6Class("LearnerClustPAM",
#' Creates a new instance of this [R6][R6::R6Class] class.
initialize = function() {
param_set = ps(
k = p_int(lower = 1L, default = 2L, tags = c("required", "train")),
k = p_int(1L, default = 2L, tags = c("required", "train")),
metric = p_fct(levels = c("euclidian", "manhattan"), tags = "train"),
medoids = p_uty(
default = NULL, tags = "train", custom_check = crate(function(x) check_integerish(x, null.ok = TRUE))
),
stand = p_lgl(default = FALSE, tags = "train"),
do.swap = p_lgl(default = TRUE, tags = "train"),
pamonce = p_int(lower = 0L, upper = 5L, default = 0, tags = "train"),
trace.lev = p_int(lower = 0L, default = 0L, tags = "train")
pamonce = p_int(0L, 5L, default = 0, tags = "train"),
trace.lev = p_int(0L, default = 0L, tags = "train")
)
param_set$set_values(k = 2L)

Expand Down
16 changes: 8 additions & 8 deletions R/LearnerClustSimpleKMeans.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ LearnerClustSimpleKMeans = R6Class("LearnerClustSimpleKMeans",
A = p_uty(default = "weka.core.EuclideanDistance", tags = "train"),
C = p_lgl(default = FALSE, tags = "train"),
fast = p_lgl(default = FALSE, tags = "train"),
I = p_int(default = 100L, lower = 1L, tags = "train"),
init = p_int(default = 0L, lower = 0L, upper = 3L, tags = "train"),
I = p_int(1L, default = 100L, tags = "train"),
init = p_int(0L, 3L, default = 0L, tags = "train"),
M = p_lgl(default = FALSE, tags = "train"),
max_candidates = p_int(default = 100L, lower = 1L, tags = "train"),
min_density = p_int(default = 2L, lower = 1L, tags = "train"),
N = p_int(default = 2L, lower = 1L, tags = "train"),
num_slots = p_int(default = 1L, lower = 1L, tags = "train"),
max_candidates = p_int(1L, default = 100L, tags = "train"),
min_density = p_int(1L, default = 2L, tags = "train"),
N = p_int(1L, default = 2L, tags = "train"),
num_slots = p_int(1L, default = 1L, tags = "train"),
O = p_lgl(default = FALSE, tags = "train"),
periodic_pruning = p_int(default = 10000L, lower = 1L, tags = "train"),
S = p_int(default = 10L, lower = 0L, tags = "train"),
periodic_pruning = p_int(1L, default = 10000L, tags = "train"),
S = p_int(0L, default = 10L, tags = "train"),
t2 = p_dbl(default = -1, tags = "train"),
t1 = p_dbl(default = -1.5, tags = "train"),
V = p_lgl(default = FALSE, tags = "train"),
Expand Down
18 changes: 9 additions & 9 deletions R/LearnerClustXMeans.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ LearnerClustXMeans = R6Class("LearnerClustXMeans",
#' Creates a new instance of this [R6][R6::R6Class] class.
initialize = function() {
param_set = ps(
B = p_dbl(default = 1, lower = 0, tags = "train"),
C = p_dbl(default = 0, lower = 0, tags = "train"),
B = p_dbl(0, default = 1, tags = "train"),
C = p_dbl(0, default = 0, tags = "train"),
D = p_uty(default = "weka.core.EuclideanDistance", tags = "train"),
H = p_int(default = 4L, lower = 1L, tags = "train"),
I = p_int(default = 1L, lower = 1L, tags = "train"),
J = p_int(default = 1000L, lower = 1L, tags = "train"),
H = p_int(1L, default = 4L, tags = "train"),
I = p_int(1L, default = 1L, tags = "train"),
J = p_int(1L, default = 1000L, tags = "train"),
K = p_uty(default = "", tags = "train"),
L = p_int(default = 2L, lower = 1L, tags = "train"),
M = p_int(default = 1000L, lower = 1L, tags = "train"),
S = p_int(default = 10L, lower = 1L, tags = "train"),
U = p_int(default = 0L, lower = 0L, tags = "train"),
L = p_int(1L, default = 2L, tags = "train"),
M = p_int(1L, default = 1000L, tags = "train"),
S = p_int(1L, default = 10L, tags = "train"),
U = p_int(0L, default = 0L, tags = "train"),
use_kdtree = p_lgl(default = FALSE, tags = "train"),
N = p_uty(tags = "train"),
O = p_uty(tags = "train"),
Expand Down

0 comments on commit 4512ccb

Please sign in to comment.