m-Py / anticlust

Subset partitioning via anticlustering
Other
29 stars 5 forks source link

Using multiple initial partitions in `bicriterion_anticlustering()` #56

Open m-Py opened 3 months ago

m-Py commented 3 months ago

The documentation of bicriterion_anticlustering() states: "If multiple init_partitions are given, ensure that each partition (i.e., each row of init_partitions) has the exact same output of table()."

This is bad and it should not be up to the user. I can do that in anticlust, I already do it in the internal function add_unassigned_elements():

  # now sort labels by group size (so that each time this function is called, we get the same output of table())
  new_labels <- order(table(init), decreasing = TRUE)
  as.numeric(as.character(factor(init, levels = 1:K, labels = new_labels)))

--> Use this code in bicriterion_anticlustering() if the argument init_partitions is used.