betaFeedback

WorksComputer Science

Streaming algorithms for robust max-min diversification

Abstract

Given a set of nn points XX in a metric space and an integer kk, max-min diversification aims to select kk points of XX maximizing their minimum pairwise distance. This objective function is however highly vulnerable to noisy points. In[Amagata, AAAI23], a robust formulation is proposed which addresses this vulnerability by excluding solutions containing any of zz outliers, defined as the zz points in XX with the largest nearest-neighbor distances. That paper also presents a coreset-based streaming algorithm for the new formulation, based on a suitable inlier-outlier separation assumption. However, we identify three shortcomings in the algorithm by [Amagata, AAAI23]: its coreset construction requires an offline computation over XX, which needs memory linear in nn, in stark contrast with the typical goals of stream processing; the one-pass procedure used to extract the solution from the coreset may return fewer than kk points (hence, an unfeasible solution) because it permanently discards points too far from the current solution; and its outlier-exclusion guarantee is only probabilistic and weakens as the coreset size shrinks. In contrast, we present a deterministic coreset-based algorithm that, under a natural inlier-outlier separation assumption (similar to the one used in [Amagata, AAAI23]), returns exactly kk inliers which are a (2+ε)(2+\varepsilon)-approximate solution, for any ε>0\varepsilon>0, thus only ε\varepsilon above the best polynomial-time sequential approximation, even without outliers. Its one-pass streaming implementation adapts obliviously to the dataset's doubling dimension DD and, for wide ranges of kk, zz, ε\varepsilon, and DD, it uses memory independent of nn. For sufficiently long streams, its amortized update time is proportional to the coreset size, thus also independent of nn.

Introduction

Given a set XX of nn points from a metric space and an integer kk, the maximum diversification (also known as diversity maximization) problem requires to select kk points of XX maximizing some measure of how different the selected points are from one another. Maximum diversification is a fundamental primitive in the analysis of large datasets, as it returns a small subset of the input points which preserves its variety, and it has applications in web search, recommender systems, databases and data mining [4, 9]. Among the measures proposed in the literature (see [13] for an exhaustive list), one of the most popular is the max-min (also known as remote-edge measure, which we adopt in this work, and states that the diversity of a set SS is the minimum distance between any two distinct points of SS. The resulting max-min diversification problem is NP-hard, and the simple farthest-first heuristic of [10] (widely known as GMM) returns a 2-approximate solution in O(kn)O(kn) time, which is the best that can be achieved in polynomial time unless P=NPP = NP [15].

Since the objective function is a minimum of distances, the returned solution may be very sensitive to the presence of noise: for instance, spurious data points lying very far away from all other points in XX, may unduly increase the value of the objective, and GMM, which iteratively selects the next point as the farthest from the previously selected ones, tends to return these noisy and hardly representative points of the dataset [4]. This issue calls for a robust formulation of the problem, where a fixed subset of zz points of XX are regarded as outliers and are forbidden to appear in any solution. The max-min diversification problem with outliers, introduced by [4] and considered in our work, requires, given a dataset XX of nn points, and two integer parameters kk and zz, with k+z≤nk + z \le n, to determine the kk points that optimize the max-min measure, among the points of X∖XoutX \setminus X_{\mathrm{out}}, where XoutX_{\mathrm{out}} are the zz points of XX farthest from their respective nearest neighbors. We note that this formulation is different from the one used for the robust version of the well-known kk-center problem, where each solution (a set of kk points) induces a different set of zz outliers, defined as the zz farthest points from that solution, and whose exclusion thus improves the objective function the most. Instead, when outliers are a fixed subset of the input, they must be identified by some criterion which does not depend on the objective function.

When the dataset is too large to be stored in main memory, it is natural to process it as a stream, that is, by a single processor which reads the input in one sequential pass using a working memory much smaller than nn. A very effective strategy in this scenario is the extraction of a cc-coreset [1], a small subset of the input which contains a cc-approximation of the optimal solution for the whole dataset, for some c>1c > 1, so that the execution of an expensive sequential algorithm for the problem can run on the coreset rather than on the entire dataset. As shown in [5, 6, 7, 8, 9] for a host of problems, the quality of the coresets that can be extracted, and hence the final approximation, is often regulated by the doubling dimension DD of the metric space underlying the input instance [12].

Previous work

Max-min diversification on datasets without outliers has been studied extensively. Besides the sequential results mentioned above, coreset-based MapReduce and Streaming algorithms have been presented in [9], for several diversity measures, in spaces of bounded doubling dimension DD. Specifically, the algorithms in [9] attain an (α+ε)(\alpha+ \varepsilon)-approximation, for any fixed ε>0\varepsilon> 0, where α\alpha is the best ratio featured by a polynomial-time sequential algorithm for the same measure, hence (2+ε)(2 + \varepsilon) in the case of max-min diversification. The same approach was later extended to the solution of diversity maximization under matroid constraints [6].

For the kk-center problem, the previously mentioned formulation with zz outliers has received considerable attention. In [14], the authors give a 1-pass Streaming algorithm attaining a (2+ε)(2+\varepsilon)-approximation with working memory O(kε−1log⁡ε−1)O(k\varepsilon^{-1}\log\varepsilon^{-1}) for the problem without outliers, together with a (4+ε)(4+\varepsilon)-approximation with working memory O(kzε−1)O(kz\varepsilon^{-1}) for the problem with zz outliers. Coreset-based MapReduce and Streaming algorithms, whose approximation ratio is a mere additive term ε\varepsilon away from the best sequential one, are given in [5], and, under matroid constraints, in [7]. Our streaming algorithm for max-min diversification with zz outliers builds on the coreset construction employed in this latter work.

To the best of our knowledge, diversity maximization in the presence of outliers has been considered only in [4], which introduced the formulation described above and proposed two algorithms. The first algorithm, Greedy, runs GMM to select k+zk+z points, which, as the author proves, contain all the outliers. Then, by computing the distances to their respective nearest neighbors for these k+zk+z points, the outliers are identified as the zz points whose computed distances are the largest, and a 2-approximate solution is found by running GMM for kk points on the whole dataset cleaned of the just identified outliers. The second algorithm, Coreset, runs a streaming algorithm on a coreset CC of O(k+z)O(k+z) points extracted with GMM. The streaming strategy used on CC works as follows. Let S′S' be a solution of k+zk+z points computed with GMM, where div(S′)div(S') denotes its diversity measure, that is, the minimum distance between any two distinct points of S′S'. It is shown that the diversity measure of the optimal solution, denoted as ℓk∗\ell_k^*, lies in the interval [div(S′),2div(S′)][div(S'),2div(S')]. For a geometric sequence of guesses ℓ^∈[div(S′),2div(S′)]\hat{\ell}\in[div(S'),2div(S')], a solution SS is then computed by taking a random point of CC and then processing each x∈Cx\in C in a streaming fashion, adding xx to SS only if d(x,S)∈[ℓ^/2,ℓ^]d(x,S)\in[\hat{\ell}/2,\hat{\ell}]. Finally, the solution with kk points and maximum diversity, among the ones computed for the various guesses, is returned. The author claims that the processing of CC returns, with constant probability, a 6(1+ε)6(1+\varepsilon)-approximate solution with no outliers, in time independent of nn. Both of the algorithms in [4] crucially rely on the assumption that the outliers are the zz farthest points from the respective nearest neighbors, and that the distance between any outlier and its nearest neighbor is at least αℓk∗\alpha\ell_k^*, where α>1\alpha>1 and ℓk∗\ell_k^* is the value of the objective function of the optimal solution excluding outliers.

Our work stems from a critique of the streaming approach of [4], which suffers from a number of drawbacks and inaccuracies, listed below.

  • The claim that their two-phase approach yields a streaming algorithm is rather questionable. Indeed, the coreset is built in the first phase offline, through a full pass over XX, which requires working memory linear in nn, thus defying the purpose of a streaming algorithm, which is primarily meant for datasets too large to fit in memory. Moreover, since a coreset is by construction small enough to reside entirely in memory, relatively little is gained by processing it as a stream in the second phase.

  • The “scan-once” behavior used in the second phase of Coreset to process the coreset CC may fail to return a solution with kk points. Consider a dataset

XX consisting of two pairs of points, with intra-pair distance 1 and inter-pair distance ≥3\ge3, and set k=4k = 4 and z=0z = 0 (see Figure 1). The optimal kk-diversity of the instance is clearly ℓk∗=1\ell_k^* = 1. In this case, the coreset CC of k+z=4k + z = 4 points computed by Algorithm Coreset through GMM consists of all points of XX, moreover S′=XS' = X, hence div⁡(S′)=1=ℓk∗\operatorname{div}(S') = 1 = \ell_k^*. Now, for every guess ℓ^∈[div⁡(S′),2div⁡(S′)]=[1,2]\hat{\ell} \in[\operatorname{div}(S'), 2\operatorname{div}(S')] = [1, 2], the algorithm initializes a solution SS with a random point p∈Cp \in C, and scans each remaining point xx of CC, adding it to SS only if d(x,S)∈[ℓ^/2,ℓ^]⊆[ℓk∗/2,2ℓk∗]=[1/2,2]d(x, S) \in[\hat{\ell}/2,\hat{\ell}] \subseteq[\ell_k^*/2, 2\ell_k^*] = [1/2, 2]. Therefore, only the other point belonging to the same pair as pp can be added to SS, and, at the end SS will contain only 2 <k< k points. In this case, the algorithm fails to return a valid solution. In general, since a point xx is discarded if, when xx is processed, it is found to be too far from the current partial solution SS, the algorithm may fail to return a solution, depending on the order in which the points are processed. If points far from SS occur before closer ones, then the algorithm will discard them permanently, and SS will never reach the target size kk.

