| tl_add_cluster_features | R Documentation |
Add cluster assignments as features for supervised learning. This semi-supervised approach can capture non-linear patterns.
tl_add_cluster_features(data, response = NULL, method = "kmeans", ...)
data |
A data frame |
response |
Response variable name (will be excluded from clustering) |
method |
Clustering method: "kmeans", "pam", "hclust", "dbscan" |
... |
Additional arguments for clustering |
Original data with cluster assignment column(s) added
# Add cluster features before supervised learning
data_with_clusters <- tl_add_cluster_features(iris, response = "Species",
method = "kmeans", k = 3)
model <- tl_model(data_with_clusters, Species ~ ., method = "forest")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.