Directors are functions that tell the partition algorithm what to try to reduce. as_director() is a helper function to create new directors to be used in partitioners. partitioners can be created with as_partitioner().

direct_k_cluster() assigns each variable to a cluster using K-means. As the partition looks for the best reduction, direct_k_cluster() iterates through values of k to assign clusters. This search is handled by the binary search method by default and thus does not necessarily need to fit every value of k.

direct_k_cluster(
  .partition_step,
  algorithm = c("armadillo", "Hartigan-Wong", "Lloyd", "Forgy", "MacQueen"),
  search = c("binary", "linear"),
  init_k = NULL,
  seed = 1L
)

Arguments

.partition_step

a partition_step object

algorithm

The K-Means algorithm to use. The default is a fast version of the LLoyd algorithm written in armadillo. The rest are options in kmeans(). In general, armadillo is fastest, but the other algorithms can be faster in high dimensions.

The search method. Binary search is generally more efficient but linear search can be faster in very low dimensions.

init_k

The initial k to test. If NULL, then the initial k is the threshold times the number of variables.

seed

The seed to set for reproducibility

Value

a partition_step object

See also

Other directors: as_director(), direct_distance()