Visual execution of the second phase of the Coreset algorithm

Figure 1. Visual execution of the second phase of the Coreset algorithm presented in [4].

  • As explicitly stated in [4], the guarantee that the returned solution contains no outliers is only probabilistic, and it degrades as the size of the coreset decreases, since the success probability is 1−z/∣C∣1 - z/|C|. Thus, a constant success probability pp calls for a coreset of at least ∣C∣=z/(1−p)|C| = z/(1-p) points, a requirement in conflict with the goal of maintaining the coreset small.

Our contribution

We present coreset-based algorithms for max-min diversification with outliers, which do not suffer from the limitations of the results by [4] described above. Our algorithms attain high accuracy and performance for spaces of low doubling dimension DD, a popular notion of dimensionality for general metrics. Our results hold under a separation assumption between inliers and outliers, expressed in terms of two suitably separated constants α\alpha and β\beta, with α>1\alpha> 1 and α>β>0\alpha> \beta> 0, so that the nearest neighbor of an outlier is at distance at least αℓk∗\alpha\ell_k^*, while the nearest neighbor of an inlier is at distance at most βℓk∗\beta\ell_k^*, where ℓk∗\ell_k^* is the value of the objective function of the optimal solution, excluding the outliers. In [4], the same assumption was made, but with β=α\beta= \alpha. Making β\beta a distinct parameter from α\alpha, which essentially imposes a sharper (yet reasonable) separation between outliers and inliers, allows us to identify the outliers exactly and deterministically.

