Learn R Programming

tidyclust (version 0.2.4)

sse_ratio: Compute the ratio of the WSS to the total SSE

Description

Compute the ratio of the WSS to the total SSE

Usage

sse_ratio(object, ...)

# S3 method for cluster_spec sse_ratio(object, ...)

# S3 method for cluster_fit sse_ratio(object, new_data = NULL, dist_fun = NULL, ...)

# S3 method for workflow sse_ratio(object, new_data = NULL, dist_fun = NULL, ...)

sse_ratio_vec( object, new_data = NULL, dist_fun = function(x, y) { philentropy::dist_many_many(x, y, method = "euclidean") }, ... )

Value

A tibble with 3 columns; .metric, .estimator, and .estimate.

Arguments

object

A fitted kmeans tidyclust model

...

Other arguments passed to methods.

new_data

A dataset to predict on. If NULL, uses trained clustering.

dist_fun

A function for calculating distances to centroids. Defaults to Euclidean distance on processed data.

See Also

Other cluster metric: silhouette_avg(), sse_total(), sse_within_total()

Examples

Run this code
kmeans_spec <- k_means(num_clusters = 5) %>%
  set_engine("stats")

kmeans_fit <- fit(kmeans_spec, ~., mtcars)

sse_ratio(kmeans_fit)

sse_ratio_vec(kmeans_fit)

Run the code above in your browser using DataLab