19
19
# ' @export
20
20
# ' @template seealso_learner
21
21
# ' @template example
22
- LearnerClustKKMeans = R6Class(" LearnerClustKKMeans" ,
22
+ LearnerClustKKMeans = R6Class(
23
+ " LearnerClustKKMeans" ,
23
24
inherit = LearnerClust ,
24
25
public = list (
25
26
# ' @description
@@ -33,10 +34,15 @@ LearnerClustKKMeans = R6Class("LearnerClustKKMeans",
33
34
tags = " train"
34
35
),
35
36
sigma = p_dbl(
36
- 0 , tags = " train" , depends = quote(kernel %in% c(" rbfdot" , " anovadot" , " besseldot" , " laplacedot" ))
37
+ 0 ,
38
+ tags = " train" ,
39
+ depends = quote(kernel %in% c(" rbfdot" , " anovadot" , " besseldot" , " laplacedot" ))
37
40
),
38
41
degree = p_int(
39
- 1L , default = 3L , tags = " train" , depends = quote(kernel %in% c(" polydot" , " anovadot" , " besseldot" ))
42
+ 1L ,
43
+ default = 3L ,
44
+ tags = " train" ,
45
+ depends = quote(kernel %in% c(" polydot" , " anovadot" , " besseldot" ))
40
46
),
41
47
scale = p_dbl(0 , default = 1 , tags = " train" , depends = quote(kernel %in% c(" polydot" , " tanhdot" ))),
42
48
offset = p_dbl(default = 1 , tags = " train" , depends = quote(kernel %in% c(" polydot" , " tanhdot" ))),
@@ -83,11 +89,13 @@ LearnerClustKKMeans = R6Class("LearnerClustKKMeans",
83
89
# kernel product between each new datapoint and itself: rows are identical
84
90
d_xx = matrix (
85
91
rep(diag(kernlab :: kernelMatrix(K , as.matrix(data ))), each = ncol(d_xc )),
86
- ncol = ncol(d_xc ), byrow = TRUE
92
+ ncol = ncol(d_xc ),
93
+ byrow = TRUE
87
94
)
88
95
# kernel product between each center and itself: columns are identical
89
96
d_cc = matrix (
90
- rep(diag(kernlab :: kernelMatrix(K , as.matrix(c ))), each = nrow(d_xc )), nrow = nrow(d_xc )
97
+ rep(diag(kernlab :: kernelMatrix(K , as.matrix(c ))), each = nrow(d_xc )),
98
+ nrow = nrow(d_xc )
91
99
)
92
100
# this is the squared kernel distance to the centers
93
101
d2 = d_xx + d_cc - 2 * d_xc
0 commit comments