More specifically, we provide:

  • A sequential algorithm which extracts a coreset TT by running GMM on XX, identifies the outliers within the coreset through their nearest neighbor distances, and computes the final solution on the remaining points. While [4] had already observed that k+zk + z points are enough for TT to contain all the outliers and to be a 2-coreset1, we propose a simpler strategy to identify the outliers. Moreover, and more importantly, we show that k(8/ε′)D+zk(8/\varepsilon')^D + z points, with ε′=ε/(1+ε)\varepsilon' = \varepsilon/(1 + \varepsilon), make TT a (1+ε)(1 + \varepsilon)-coreset. For constant values of kk and zz and datasets of small (constant) doubling dimension, this coreset-based approach is able to yield (1+ε)(1 + \varepsilon) approximate solutions in linear time.

  • A deterministic 1-pass Streaming algorithm which returns a (2+ε)(2 + \varepsilon)-approximate solution of kk points, containing no outliers, using a working memory of size O((k+z)(c/ε)D)O((k + z)(c/\varepsilon)^D), for a suitable constant cc, hence independent of nn and substantially sublinear for wide ranges of kk, zz, ε\varepsilon and DD. For sufficiently long streams, its amortized update time is proportional to the size of the coreset.

In both cases the approximation ratio is a mere additive term ε\varepsilon away from the best ratio attainable in polynomial time even in the absence of outliers, and it improves substantially over the claimed 6(1+ε)6(1 + \varepsilon) ratio of [4], which was moreover only guaranteed with constant probability and was plagued with the issues amply discussed before.

As is the case for [5, 7, 9], our algorithms adapt obliviously to the doubling dimension DD, in the sense that DD is used in the analysis but is not needed by the algorithms.

Organization of the paper. The rest of the paper is organized as follows. Section 2 introduces the notation, the formal definition of the problem, and the concepts on which our algorithms are based. § 3 presents and analyzes our sequential algorithm, while § 4 presents and analyzes the streaming one.

Preliminaries

In this section, we introduce the fundamental notation and formally define the problem of max-min diversification in the presence of outliers. We also review the geometric and algorithmic concepts that lay the foundation for our work. Throughout the paper, we let XX denote the input dataset consisting of nn points from a metric space with distance function d(⋅,⋅)d(\cdot,\cdot). For any point x∈Xx \in X, and subset Y⊆XY \subseteq X, we use d(x,Y)d(x,Y) as a shorthand notation to denote min⁡y∈Yd(x,y)\min_{y\in Y} d(x,y).

Problem definition

For a given subset S⊆XS \subseteq X, let the diversity of SS, denoted as div(S)div(S), be the minimum pairwise distance between its points2, that is

div(S)=min⁡{d(x,y):x,y∈S,x≠y}.div(S) = \min\{d(x,y) : x,y \in S, x \ne y\}.

The max-min diversification problem requires that, given an input set XX of nn points and an integer k∈[2,n]k \in[2,n], the subset of kk points of maximum diversity be computed, defined as

S∗=argmax⁡S⊆X,∣S∣=k  div(S).S^* = \underset{S\subseteq X,\lvert S\rvert=k}{\operatorname{argmax}}\; div(S).

We will use divk(X)div_k(X) to denote the diversity of the optimal solution to the problem for the set XX, that is, divk(X)=div(S∗)div_k(X) = div(S^*).

Real-world datasets often contain noisy data points which may obfuscate the outcome of the analysis, and, due to the formulation of its objective function, max-min diversification is particularly vulnerable to the presence of such noise. To deal with this scenario, the following more general formulation of the max-min diversification problem has been proposed by [4]. Suppose that the input set XX contains a subset XoutX_{out} of zz outliers, namely noisy points to be ignored by the analysis, and let Xin=X\XoutX_{in}=X\backslash X_{out} denote the remaining points, which we refer to as inliers. For a point x∈Xx \in X, let NN(x)NN(x) denote its nearest neighbor in XX, that is,

NN(x)=argmin⁡x′∈X\{x}  d(x,x′).NN(x) = \underset{x'\in X\backslash\{x\}}{\operatorname{argmin}}\; d(x,x').

The notion of outliers used in our paper is the one introduced by [4], and states that XoutX_{out} contains the zz points of XX with largest distance from their nearest neighbor. Given an input set X=Xin∪XoutX = X_{in}\cup X_{out} of nn points with ∣Xout∣=z\lvert X_{out}\rvert= z, and an integer k∈[2,∣Xin∣]k \in[2,\lvert X_{in}\rvert], the max-min diversification problem with outliers requires to return the subset

S∗=argmax⁡S⊆Xin,∣S∣=k  div(S).S^* = \underset{S\subseteq X_{in},\lvert S\rvert=k}{\operatorname{argmax}}\; div(S).

Let ℓk∗=div(S∗)=divk(Xin)\ell_k^* = div(S^*) = div_k(X_{in}). Our algorithms assume that the input dataset satisfies the following separation assumption: there exist two (suitably separated) constants α>1\alpha> 1 and β>0\beta> 0 with α>β\alpha> \beta such that

d(x,NN⁡(x))≥αℓk∗∀x∈Xout,d(x,NN⁡(x))≤βℓk∗∀x∈Xin,\begin{aligned} d(x,\operatorname{NN}(x)) &\ge\alpha\ell_k^* && \forall x \in X_{out},\\ d(x,\operatorname{NN}(x)) &\le\beta\ell_k^* && \forall x \in X_{in}, \end{aligned}

This assumption slightly generalizes the one used in [4], where β=α\beta= \alpha. As observed in [4], this type of separation has been considered in previous works on distance-based and nearest-neighbor based outlier detection [2, 3, 11].

γ\gamma-Coreset

The concept of a coreset captures the idea of a small set of points that approximates some property of a larger set [1, 9].

Definition 1. Given a dataset X=Xin∪XoutX = X_{in} \cup X_{out} with outliers, consider a subset T⊆XT \subseteq X, and suppose that it contains at least kk inliers of XX. Let Tin=T∩XinT_{in} = T \cap X_{in}. For a value γ≥1\gamma\ge1, we say that TT is a γ\gamma-coreset for max-min diversification with outliers on XX if

divk(Tin)≥1γdivk(Xin).div_k(T_{in}) \ge\frac{1}{\gamma}div_k(X_{in}).

The definition immediately implies that, given a γ\gamma-coreset TT, and assuming that TinT_{in} can be easily retrieved from TT, if a cc-approximation algorithm for max-min diversification is run on TinT_{in}, the returned solution SS, is a c⋅γc \cdot\gamma-approximation to max-min diversification with outliers on XX, that is div(S)≥(1/(c⋅γ))divk(Xin)div(S) \ge(1/(c \cdot\gamma))div_k(X_{in}).

Moreover, the following fact straightforwardly derives from the above definition and from the aforementioned separation assumption.

Fact 1 Let X=Xin∪XoutX = X_{in} \cup X_{out} be a dataset with outliers, and let T⊆XT \subseteq X be a subset such that

max⁡x∈Xd(x,T)<αℓk∗\max_{x \in X} d(x,T) < \alpha\ell_k^*

Then Xout⊆TX_{out} \subseteq T.

Doubling Dimension

To analyze theoretical guarantees in general metric spaces, we rely on the doubling dimension of the input. The doubling dimension of a set XX is the smallest value DD such that any ball of radius rr can be entirely covered by at most 2D2^D balls of radius r/2r/2 [12]. As an immediate consequence, for any ε∈(0,1]\varepsilon\in(0,1], any ball of radius rr can be covered by at most 2⌈log⁡2(1/ε)⌉⋅D<(2/ε)D2^{\lceil\log_2(1/\varepsilon)\rceil\cdot D} < (2/\varepsilon)^D balls of radius at most εr\varepsilon r.

kk-Center Problem

As well known from previous works [9, 15], max-min diversification is tightly related to the kk-center problem which, given a set XX of nn points and an integer k≤nk \le n, requires to find a subset S⊆XS \subseteq X of kk centers, which minimizes max⁡x∈Xd(x,S)\max_{x \in X} d(x,S). The solution SS induces a partition of XX into kk clusters, where each point of XX is assigned to the cluster of its closest center (with ties broken arbitrarily). The value max⁡x∈Xd(x,S)\max_{x \in X} d(x,S) is referred to as the radius of the induced clustering. Throughout the paper, we will use rk∗(X)r_k^*(X), for any given integer kk, to denote the optimal radius for the kk-center problem on XX, namely

rk∗(X)=min⁡S⊆X,∣S∣=kmax⁡x∈Xd(x,S).r_k^*(X) = \min_{\substack{S \subseteq X, |S|=k}} \max_{x \in X} d(x,S).

Let rk∗(X)r_k^*(X) be the radius of the clustering induced by the optimal solution to the kk-center problem for XX. As stated in [9 Fact 1], the following relation, called anticover property, holds:

rk∗(X)≤div⁡k(X).(1)r_k^*(X) \le\operatorname{div}_k(X). \tag*{(1)}

Sequential GMM Algorithm The Greedy Max-Min (GMM) algorithm [10] is a popular 2-approximation algorithm for kk-center, and, as shown in [15], the returned solution is also a 2-approximation to the max-min diversification problem without outliers. The algorithm initializes the solution SS by picking an arbitrary point x(1)x^{(1)} in XX, and then iteratively adds to SS the point of XX farthest from SS, until ∣S∣=k|S|=k. (See Algorithm 1 for the pseudocode).

Algorithm 1: GMM(X,k)(X,k)

  1. S←{x(1)}S \leftarrow\{x^{(1)}\}, with x(1)x^{(1)} arbitrary point in XX

  2. for 2≤i≤k2 \le i \le k do

  3. &nbsp;&nbsp;&nbsp;&nbsp;x(i)←arg⁡max⁡y∈X∖S d(y,S)x^{(i)} \leftarrow\underset{y \in X \setminus S}{\arg\max}\ d(y,S)

  4. &nbsp;&nbsp;&nbsp;&nbsp;S←S∪{x(i)}S \leftarrow S \cup\{x^{(i)}\}

  5. return SS

The algorithm can be easily implemented in O(nk)O(nk) time and, within the same time bound, it is easy to maintain, for every x∈Sx \in S, the distance from its nearest neighbor (i.e., d(x,NN(x))d(x,\mathrm{NN}(x))). For 1≤i≤k1 \le i \le k, let S(i)={x(1),x(2),…,x(i)}S^{(i)} = \{x^{(1)}, x^{(2)}, \ldots, x^{(i)}\} be the set SS at the end of the ii-th iteration of GMM. Thus, S(k)S^{(k)} is the final set SS returned by the algorithm. Let also x(k+1)x^{(k+1)} denote the farthest point of XX from S(k)S^{(k)} (i.e., the point that would be added to SS in a further iteration). For 2≤i≤k+12 \le i \le k+1 define

ri=d(x(i),S(i−1)).r_i = d\left(x^{(i)}, S^{(i-1)}\right).

The properties stated in the following fact are easily established [10, 15].

Fact 2 We have:

  1. ri=div⁡(S(i))r_i = \operatorname{div}(S^{(i)}), for 2≤i≤k+12 \le i \le k + 1.

  1. The dataset XX can be covered with i−1i-1 balls centered in the points in S(i−1)S^{(i-1)}, of radius

ri≤ri−1=div⁡(S(i−1)),for 3≤i≤k+1.r_i \le r_{i-1} = \operatorname{div}(S^{(i-1)}), \qquad\text{for } 3 \le i \le k + 1.

Streaming Scaling Algorithm In [14], the authors present a streaming algorithm for the kk-center problem. For a fixed, user-defined, accuracy parameter δ∈(0,1)\delta\in(0,1), at any time the algorithm maintains a pair (S,r)(S,r) such that

  • SS is a set of kk centers providing a (2+δ)(2+\delta)-approximate solution to kk-center for the prefix XX of the stream arrived up to that time.

  • rr is an estimate of the optimal radius such that r≤(2+δ)rk∗(X)r \le(2+\delta)r_k^*(X).

The algorithm runs m=Θ((1/δ)log⁡(1/δ))m = \Theta((1/\delta)\log(1/\delta)) parallel instances which, at any time, maintain mm different solution pairs (Si,ri)(S_i,r_i), with 1≤i≤m1 \le i \le m. All instances are initialized with the first k+1k+1 points of the stream. After the initialization, each instance ii evolves independently and, when a new point is processed, the set SiS_i is suitably updated and the value of the estimated radius rir_i either remains unchanged, or it grows by a factor Θ(1/δ)\Theta(1/\delta). At any time, the overall solution (S,r)(S,r) that the algorithm maintains is the best among the solutions (Si,ri)(S_i,r_i) of the individual instances (i.e., the one with smallest rir_i). For what concerns the time and space complexity of the algorithm, the authors show that

  • At any time, the algorithm requires a working memory of size

O(mk)=O((1/δ)log⁡(1/δ)k).O(mk) = O((1/\delta)\log(1/\delta)k).
  • The initialization time is O(k2)O(k^2).

  • The worst-case update time to handle the arrival of a new point, after the (k+1)(k+1)-st one, is

O(mk2)=O((1/δ)log⁡(1/δ)k2).O(mk^2) = O((1/\delta)\log(1/\delta)k^2).
  • The amortized update time for a stream XX of nn points is

O(m(k+k2log⁡1/δΔn))=O((1/δ)(klog⁡(1/δ)+k2log⁡Δn)),O\left(m\left(k + \frac{k^2\log_{1/\delta}\Delta}{n}\right)\right) = O\left((1/\delta)\left(k\log(1/\delta) + \frac{k^2\log\Delta}{n}\right)\right),

where Δ\Delta is the aspect ratio of XX, namely the ratio between the maximum and the minimum pairwise distances, dmax⁡d_{\max} and dmin⁡d_{\min} respectively, between points of XX, that is Δ=dmax⁡/dmin⁡\Delta= d_{\max}/d_{\min}.

In the paper, we refer to the above algorithm as the δ\delta-Scaling Algorithm.

Coreset-based sequential algorithm

This section presents a simple coreset-based sequential strategy for max-min diversification with outliers, which will be at the base of the streaming algorithm presented in the next section. We will also show that it may efficiently compute very accurate solutions for certain ranges of the parameters.

The following lemma, proved in [4 Lemma 1], states an important property regarding GMM.

Lemma 1. Let X=Xin∪XoutX = X_{in} \cup X_{out} be a set of points with z=∣Xout∣z = |X_{out}| outliers, satisfying the separation assumption defined before. For any c≥k+zc \ge k + z, let TT be the set returned by GMM(X,c)GMM(X,c). Then

Xout⊂T.X_{out} \subset T.

Based on Fact 2 and on the above lemma, we can derive a simple 2-approximation algorithm, which is a slight simplification of [4 Algorithm 3]. For a given instance (X=Xin∪Xout,k,z)(X = X_{in} \cup X_{out}, k, z) of the max-min diversification with outliers, we first run GMM(X,k+z)GMM(X, k + z) to obtain a set TT of k+zk + z points, together with the distances from their respective nearest neighbors. Then, the subset ToutT_{out} consisting of the zz points of x∈Tx \in T with largest nearest neighbor distance is determined. Finally, the set Tin=T\ToutT_{in} = T\backslash T_{out} is returned as output3.

Theorem 1. The above algorithm returns a 2-approximation to the max-min diversification problem with outliers on X=Xin∪XoutX = X_{in} \cup X_{out}.

Proof. By Lemma 1, TT contains XoutX_{out}, therefore, since the nearest neighbor distances can be correctly computed while running GMM, as observed before, we have Tout=XoutT_{out} = X_{out} and TinT_{in} contains exactly kk inliers. This implies that

div(T)≤div(Tin)≤ℓk∗.div(T) \le div(T_{in}) \le\ell_k^*.

Let x(k+z)x^{(k+z)} be the last point added to TT by GMM, and let rk+z=d(x(k+z),T\{x(k+z)})r_{k+z} = d(x^{(k+z)},T\backslash\{x^{(k+z)}\}). By Fact 2, we know that rk+z=div(T)r_{k+z} = div(T), and that X‾\overline{X} can be covered by k+z−1k + z - 1 balls of radius ≤rk+z\le r_{k+z}, centered at the points of T\{x(k+z)}T\backslash\{x^{(k+z)}\}. From the separation assumption, we know that each outlier is at distance ≥αℓk∗>ℓk∗\ge\alpha\ell_k^* > \ell_k^* from its nearest neighbor, and since rk+z=div(T)≤ℓk∗r_{k+z} = div(T) \le\ell_k^*, we must have that zz of the aforementioned k+z−1k+z-1 balls are centered at the outliers and contain no other point. Let OkO_k be the optimal solution to max-min diversification on XX. From what we just observed, the points of OkO_k are distributed among the remaining k−1k-1 balls of radius rk+zr_{k+z}, hence, by the pigeonhole principle, two of them must belong to the same ball. This implies, that rk+z≥ℓk∗/2r_{k+z} \ge\ell_k^*/2. Putting it all together, we have

div(Tin)≥div(T)=rk+z≥ℓk∗/2.div(T_{in}) \ge div(T) = r_{k+z} \ge\ell_k^*/2.

We now present a coreset-based algorithm for max-min diversification, based on GMM, which improves upon the one by [4], and can provide very accurate solutions for small kk and zz, when run on low-dimensional datasets. The algorithm, dubbed CoresetMMD, is similar in spirit to the ones presented in [5, 6, 9]. For a user defined accuracy parameter ε∈(0,1)\varepsilon\in(0,1), it aims at identifying a (1+ε)(1+\varepsilon)-coreset TT for the input XX, such that XoutX_{out} is entirely contained in TT, and it can be efficiently removed from TT. Then, the solution is obtained by running a sequential algorithm A\mathcal{A} on Tin=T∖XoutT_{\mathrm{in}}=T\setminus X_{\mathrm{out}}. If TinT_{\mathrm{in}} is small, in particular, if its size is independent of n=∣X∣n=|X|, one can instantiate A\mathcal{A} with a very accurate (perhaps, exact) yet computationally expensive algorithm.

More precisely, our algorithm first computes an initial coreset TT of size k+zk+z, through GMM(X,k+z)(X,k+z), maintaining, for each x∈Tx\in T, the distance d(x,NN⁡(x))d(x,\operatorname{NN}(x)) from its nearest neighbor in XX. Then, the set XoutX_{\mathrm{out}} of outliers is retrieved by taking the zz points of TT with the largest distance from the respective nearest neighbors. Let rr be the radius of the clustering induced by TT. Then, additional iterations of GMM are performed, adding points to TT so to build a larger coreset, until the clustering radius drops to a value O(εr)O(\varepsilon r). This will ensure that, at the end, TT is a (1+ε)(1+\varepsilon)-coreset. Finally, a sequential algorithm A\mathcal{A} for max-min diversification is run on T∖XoutT\setminus X_{\mathrm{out}}. (See Algorithm 2 for the pseudocode.)

Algorithm 2: CoresetMMD(X, k, z, ε, A)
1  T ← GMM(X, k + z)  (computing also d(x, NN(x)), ∀x ∈ T)
2  Xout ← {z points of T with largest distance from nearest neighbor}
3  r ← maxx∈X d(x, T)
4  ε′ ← ε/(1 + ε)                         // this ensures 1 − ε′ = 1/(1 + ε)
5  while maxx∈X d(x, T) > (ε′/2)r do
      /* run one iteration of GMM                         */
6       x̄ ← argmax       d(y, T)
                 y∈X\T
7       T ← T ∪ {x̄}
8  return A(T\Xout, k)

Theorem 2. Let X=Xin∪XoutX=X_{\mathrm{in}}\cup X_{\mathrm{out}} be a dataset with nn points, including zz outliers, and let A\mathcal{A} be a cc-approximation algorithm for max-min diversification. For any ε∈(0,1)\varepsilon\in(0,1), CoresetMMD(X,k,z,ε,A)(X,k,z,\varepsilon,\mathcal{A}) returns a c(1+ε)c(1+\varepsilon)-approximation to max-min diversification with outliers on XX. Moreover, if XX has doubling dimension DD, the final coreset TT at the end of the while loop has size

∣T∣=O((8(1+ε)ε)D+z),|T|=O\left(\left(\frac{8(1+\varepsilon)}{\varepsilon}\right)^D+z\right),

and the overall running time is

O(∣T∣n+tA(∣T∣−z)),O\left(|T|n+t_{\mathcal{A}}(|T|-z)\right),

where tA(⋅)t_{\mathcal{A}}(\cdot) denotes the complexity of A\mathcal{A}.

Proof. By repeating the same reasoning used in the proof of Theorem 1, we can show that the set of outliers computed in Line 2 is correct, and that the radius rr computed in Line 3 is ≤ℓk∗\leq\ell_k^*. By construction, at the end of the while loop, each point x∈Xx\in X has a proxy p(x)p(x) in the current coreset TT, with

d(x,p(x))≤(ε′/2)r≤(ε′/2)ℓk∗,d(x,p(x))\leq(\varepsilon'/2)r\leq(\varepsilon'/2)\ell_k^*,

where ε′=ε/(1+ε)∈(0,1)\varepsilon' = \varepsilon/(1+\varepsilon) \in(0,1). Let Ok⊆XinO_k \subseteq X_{in} be the optimal subset of size kk achieving div(Ok)=ℓk∗div(O_k) = \ell_k^*. Thus, for every o∈Oko \in O_k, we have d(o,p(o))≤(ε′/2)ℓk∗d(o,p(o)) \le(\varepsilon'/2)\ell_k^*, and, by the separation assumption, it is easy to see that p(o)p(o) cannot be an outlier. Therefore, p(o)p(o) is an inlier of the final coreset TT. By applying [9 Lemma 1], we obtain that TT is a (1+ε)(1+\varepsilon)-coreset for max-min diversification on XinX_{in}, that is, it is a (1+ε)(1+\varepsilon)-coreset for max-min diversification with outliers on XX. Therefore, the returned solution is a c(1+ε)c(1+\varepsilon)-approximation to the optimal solution of the problem.

