
Mini-batch k-means, Sculley's variant (Geron Ch 8, morie.fn hmmbkm)
Source:R/geron_w4b_native.R
morie_geron_minibatch_kmeans.RdBatch draws via the shared LCG stream, not numpy PCG64 choice.
Examples
X <- matrix(c(1, 2, 3, 4), ncol = 1)
morie_geron_minibatch_kmeans(X, n_clusters = 2, batch_size = 2,
seed = 0, n_iter = 200)
#> $labels
#> [1] 0 0 1 1
#>
#> $centers
#> [,1]
#> [1,] 1.490
#> [2,] 3.495
#>
#> $inertia
#> [1] 1.00025
#>
#> $counts
#> [1] 200 200
#>
#> $n_iter
#> [1] 200
#>
#> $estimate
#> [1] 1.00025
#>
#> $n
#> [1] 4
#>
#> $method
#> [1] "Mini-batch k-means"
#>