SlowGuess/NeurIPS_2023_OCR huggingface dataset:
The instance  $I = (X, k, L, \mathrm{dist})$  for our clustering problem is built as follows: we set  $L = T$ ,  $k = m$ ; for  $i = 1, \ldots, 3m$  let  $\mathcal{X}_i$  be a set with  $s_i$  points so that the distance between points in the same group  $\mathcal{X}_i$  is  $1/2$  while the distance between points in different groups is  $\alpha$ . We set  $\mathcal{X} = \mathcal{X}_1 \cup \ldots \cup \mathcal{X}_{3m}$ .
Let us assume that there is an  $(1, \frac{k - 2}{k - 1} + \frac{1}{\alpha(k - 1)})$ -approximation for our problem and let  $\mathcal{C}$  be the clustering returned by this algorithm for instance  $I$ . We argue that the answer to the 3-PARTITION problem is 'YES' if and only if  $\mathrm{MST - Sp}(\mathcal{C}) = (k - 1)\alpha$ .
First, we show that if the answer is 'YES', there is a  $k$ -clustering  $\mathcal{C}^*$  for  $I$  with  $\mathrm{MST - Sp}(\mathcal{C}^*) = (k - 1)\alpha$ . In fact, let  $S_{1},\ldots ,S_{m}$  be a solution of the 3-PARTITION problem and let  $\{s_{i_1},s_{i_2},s_{i_3}\}$  the numbers in  $S_{i}$ . Let  $\mathcal{C}^*$  be a  $k$ -clustering where the  $i$ th group is comprised by all points in  $\mathcal{X}_{i_1}\cup \mathcal{X}_{i_2}\cup \mathcal{X}_{i_3}$ . Clearly, each group has  $L$  points and the MST-Sp of this clustering is  $(k - 1)\alpha$ . Since our algorithm is a  $(1,\frac{k - 2}{k - 1} +\frac{1}{\alpha(k - 1)})$ -approximation it returns a clustering  $\mathcal{C}$  with  $\mathrm{MST - Sp}(\mathcal{C}) > (k - 2)\alpha +1$ . Since the MST-Sp of any clustering for instance  $I$  is either  $(k - 1)\alpha$  or at most  $(k - 2)\alpha +1 / 2$  we have that  $\mathrm{MST - Sp}(\mathcal{C}) = (k - 1)\alpha$
Table 3: Comparison of MST-Sp of Algorithm 2 with the upper bound given by Lemma 4.4
k	MST-Sp	∑kℓ=2Min-Sp(A'ℓ)	Approximation Ratio	1/Hk-1
anuran	10	1.87	2.42	0.77	0.35
avila	12	0.81	1.48	0.55	0.34
collins	30	12.42	13.81	0.9	0.33
digits	10	178.22	201.47	0.88	0.32
letter	26	5.67	5.76	0.98	0.31
mice	8	5.66	7.12	0.79	0.31
newsgroups	20	19	19	1	0.3
pendigits	10	217.01	303.37	0.72	0.3
sensorless	11	1.36	2.23	0.61	0.29
vowel	11	4.94	5.57	0.89	0.29
On the other hand, if the clustering has Min-Sp  $(k - 1)\alpha$  then all points in  $\mathcal{X}_i$ , for each  $i$ , must be in the same group. Moreover, due to the restriction that every  $|\mathcal{X}_i| = s_i \in (L/4, L/2)$ , we should have exactly 3  $\mathcal{X}_i$ 's in each of the  $m$  groups. Thus, the answer is 'YES'.
D Experiments: Additional Information
Experiments were run in an Ubuntu 20.04.5 LTS with 40 cores and 115 GB RAM. The repository of the project at https://anonymous.4open.science/r/SizeConstrainedSpacing-B260 contains the code and instructions needed to generate the experimental data analyzed in the paper.
D.1 MST-Sp: comparison between empirical results and upper bound of Algorithm 2
As mentioned in Section 5, Algorithm 2 can in practice obtain clusterings that are much closer to the optimal MST-Sp than the prediction guaranteed by Theorem 4.6. In Table 3, we present, for each dataset: the average MST-Sp obtained by Algorithm 2; the upper bound on the MST-Sp given by the sum of the Min-Sp for all partitions found by an execution of the algorithm; the approximation ratio of Algorithm 2, given by its MST-Sp divided by the upper bound; and the theoretical approximation ratio  $1 / H_{k - 1}$  from Theorem 4.6.
For all 10 datasets, Algorithm 2 performs significantly better than its theoretical approximation ratio. The smallest gap between theoretical and empirical result occurs for avila dataset, in which the algorithm is 21 percentage points closer to the optimal MST-Sp than Theorem 4.6 guarantees; On the other extreme, for dataset newsgroups, it actually achieves the best possible MST-Sp. These results increase our confidence that Algorithm 2 is a good option for finding separated groups.
D.2 Average size of smallest clusters
Table 4 presents the average size of the smallest group generated by Algorithms 1 and 2 and  $k$ -means. Values tend to be close across all algorithms, and for all iterations of the experiments the smallest group returned by Algorithms 1 and 2 is at least as large as the smallest group from the corresponding  $k$ -means clustering; recall that  $L$  is set as  $4s/3$ , where  $s$  is the size of the smallest group produced by  $k$ -means. In particular, thanks to the rule of iterating from the largest cluster to the smallest when building our  $k$ -clustering from an  $\ell$ -clustering, the theoretical possibility that the smallest group induced by Algorithm 2 is  $1/2$  of the desired size does not appear to happen in practice.
D.3 Fast version of Algorithm 2
As mentioned in Section 5, the log  $k$  bound of Theorem 4.6 is still valid for Algorithm 2 if, instead of investigating all values of  $\ell$  from 2 to  $k$ , it considers only the values that can be written as  $\lceil k / 2^t \rceil$ , for  $t = 0, \dots, \lfloor \log k \rfloor$ . In Table 5 we compare the results of this fast version of the algorithm with those of the full version.
Table 4: Average size of the smallest cluster in a  $k$ -clustering, per algorithm and dataset.
Dimensions	Average size of smallest cluster
n	k	Algorithm 1	Algorithm 2	k-means
anuran	7,195	10	264.5	266.7	264.1
avila	20,867	12	85.3	85.4	83.2
collins	1,000	30	7.7	7.7	7.7
digits	1,797	10	96.2	96.2	92.7
letter	20,000	26	192	258.7	191.5
mice	552	8	47.6	47.6	47
newsgroups	18,846	20	188.1	188.2	188.1
pendigits	10,992	10	483.2	476.4	463.8
sensorless	58,509	11	1,842.5	1,725.5	1,655.6
vowel	990	11	57.9	57.9	57.9
Table 5: Min-Sp, MST-Sp and execution time for Algorithm 2.
Dimensions	MST-Sp	Time (seconds)
n	k	Fast	Full	Fast	Full
anuran	7,195	10	1.71	1.87	2.55	6.77
avila	20,867	12	0.77	0.81	20.47	62.51
collins	1,000	30	12.42	12.42	0.76	4.48
digits	1,797	10	178.22	178.22	0.55	1.78
letter	20,000	26	5.66	5.67	23.44	116.44
mice	552	8	5.66	5.66	0.27	0.44
newsgroups	18,846	20	19	19	307.58	440.38
pendigits	10,992	10	215.11	217.01	6.13	16.02
sensorless	58,509	11	1.34	1.36	274.00	701.42
vowel	990	11	4.94	4.94	0.18	0.59
Even considering the overhead of running the single-linkage algorithm, which cannot be avoided for both versions of Algorithm 2, we see a reduction of at least  $30\%$  in the algorithm's running time when using the fast version. The loss in terms of MST-Sp, on the other hand, is less than  $10\%$  in the worst scenario, and in 5 of the 10 datasets analyzed both versions return the same clustering.
D.4 Distribution of results for Min-Sp and MST-Sp
Figures 3 and 4 show the boxplots for the Min-Sp and the MST-Sp, respectively, per dataset and algorithm. Algorithm 2 presents some large variations, when compared to both k-means and Algorithm 1, in terms of Min-Sp (Figure 3) for some datasets; as it is designed to maximize the MST-Sp, this behavior in the other metric presented here should not be too concerning. Also in terms of Min-Sp, both algorithms presented in the paper clearly outperform k-means in almost all datasets, even considering the variation in results. The same can be said for the MST-Sp (Figure 4), in which, additionally, the range of results returned by Algorithm 2 is much more in line with those returned by the two other algorithms.
D.5 Trade-off between size of smallest cluster and inter-group separability criteria
In Figure 5 we present scatterplots for our 5 smallest datasets showing how the quality of the clusterings generated by Algorithms 1 and 2 (considering, respectively, the Min-Sp and the MST-Sp as criteria) increases as we allow for clusters of smaller sizes. For all datasets, as expected, allowing for smallest clusters leads to higher Min-Sp and MST-Sp. It is still noteworthy that the algorithms presented in this paper can be used not only to find a good partition with a hard limit on the size of the smallest cluster, but also to find the best balance between minimum size and a good separation of clusters.
Figure 3: Boxplots of the Min-Sp per dataset and algorithm.
Figure 4: Boxplots of the MST-Sp per dataset and algorithm.
Figure 5: Trade-off between the size of the smallest cluster and the separability criteria.
Table 6: Maximum standard deviation of MST-Sp for Algorithm 2.
Dimensions	MST-Sp
n	k	μ	max σ
anuran	7,195	10	1.87	-
avila	20,867	12	0.81	-
collins	1,000	30	12.42	-
digits	1,797	10	178.22	-
letter	20,000	26	5.67	0.34
mice	552	8	5.66	-
newsgroups	18,846	20	19	-
pendigits	10,992	10	217.01	-
sensorless	58,509	11	1.96	0.002
vowel	990	11	4.94	-
Table 7: Quadratic loss ( $k$ -means cost) for Algorithms 1 and 2.
Dimensions	Loss (relative to k-means)
n	k	Algorithm 1	Algorithm 2
anuran	7,195	10	2.50	2.07
avila	20,867	12	2.81	2.81
collins	1,000	30	2.33	2.33
digits	1,797	10	1.33	1.33
letter	20,000	26	2.30	2.52
mice	552	8	2.52	2.52
newsgroups	18,846	20	1.05	1.05
pendigits	10,992	10	2.18	2.10
sensorless	58,509	11	4.32	5.25
vowel	990	11	2.07	2.07
D.6 Effect of randomness on Algorithm 2's results
While Algorithm 1 is fully deterministic, in Algorithm 2 the split of clusters from an  $\ell$ -clustering to turn it into a  $k$ -clustering is performed randomly. In practice, however, this does not affect the results of the algorithm.
For each dataset, we ran 10 seeded iterations of Algorithm 2 for each value of  $L$  used in the experiments. We then calculate the standard deviation of the MST-Sp for each value of  $L$ . As shown in Table 6, for 8 of the datasets analyzed the MST-Sp of the clustering returned by Algorithm 2 is always the same for a given value of  $L$ ; for letter and sensorless, there is some variation, but it is very small compared to the average MST-Sp returned by the algorithm.
D.7 Relative quadratic loss for Algorithms 1 and 2
In Table 7 we present the quadratic loss of both Algorithm 1 and Algorithm 2 as a multiple of the loss incurred by the  $k$ -means algorithm, which is specifically designed to minimize this loss. As expected, since both algorithms were devised for maximizing inter-group criteria, they perform poorly in light of this intra-group loss function — with the sole exception of the newsgroups dataset, for which both algorithms incur a loss only  $5\%$  above that of  $k$ -means. Across datasets, the performance of both algorithms is similar for this loss, with only small variations.