We now prove the bound on the size of the final coreset TT, which will immediately imply the complexity bound as well. Let T(k+z)T^{(k+z)} denote the initial coreset returned by GMM(X,k+z)(X,k+z). From the above discussion and the separation assumption we can easily argue that XX can be covered by k+zk+z balls of radius r≤ℓk∗r \le\ell_k^* centered at the points of T(k+z)T^{(k+z)}, where the zz outliers are centers of distinct balls containing no inliers. By the property of the doubling dimension, we know that the kk balls containing inliers can be in turn covered by k′k' balls of radius (ε′/4)r(\varepsilon'/4)r, with

k′=k(8ε′)D.k' = k\left(\frac{8}{\varepsilon'}\right)^D .

This implies that the optimal solution to the (k′+z)(k'+z)-center problem on XX induces a clustering of radius ≤(ε′/4)r\le(\varepsilon'/4)r. Since GMM is a 2-approximation algorithm for the kk-center problem, we have that k′+zk'+z iterations of GMM are sufficient to yield a clustering radius at most (ε′/2)r(\varepsilon'/2)r. Therefore, the final coreset has size ∣T∣≤k′+z|T| \le k'+z.

Corollary 1. Consider an instance (X=Xin∪Xout,k,z)(X = X_{in} \cup X_{out}, k, z) of max-min diversification with outliers, where XX has zz outliers. Suppose that k,z∈O(1)k,z \in O(1), and that XX has constant doubling dimension DD. Then, for any fixed ε∈(0,1)\varepsilon\in(0,1), a (1+ε)(1+\varepsilon)-approximation to max-min diversification with outliers on XX can be computed in linear time.

