sse_within_total: Compute the sum of within-cluster SSE

View source: R/metric-sse.R

sse_within_totalR Documentation

Compute the sum of within-cluster SSE

Description

Compute the sum of within-cluster SSE

Usage

sse_within_total(object, ...)

## S3 method for class 'cluster_spec'
sse_within_total(object, ...)

## S3 method for class 'cluster_fit'
sse_within_total(object, new_data = NULL, dist_fun = NULL, ...)

## S3 method for class 'workflow'
sse_within_total(object, new_data = NULL, dist_fun = NULL, ...)

sse_within_total_vec(object, new_data = NULL, dist_fun = Rfast::dista, ...)

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.

Details

Not to be confused with sse_within() that returns a tibble with within-cluster SSE, one row for each cluster.

Value

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

See Also

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

Examples

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

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

sse_within_total(kmeans_fit)

sse_within_total_vec(kmeans_fit)

tidyclust documentation built on Sept. 26, 2023, 1:08 a.m.