
k-means++ seeding, D^2 sampling (Geron Ch 8, morie.fn hmkmpp)
Source:R/geron_w4b_native.R
morie_geron_kmeans_plus_plus.RdRNG substitute via the shared LCG stream (not numpy PCG64).
Examples
morie_geron_kmeans_plus_plus(X = c(1, 2, 3, 4, 5, 6, 7, 8), n_clusters = 5L)
#> $centers
#> [,1]
#> [1,] 2
#> [2,] 6
#> [3,] 4
#> [4,] 5
#> [5,] 7
#>
#> $indices
#> [1] 1 5 3 4 6
#>
#> $d2
#> [1] 1 0 1 0 0 0 0 1
#>
#> $min_pair_distance
#> [1] 1
#>
#> $estimate
#> [1] 3
#>
#> $n
#> [1] 8
#>
#> $method
#> [1] "k-means++ seeding (D^2 sampling)"
#>