Proof. Run CoresetMMD(X,k,z,ε,A)(X,k,z,\varepsilon,\mathcal{A}) instantiating A\mathcal{A} with an exact algorithm. The corollary immediately follows by Theorem 2.

Streaming Algorithm

This section presents a correct algorithm to solve the max-min diversification problem for a (huge) dataset XX, which is provided in input as a stream (e.g., it is read from some secondary/tertiary storage system). As before, we assume that X=Xin∪XoutX = X_{in} \cup X_{out}, with ∣Xout∣=z|X_{out}| = z, and that for some α>1\alpha> 1 and β>0\beta> 0, with α\alpha suitably larger than β\beta, we have

  • for all x∈Xinx \in X_{in}, d(x,NN(x))≤βℓk∗d(x,\mathrm{NN}(x)) \le\beta\ell_k^*;

  • for all x∈Xoutx \in X_{out}, d(x,NN(x))≥αℓk∗d(x,\mathrm{NN}(x)) \ge\alpha\ell_k^*;

In a nutshell, our streaming algorithm constructs a small weighted coreset using very limited working space. We will prove that the constructed coreset contains the zz outliers and enables their identification. At the end of the stream, the weighted coreset is used to extract a high-quality approximate solution for the max-min diversification problem on the entire stream.

The coreset construction algorithm is similar, in spirit, to the algorithm presented in [7] for the Matroid Center Problem. The algorithm makes use of two parameters, ε′\varepsilon', δ∈(0,1)\delta\in(0,1) and, for given kk and zz, ensures that after processing the stream XX, the following information is gathered:

  • A set S⊆XS \subseteq X of k+zk+z centers, and a value r≤(2+δ)rk+z∗(X)r \leq(2+\delta)r^*_{k+z}(X) such that for every x∈Xx \in X, d(x,S)≤rd(x,S) \leq r;

  • A weighted coreset T⊆XT \subseteq X such that for a suitable value R∈[r/2,r]R \in[r/2,r], and for γ=2(2+δ)\gamma=2(2+\delta), the following properties hold:

