
Wrapper function to generate k-means parameters
Source:R/params-examples.R, R/params-generated.R
params_kmeans.RdWrapper function to generate k-means parameters
Arguments
- metric
String. Distance metric to use. One of
c("euclidean", "cosine"). Defaults to"euclidean".- max_iters
Integer. Maximum number of iterations. Defaults to
1000L.- batch_size
Integer. Mini-batch size. Only used when
method = "minibatch". Defaults to4096L.- drift_threshold
Numeric. Below which centroid drift the mini-batch k-means is considered converged. Only used when
method = "minibatch". Defaults to1e-04.- lr_alpha
Numeric. Learning rate decay for the mini-batch k-means. Original paper uses
1.0. Defaults to1.0.- init
String. The initialisation of the centroids. One of
c("parallel", "random"). Defaults to"parallel".- use_hamerly
Boolean or
NULL. Shall Hamerly's method be used (only ifmetric == "euclidean"). Defaults toNULL.- use_gemm
Boolean or
NULL. Shall the GEMM path be used. Useful on high dimensional data. IfNULL, choice will be based on heuristics. Defaults toNULL.
Value
A named list with the following elements:
metric - String. Distance metric to use. One of
c("euclidean", "cosine"). Defaults to"euclidean".max_iters - Integer. Maximum number of iterations. Defaults to
1000L.batch_size - Integer. Mini-batch size. Only used when
method = "minibatch". Defaults to4096L.drift_threshold - Numeric. Below which centroid drift the mini-batch k-means is considered converged. Only used when
method = "minibatch". Defaults to1e-04.lr_alpha - Numeric. Learning rate decay for the mini-batch k-means. Original paper uses
1.0. Defaults to1.0.init - String. The initialisation of the centroids. One of
c("parallel", "random"). Defaults to"parallel".use_hamerly - Boolean or
NULL. Shall Hamerly's method be used (only ifmetric == "euclidean"). Defaults toNULL.use_gemm - Boolean or
NULL. Shall the GEMM path be used. Useful on high dimensional data. IfNULL, choice will be based on heuristics. Defaults toNULL.
Examples
params_kmeans()
#> $metric
#> [1] "euclidean"
#>
#> $max_iters
#> [1] 1000
#>
#> $batch_size
#> [1] 4096
#>
#> $drift_threshold
#> [1] 1e-04
#>
#> $lr_alpha
#> [1] 1
#>
#> $init
#> [1] "parallel"
#>
#> $use_hamerly
#> NULL
#>
#> $use_gemm
#> NULL
#>
params_kmeans(metric = "cosine", max_iters = 100L)
#> $metric
#> [1] "cosine"
#>
#> $max_iters
#> [1] 100
#>
#> $batch_size
#> [1] 4096
#>
#> $drift_threshold
#> [1] 1e-04
#>
#> $lr_alpha
#> [1] 1
#>
#> $init
#> [1] "parallel"
#>
#> $use_hamerly
#> NULL
#>
#> $use_gemm
#> NULL
#>