
Semi-supervised learning via k-means representative labeling
Source:R/geron_w4d_native.R
morie_geron_semisupervised_cluster.RdClusters the unlabeled pool (Lloyd/k-means++ on a deterministic LCG stream), finds each cluster's real-point representative closest to its centroid, labels that representative from the nearest labeled point, and propagates the label to every cluster member.
Usage
morie_geron_semisupervised_cluster(
X,
X_labeled,
y_labeled,
n_clusters = 2,
seed = 0,
y_true = NULL
)Value
list with labels, cluster, centers, representatives, representative_labels, accuracy, estimate, n, method.
Examples
morie_geron_semisupervised_cluster(X = c(1, 2, 3, 4, 5, 6, 7, 8),
X_labeled = c(1, 2, 3, 4, 5, 6, 7, 8), y_labeled = c(1, 2, 3, 4, 5, 6, 7, 8))
#> $labels
#> [1] 2 2 2 2 6 6 6 6
#>
#> $cluster
#> [1] 0 0 0 0 1 1 1 1
#>
#> $centers
#> [,1]
#> [1,] 2.5
#> [2,] 6.5
#>
#> $representatives
#> [1] 1 5
#>
#> $representative_labels
#> [1] 2 6
#>
#> $accuracy
#> NULL
#>
#> $estimate
#> [1] 0.25
#>
#> $n
#> [1] 8
#>
#> $method
#> [1] "k-means clustering, nearest-labeled representative labeling, propagation to members"
#>