(P1) For every a,b∈Ta,b \in T, with a≠ba \ne b, d(a,b)>(ε′/(2γ))Rd(a,b) > (\varepsilon'/(2\gamma))R;

(P2) For every x∈Xx \in X, there exists a proxy π(x)∈T\pi(x) \in T, such that d(x,π(x))≤(ε′/γ)Rd(x,\pi(x)) \leq(\varepsilon'/\gamma)R (the proxy, however, is not stored);

(P3) For every y∈Ty \in T, the weight w(y)w(y) is defined as

w(y)=∣{x∈X∖T:π(x)=y}∣.w(y)=\left|\{x \in X \setminus T : \pi(x)=y\}\right|.

The coreset construction algorithm (see Algorithms 3, 4, and 5 for the pseudocode) is divided into 3 phases. The algorithm uses as a subroutine the Scaling Algorithm of [14] for the kk-center problem, in order to maintain, at each step, a set of k+zk+z “good” centers and an estimate rr of rk+z∗(X)r^*_{k+z}(X) for the set of stream elements seen so far. The three phases are the following:

  1. Initialization: this phase executes the main initializations needed to run the streaming algorithm. The starting value of RR is set to the value rr returned by the Scaling Algorithm on the first k+z+1k+z+1 points of the stream.

  1. Insertion: with this procedure the algorithm decides whether to add the next point xx in the stream to the coreset TT. If TT is empty, then xx always gets added. Otherwise, let pp be the closest point to xx in TT. Then, xx is added to TT iff xx and pp are sufficiently distant, namely d(x,p)>(ε′/(2γ))Rd(x,p) > (\varepsilon'/(2\gamma))R, else, xx is discarded and w(p)w(p) is incremented (as pp becomes π(x)\pi(x)).

  1. Shrinking: this phase is executed only when the value rr returned by the Scaling Algorithm grows larger than 2R2R. If this is the case, then RR is set to the current value of rr, and TT is shrunk as follows. Let ToldT_{\mathrm{old}} be the coreset TT before the shrinkage and set T={u}T=\{u\}, where uu is an arbitrary point of ToldT_{\mathrm{old}} (keeping the weight that it had in ToldT_{\mathrm{old}}); then cycle through the remaining points of ToldT_{\mathrm{old}} and, for each such point yy, add yy to TT (carrying over its existing weight) if its nearest neighbor in the current TT is at distance greater than (ε′/(2γ))R(\varepsilon'/(2\gamma))R. Otherwise, letting y′y' be yy's nearest neighbor in the current TT, “merge” yy into y′y' by setting w(y′)←w(y′)+w(y)+1w(y') \leftarrow w(y')+w(y)+1, where the +1+1 accounts for yy itself, and discard yy. A consequence of the merging is that all points processed so far which had yy as their proxy in ToldT_{\mathrm{old}} (including yy itself) will now have y′y' as their new proxy. (Observe that the coreset TT resulting from

the shrinking depends on the (arbitrary) order in which the points of ToldT_{\mathrm{old}} are processed.)

Algorithm 3: StreamingCoreset(X,k,z,ε′,δ)(X, k, z, \varepsilon', \delta)

  1. γ←2(2+δ)\gamma\leftarrow2(2+\delta)

  2. (S,r)←(S,r) \leftarrow solution computed by the δ\delta-Scaling Algorithm on the first k+z+1k+z+1 points

  3. R←rR \leftarrow r; T←∅T \leftarrow\varnothing

  4. foreach xx among the first k+z+1k+z+1 points do

    1. Insert(x)(x)

  5. while the stream is not ended do

    1. Let xx be the next point of the stream.

    2. Feed xx to the Scaling Algorithm, updating (S,r)(S,r).

    3. Insert(x)(x)

    4. if r>2Rr>2R then

      1. R←rR \leftarrow r

      2. Shrink()

  6. return (T,w)(T,w)

Algorithm 4: Insert(x)(x)

  1. if T=∅T=\varnothing then

    1. T←{x}T \leftarrow\{x\}

    2. w(x)←0w(x) \leftarrow0

  2. else

    1. p←argmin⁡p′∈Td(x,p′)p \leftarrow\operatorname*{argmin}_{p'\in T} d(x,p')

    2. if d(x,p)>(ε′/(2γ))Rd(x,p)>(\varepsilon'/(2\gamma))R then

      1. T←T∪{x}T \leftarrow T\cup\{x\}; w(x)←0w(x) \leftarrow0

  3. else

    1. w(p)←w(p)+1w(p) \leftarrow w(p)+1 // pp is the proxy π(x)\pi(x)

Algorithm 5: Shrink()

  1. Told←TT_{\mathrm{old}} \leftarrow T;

  2. Reinitialize TT with an arbitrary point u∈Toldu\in T_{\mathrm{old}}

  3. foreach y∈Told∖{u}y\in T_{\mathrm{old}}\setminus\{u\} do

    1. y′←argmin⁡y′′∈Td(y,y′′)y' \leftarrow\operatorname*{argmin}_{y''\in T} d(y,y'')

    2. if d(y,y′)>(ε′/(2γ))Rd(y,y')>(\varepsilon'/(2\gamma))R then

      1. T←T∪{y}T \leftarrow T\cup\{y\} // yy survives, w(y)w(y) unchanged

    3. else // y′y' becomes proxy for yy and for all points whose // proxy was yy

      1. w(y′)←w(y′)+w(y)+1w(y') \leftarrow w(y')+w(y)+1

Before proceeding with the analysis, it is important to observe that StreamingCoreset is designed in such a way that parameter δ\delta, which is inherited from the Scaling Algorithm of [14], does not affect the stated properties of the returned coreset and, as we will see later, does not influence the approximation ratio of our algorithm. However, it will have a role in regulating the space-time tradeoffs. The following theorem shows that the coreset construction is correct.

Theorem 3. The coreset TT returned by StreamingCoreset(X,k,z,ε′,δ)(X, k, z, \varepsilon', \delta) satisfies Properties P1, P2, and P3 stated before.

Proof. Property P1 is explicitly enforced by Procedures INSERT and SHRINK. As for Properties P2 and P3, we argue, by induction, that they hold at the end of each iteration of the while loop of StreamingCoreset, with respect to the current values of rr, RR, and TT, and to the prefix of points of the stream processed so far. It is easy to see that they hold at the beginning of the loop, that is, after the initialization phase (Lines 1–5 of StreamingCoreset). Suppose that they hold when xx is the next point to be processed. Clearly, they remain valid after the call to INSERT(x)(x). It remains to show that they also hold in case r>2Rr > 2R and Lines 11–12 are executed. Let RoldR_{old} denote the value of RR right before the execution of Line 11, and let RR be the new value set by Line 11 (thus R>2RoldR > 2R_{old}). Let also ToldT_{old} denote the coreset before the execution of SHRINK(), and TT be the coreset resulting after the execution of SHRINK(). By induction and by the fact that INSERT(x)(x) does not create violations to the properties, we have that, before the execution of SHRINK(), for every point aa of the stream already processed, there exists a proxy π(a)∈Told\pi(a) \in T_{old} such that d(a,π(a))≤(ε′/γ)Roldd(a,\pi(a)) \le(\varepsilon'/\gamma)R_{old}. Now, after the execution of SHRINK() some element y∈Toldy \in T_{old} might be excluded from TT, adding weight w(y)+1w(y)+1 to w(y′)w(y'), for some y′∈Ty' \in T with d(y,y′)≤(ε′/(2γ))Rd(y,y') \le(\varepsilon'/(2\gamma))R. In this case, every point aa which had yy as its proxy in ToldT_{old} (including yy itself) will now have y′y' as new proxy in TT, and

d(a,y′)≤d(a,y)+d(y,y′)≤ε′γRold+ε′2γR<ε′γR.d(a,y') \le d(a,y) + d(y,y') \le\frac{\varepsilon'}{\gamma}R_{old} + \frac{\varepsilon'}{2\gamma}R < \frac{\varepsilon'}{\gamma}R.

This immediately implies that Properties P2 and P3 still hold after the execution of SHRINK().

We now argue that if ε′\varepsilon' is sufficiently small, namely ε′<2(α−β)\varepsilon' < 2(\alpha-\beta), the set of outliers XoutX_{out} is a subset of TT and can be easily identified, using the weights. We first need a technical fact.

Fact 3 rk+z∗(X)≤ℓk∗r^*_{k+z}(X) \le\ell^*_k.

Proof. By [5 Equation 1] we know that

rk+z∗(X)≤rk∗(Xin).r^*_{k+z}(X) \le r^*_k(X_{in}).

The fact follows by the anticover property stated by Equation (1).

The following two lemmas show that TT contains all the outliers and state useful properties that enable retrieving the outliers from TT.

Lemma 2. If α>ε′/2\alpha> \varepsilon'/2, then, for every outlier x∈Xoutx \in X_{out} we have x∈Tx \in T and w(x)=0w(x)=0.

Proof. Consider an arbitrary point x∈Xoutx \in X_{\mathrm{out}}. We first show that x∈Tx \in T. By contradiction, if this were not the case, the properties of TT would imply the existence of a proxy π(x)∈T\pi(x) \in T such that

d(x,π(x))≤(ε′/γ)R≤(ε′/(2(2+δ)))r≤(ε′/2)rk+z(X)≤(ε′/2)ℓk∗<αℓk∗.\begin{aligned} d(x,\pi(x)) &\le(\varepsilon'/\gamma)R\\ &\le(\varepsilon'/(2(2+\delta)))r\\ &\le(\varepsilon'/2)r_{k+z}(X)\\ &\le(\varepsilon'/2)\ell_k^* < \alpha\ell_k^*. \end{aligned}

which is impossible since, by the hypotheses on XoutX_{\mathrm{out}}, d(x,NN⁡(x))≥αℓk∗d(x,\operatorname{NN}(x)) \ge\alpha\ell_k^*. Note that the last inequality is justified by the fact that α>1>ε′/2\alpha> 1 > \varepsilon'/2. Finally, observe that w(x)=0w(x) = 0 since, otherwise, there would exist a point x′∈X∖Tx' \in X\setminus T such that x=π(x′)x = \pi(x'), which would yield a similar contradiction as the one obtained above.

Lemma 3

Lemma 3. If α>β+ε′/2\alpha> \beta+ \varepsilon'/2, then XoutX_{\mathrm{out}} coincides with the zz 0-weight points of TT with largest distance from their respective nearest neighbor in TT.

Proof. Let T′={x∈T:w(x)=0}T' = \{x \in T : w(x) = 0\}. By Lemma 2 we know that Xout⊆T′X_{\mathrm{out}} \subseteq T'. For any outlier x∈Xoutx \in X_{\mathrm{out}}, we have that d(x,NN⁡(x))≥αℓk∗d(x,\operatorname{NN}(x)) \ge\alpha\ell_k^*, therefore the distance between xx and its nearest neighbor in TT is also at least αℓk∗\alpha\ell_k^*. Thus, to prove the lemma, it is sufficient to show that for any inlier x∈T∩Xinx \in T \cap X_{\mathrm{in}}, with w(x)=0w(x) = 0, there is a point y∈Ty \in T, with y≠xy \ne x, such that d(x,y)<αℓk∗d(x,y) < \alpha\ell_k^*. Consider an arbitrary inlier x∈T∩Xinx \in T \cap X_{\mathrm{in}}, with w(x)=0w(x) = 0. Let a=NN⁡(x)a = \operatorname{NN}(x). If a∈Ta \in T, then, by the hypotheses on XinX_{\mathrm{in}}, we know that d(x,a)≤βℓk∗<αℓk∗d(x,a) \le\beta\ell_k^* < \alpha\ell_k^*. If instead a∉Ta \notin T, by the properties of TT we know that there exists π(a)∈T\pi(a) \in T, such that d(a,π(a))≤(ε′/γ)R≤(ε′/2)ℓk∗d(a,\pi(a)) \le(\varepsilon'/\gamma)R \le(\varepsilon'/2)\ell_k^*. Clearly, since w(x)=0w(x) = 0, we must have that x≠π(a)x \ne\pi(a), hence

d(x,π(a))≤d(x,a)+d(a,π(a))≤βℓk∗+(ε′/2)ℓk∗<αℓk∗.\begin{aligned} d(x,\pi(a)) &\le d(x,a) + d(a,\pi(a))\\ &\le\beta\ell_k^* + (\varepsilon'/2)\ell_k^*\\ &< \alpha\ell_k^*. \end{aligned}

Once the set of outliers XoutX_{\mathrm{out}} has been identified, they can be excluded from TT, and the solution can be computed by running any standard, sequential max-min diversification algorithm AA on T∖XoutT \setminus X_{\mathrm{out}}. Algorithm 6 outlines the complete pipeline. Note that the weights are needed only to identify the outliers, while the last step works on the point set T∖XoutT \setminus X_{\mathrm{out}}, disregarding their weights.

Algorithm 6: Streaming(XX, kk, zz, ε\varepsilon, δ\delta, AA)
1 ε′←ε/(1+ε)\varepsilon' \leftarrow\varepsilon/(1+\varepsilon)
2 (T,w)←StreamingCoreset⁡(X,k,z,ε′,δ)(T,w) \leftarrow\operatorname{StreamingCoreset}(X,k,z,\varepsilon',\delta)
3 Let (t1,t2,…,tj)(t_1,t_2,\ldots,t_j) be the sequence of points t∈Tt \in T with w(t)=0w(t)=0, sorted in descending order by their nearest neighbor distance in TT.
4 Xout←{ti∣1≤i≤z}X_{\mathrm{out}} \leftarrow\{t_i \mid1 \le i \le z\}
5 return A(T∖Xout,k)A(T \setminus X_{\mathrm{out}},k)

Table 6.

The following two lemmas analyze the quality of the coreset TT computed by StreamingCoreset, and its size.

Lemma 4. Let TT be the coreset returned by StreamingCoreset(X,k,z,ε′,δ)(X,k,z,\varepsilon',\delta). If ε′<2α\varepsilon' < 2\alpha, then TT is a 1/(1−ε′)1/(1-\varepsilon')-coreset for max-min diversification with outliers on XX.

Proof. Let Ok⊆XinO_k \subseteq X_{\mathrm{in}} be the optimal subset of kk inliers, so that div⁡(Ok)=ℓk∗\operatorname{div}(O_k)=\ell_k^*, and, for each o∈Oko \in O_k, consider its proxy π(o)∈T\pi(o) \in T. Lemma 2 guarantees that π(o)\pi(o) is an inlier and, by arguing as in the proof of Lemma 2, we can show that d(o,π(o))≤(ε′/2)ℓk∗d(o,\pi(o)) \leq(\varepsilon'/2)\ell_k^*. By applying [9 Lemma 1] we can then conclude that TT is a 1/(1−ε′)1/(1-\varepsilon')-coreset for max-min diversification on XinX_{\mathrm{in}}, that is, a 1/(1−ε′)1/(1-\varepsilon')-coreset for max-min diversification with outliers on XX. □\square

Lemma 5. Let TT be the coreset returned by StreamingCoreset(X,k,z,ε′,δ)(X,k,z,\varepsilon',\delta), and define MM as the maximum size of TT over the course of the algorithm. Then,

M=O((k+z)(32(2+δ)ε′)D)M = O\left((k+z)\left(\frac{32(2+\delta)}{\varepsilon'}\right)^D\right)

Proof. Recall that, at any given time in the algorithm, the value rr is a (2+δ)(2+\delta)-approximation of the optimal radius rk+z∗(X′)r^*_{k+z}(X') of a (k+z)(k+z)-clustering of the set X′⊆XX' \subseteq X of stream points seen so far, and that RR is such that r/2≤R≤rr/2 \leq R \leq r. Consider now an optimal (k+z)(k+z)-clustering of X′X' of radius rk+z∗(X′)r^*_{k+z}(X'). Since the stream has doubling dimension DD, for any integer i≥0i \geq0, each cluster can be partitioned into at most 2iD2^{iD} disjoint balls of radius at most rk+z∗(X′)/2ir^*_{k+z}(X')/2^i. By choosing i=⌈log⁡2((rk+z∗(X′)/R)(4γ/ε′))⌉≤⌈log⁡2(8γ/ε′)⌉i=\left\lceil\log_2((r^*_{k+z}(X')/R)(4\gamma/\varepsilon'))\right\rceil\leq\left\lceil\log_2(8\gamma/\varepsilon')\right\rceil, and recalling that γ=2(2+δ)\gamma=2(2+\delta), we obtain that all the elements seen so far can be partitioned into at most (k+z)(32(2+δ)/ε′)D(k+z)(32(2+\delta)/\varepsilon')^D disjoint balls of radius at most (ε′/(4γ))R(\varepsilon'/(4\gamma))R. Then, by Property P1, no such ball can contain two points of TT, and the lemma follows. □\square

The following theorem states the quality and the performance of our streaming algorithm, and represents the main result of this work.

Theorem 4. Let X=Xin∪XoutX=X_{\mathrm{in}}\cup X_{\mathrm{out}} be a dataset of nn points in a metric space with doubling dimension DD, and let ε,δ∈(0,1)\varepsilon,\delta\in(0,1) be two accuracy parameters. Set ε′=ε/(1+ε)\varepsilon'=\varepsilon/(1+\varepsilon). Suppose that the outliers satisfy the separation assumption with α>β+ε′/2\alpha>\beta+\varepsilon'/2, and let AA be a sequential λ\lambda-approximation algorithm whose time and space complexities are denoted by tA(⋅)t_A(\cdot) and sA(⋅)s_A(\cdot), respectively. Then, Algorithm 6 runs in one pass and returns a λ(1+ε)\lambda(1+\varepsilon)-approximate solution to max-min diversification with outliers for XX. Moreover, it requires

  • a working memory of size

O((k+z)1δlog⁡1δ+M+sA(M));O\left((k+z)\frac{1}{\delta}\log\frac{1}{\delta}+M+s_A(M)\right);

– a worst-case update time

O((k+z)21δlog⁡(1δ)+M2);O\left((k+z)^2\frac{1}{\delta}\log\left(\frac{1}{\delta}\right)+M^2\right);

– an amortized update time

O(1δ((k+z)log⁡(1δ)+min⁡{log⁡Δ,n}n(k+z)2)+M+min⁡{log⁡Δ,n}nM2);O\left(\frac{1}{\delta}\left((k+z)\log\left(\frac{1}{\delta}\right)+\frac{\min\{\log\Delta,n\}}{n}(k+z)^2\right)+M+\frac{\min\{\log\Delta,n\}}{n}M^2\right);

– and a query time (to compute the final solution) O(tA(M))O(t_{\mathcal{A}}(M)),

where M=O((k+z)(32(2+δ)(1+ε)/ε)D)M=O\left((k+z)(32(2+\delta)(1+\varepsilon)/\varepsilon)^D\right) denotes the maximum coreset size and Δ\Delta denotes the aspect ratio of the stream, that is, the ratio between the maximum and minimum pairwise distances between points of the stream.

Proof. Let ε′=ε/(1+ε)\varepsilon'=\varepsilon/(1+\varepsilon). Observe that if ε∈(0,1)\varepsilon\in(0,1) then ε′∈(0,1)\varepsilon'\in(0,1). This implies that the analysis of StreamingCoreset is valid for ε′=ε/(1+ε)\varepsilon'=\varepsilon/(1+\varepsilon). The bound on the approximation ratio follows since, by Lemma 4, the coreset TT returned by StreamingCoreset(X,k,z,ε′,δ)(X,k,z,\varepsilon',\delta) is a (1/(1−ε′))(1/(1-\varepsilon'))-coreset, that is a (1+ε)(1+\varepsilon)-coreset for max-min diversification with outliers on XX, and, by Lemma 3, the set given in input to the sequential λ\lambda-approximation algorithm A\mathcal{A} consists exactly of all the inliers in TT. The bound on the working memory size is obtained by adding up the space required by the execution of the δ\delta-Scaling Algorithm, which has been recalled at the end of § 2.4, the maximum coreset size, bounded from above by Lemma 5, and the space required by A\mathcal{A} to compute the final solution. Let us focus now on the update time. The terms dependent on kk and δ\delta are contributed by the δ\delta-Scaling Algorithm, and have been recalled at the end of § 2.4, while the terms dependent on the maximum coreset size MM are justified as follows. Consider the arrival of a new point. If Procedure Shrink() is not invoked (i.e., rr does not grow larger than 2R2R), then it is easy to see that the arrival is handled in O(M)O(M) time, while if Procedure Shrink() is invoked, its execution requires O(M2)O(M^2) time. However, since every time Shrink() is invoked the radius RR grows by a factor larger than 2 and its value is always between dmin⁡/2d_{\min}/2 and (2+δ)dmax⁡(2+\delta)d_{\max}, where dmin⁡d_{\min} and dmax⁡d_{\max} are, respectively, the minimum and maximum pairwise distances between points of XX, we have that Shrink() is invoked O(min⁡{log⁡Δ,n})O(\min\{\log\Delta,n\}) times over the nn arrivals. The bounds on the worst-case and amortized update times follow immediately by the above considerations. Finally, the bound on the query time is straightforward. □\square

It is important to observe that, when the parameters ε\varepsilon, δ\delta, and DD are constant, the working space and query time of our streaming algorithm are linear in (k+z)(k+z) and do not depend on the stream size nn, while the worst-case update time is O((k+z)2)O((k+z)^2) and, again, does not depend on nn. Finally, the amortized update time is O((k+z)+(k+z)2(log⁡Δ)/n)O((k+z)+(k+z)^2(\log\Delta)/n), which can be considerably smaller than the worst-case update time for datasets with reasonable aspect ratios. By multiplying the amortized update time by nn, we may conclude that the cumulative running time of the streaming algorithm is not dissimilar from the running time of the sequential algorithm presented in § 3, which however requires space linear in nn.

References

  1. [1]Agarwal, P.K., Har-Peled, S., Varadarajan, K.R.: Geometric approximation via coresets. Combinatorial and computational geometry 52, 1–30 (2005)DOI
  2. [2]Amagata, D., Onizuka, M., Hara, T.: Fast and exact outlier detection in metric spaces: A proximity graph-based approach. In: SIGMOD. pp. 36–48 (2021)
  3. [3]Amagata, D., Onizuka, M., Hara, T.: Fast, exact, and parallel-friendly outlier detection algorithms with proximity graph in metric spaces. VLDB J. 31(4), 797–821 (2022)DOI
  4. [4]Amagata, D.: Diversity maximization in the presence of outliers. Proceedings of the AAAI Conference on Artificial Intelligence 37(10), 12338–12345 (Jun 2023)DOI
  5. [5]Ceccarello, M., Pietracaprina, A., Pucci, G.: Solving k-center clustering (with outliers) in MapReduce and streaming, almost as accurately as sequentially. Proc. VLDB Endow. 12(7), 766–778 (2019)arxiv.org/abs/1802.09205
  6. [6]Ceccarello, M., Pietracaprina, A., Pucci, G.: A general coreset-based approach to diversity maximization under matroid constraints. ACM-TKDD 14(5), 60:1–60:27 (2020)arxiv.org/abs/2002.03175
  7. [7]Ceccarello, M., Pietracaprina, A., Pucci, G., Soldà, F.: Scalable and space-efficient robust matroid center algorithms. J. Big Data 10(1), 49 (2023)DOI
  8. [8]Ceccarello, M., Pietracaprina, A., Pucci, G., Visonà, F.: Fair center clustering in sliding windows. ArXiv abs/2503.05260 (2025)arxiv.org/abs/2503.05260
  9. [9]Ceccarello, M., Pietracaprina, A., Pucci, G., Upfal, E.: MapReduce and streaming algorithms for diversity maximization in metric spaces of bounded doubling dimension. Proc. VLDB Endow. 10(5), 469–480 (2017)arxiv.org/abs/1605.05590
  10. [10]Gonzalez, T.: Clustering to minimize the maximum intercluster distance. Theoretical Computer Science 38, 293–306 (1985)DOI
  11. [11]Gu, X., Akoglu, L., Rinaldo, A.: Statistical analysis of nearest neighbor methods for anomaly detection. In: NeurIPS. pp. 10921–10931 (2019)arxiv.org/abs/1907.03813
  12. [12]Gupta, A., Krauthgamer, R., Lee, J.R.: Bounded geometries, fractals, and low-distortion embeddings. In: Proc. 44th IEEE Symposium on Foundations of Computer Science (FOCS). pp. 534–543 (2003). https://doi.org/10.1109/SFCS.2003.1238226
  13. [13]Indyk, P., Mahabadi, S., Mahdian, M., Mirrokni, V.: Composable core-sets for diversity and coverage maximization. In: ACM PODS. pp. 100–108 (2014)DOI
  14. [14]McCutchen, R., Khuller, S.: Streaming algorithms for k-center clustering with outliers and with anonymity. In: APPROX-RANDOM. LNCS, vol. 5171, pp. 165–178. Springer (2008)DOI
  15. [15]Ravi, S., Rosenkrantz, D., Tayi, G.: Heuristic and special case algorithms for dispersion problems. Operations Research 42, 299–310 (04 1994). https://doi.org/10.1287/opre.42.2.299

Paper details

vlnc:W_3cyhd55g
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY-SA 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents