Skip to content

Prepares data and distance matrices for metric calculation

Usage

prep_data_dist(
  object,
  new_data = NULL,
  dists = NULL,
  dist_fun = philentropy::distance
)

Arguments

object

A fitted cluster_spec object.

new_data

A dataset to calculate predictions on. If NULL, the trained cluster assignments from the fitted object are used.

dists

A distance matrix for the data. If NULL, distance is computed on new_data using the stats::dist() function.

dist_fun

A function of the form function(x) that takes a data frame or matrix and returns a dist object. Defaults to philentropy::distance with Euclidean distance. See philentropy::getDistMethods() for a list of supported methods, and vignette("tuning_and_metrics", package = "tidyclust") for usage examples.

Value

A list