# Two Medoid-Based Algorithms for Clustering Sets
## 6 Conclusions  
This paper proposes a novel approach to clustering variable-sized sets of elementary items. An example of such data occurs in medical applications where patient diagnoses  
\begin{table}
\begin{tabular}{l c c c c c c} \hline \hline
**Algorithm** & **t = 1** & **t = 2** & **t = 3** & **t = 4** & **t = 5** & **Average** \\ \hline K-medoids\({}^{\text{GKM++}}\) & 0.99 & 0.99 & 0.99 & 0.98 & 0.99 & 0.99 \\ PRS\({}^{\text{GKM++}}\) & 0.99 & 0.99 & 0.99 & 0.98 & 0.99 & 0.99 \\ K-sets & 0.92 & 0.86 & 0.80 & 0.85 & 0.85 & 0.86 \\ K-swaps & 1.0 & 0.99 & 0.99 & 1.0 & 0.99 & 0.99 \\ \hline \hline \end{tabular}
\end{table}
Table 11: \(ARI\) vs. the cluster types \(t\).  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Execution** & **SDM** & \(ARI\) & **CI** & \(SR\) & \(ET\) (msec) & \(IT\) & \(aET^{i}\) (msec) \\ \hline Sequential & 1824 & 1.0 & 0 & 8.9\% & 4,425,118 & 10,551 & 442 \\ \hline Parallel & 1824 & 1.0 & 0 & 9.8\% & 639,585 & 10,872 & 63 \\ \hline \hline \end{tabular}
\end{table}
Table 12: Results of 2000 repetitions of K-medoids\({}^{\text{G-K-Means++}}\) with weighted Jaccard distance on the data_1200_200_32\(5\)1 dataset (8 physical cores).  
can be clustered to help discover a patient's risk of contracting a future illness due to its similarity with other patients.  
The new approach is based on medoids. Two algorithms (K-medoids and random swap) were implemented to work with the well-known Jaccard or Otsula-Ochiai cosine distance measures adjusted to exploit some application-sensitive information concerning the global frequency of elementary items in the dataset.  
The proposal makes it possible to compute the distance between any pair of sets or data objects. This enables the centroid/medoid of a cluster to be any data object of the dataset. This differs from the inspiring work by [8], where the representative of a cluster is a histogram of the uses of the items in the cluster, and a distance measure is introduced between a data object and the cluster histogram.  
The new approach proves to be effective in generating reliable clustering solutions. In addition, an efficient implementation in Java based on parallel streams [12; 19; 20] was realized to cope with the \(O\big{(}N^{2}\big{)}\) computational cost related to computing the all pairwise distances in K-medoids and in the evaluation of some clustering accuracy indexes.  
This paper demonstrates the benefits of the proposed approach by applying it to 15 synthetic datasets [22] which were also used in [8]. The experimental results confirm the achievement of high-quality clustering solutions, which can outperform the results reported in [8].  
Future research aims at improving the Java implementation of the algorithms; applying the algorithms to realistic datasets such as clustering healthcare records as in [8]; and exploiting the approach in other clustering methods. In addition, considering the problems discussed in [28] about weaknesses of medoids when averaging GPS trajectories, which in general can also be problems in clustering sets, another future issue of this work will concern a possible replacement of medoids by some specific definition of the mean of the data objects of a cluster.  
Both in methodology and Java implementation code. All authors have read and agreed to the published version of the manuscript.  
This research received no external funding.  
All data is available in the on-line repository [22].  
The authors are grateful to the referees for their comments which allowed improvement of this paper's presentation. The Java software can be accessed from the link: [[https://bit.ly/3](https://bit.ly/3) pGVLPZ]([https://bit.ly/3](https://bit.ly/3) pGVLPZ) (accessed on 13 July 2023).  
The authors declare no conflict of interest.