Search code examples
rcluster-analysisk-means

How to prevent merging equal prototypes in kproto function from clustMixType package in R


I am implementing k-prototype clustering using kproto() function from clustMixType package on the hepatitis dataset. After getting clustering labels, I am matching cluster labels with the class labels using labelMatcher() function from the Thresher package (Label matching is needed for computing accuracy, sensitivity, precision, F1 score on a dataset with more than two classes). However, since kproto() function merges equal prototypes during the clustering, labelMatcher() cannot match the class labels with the cluster labels due to having fewer unique cluster labels. I wonder if I can prevent merging the equal prototypes in kproto() function. Thanks in advance.


Solution

  • I could not find a solution to prevent merging equal prototypes in kproto() function. However, I checked the number of unique clusters after running kproto() function. If the desired number of clusters is not equal to the number of unique clusters, I forced rerunning the code using while loop.