powered by
Calculates Sum of Squared Error in each cluster
sse_within( object, new_data = NULL, dist_fun = function(x, y) { philentropy::dist_many_many(x, y, method = "euclidean") } )
A tibble with two columns, the cluster name and the SSE within that cluster.
A fitted kmeans tidyclust model
A dataset to predict on. If NULL, uses trained clustering.
NULL
A function for calculating distances to centroids. Defaults to Euclidean distance on processed data.
sse_within_total() is the corresponding cluster metric function that returns the sum of the values given by sse_within().
sse_within_total()
sse_within()
kmeans_spec <- k_means(num_clusters = 5) %>% set_engine("stats") kmeans_fit <- fit(kmeans_spec, ~., mtcars) sse_within(kmeans_fit)
Run the code above in your browser using DataLab