Exact sampling of determinantal point processes with sublinear time preprocessing
Michał Dereziński, Daniele Calandriello, Michal Valko
Introduction
Our method is based on a technique developed recently by and later extended by . In this approach, we carefully downsample the index set to a sample that is small but still sufficiently larger than the expected target size , and then run a DPP on . As the downsampling distribution we use a regularized determinantal point process (R-DPP), proposed by , which (informally) samples with probability , where is a rescaled version of . Overall, the approach is described in the diagram below, where ,
Given a psd matrix , its th -ridge leverage score (RLS) is the th diagonal entry of . The -effective dimension is the sum of the leverage scores, .
Intuitively, if the marginal probability of is high, then this index should likely make it into the intermediate sample . This suggests that i.i.d. sampling of the indices proportionally to 1-ridge leverage scores, i.e. , should serve as a reasonable and cheap heuristic for constructing . In fact, we can show that this distribution can be easily corrected by rejection sampling to become the R-DPP that we need. Computing ridge leverage scores exactly costs , so instead we compute them approximately by first constructing a Nyström approximation of .
Let be a psd matrix and a subset of its row/column indices with size . Then we define the Nyström approximation of based on as the matrix .
While our main algorithm can sample only from the random-size DPP, and not from the fixed-size -DPP, we present a rigorous reduction argument which lets us use our DPP algorithm to sample exactly from a -DPP (for any ) with a small computational overhead.
Prior to our work, fast exact sampling from generic DPPs has been considered out of reach. The first procedure to sample general DPPs was given by and even most recent exact refinements , when the DPP is represented in the form of an -ensemble, require preprocessing that amounts to an expensive matrix diagonalization at the cost , which is shown as the first-sample complexity column in Table 1.
Nonetheless, there are well-known samplers for very specific DPPs that are both fast and exact, for instance for sampling uniform spanning trees , which leaves the possibility of a more generic fast sampler open. Since the sampling from DPPs has several practical large scale machine learning applications , there are now a number of methods known to be able to sample from a DPP approximately, outlined in the following paragraphs.
As DPPs can be specified by kernels (-kernels or -kernels), a natural approximation strategy is to resort to low-rank approximations . For example, provides approximate guarantee for the probability of any subset being sampled as a function of eigengaps of the -kernel. Next, construct coresets approximating a given -DPP and then use them for sampling. In their Section 4.1, show in which cases we can hope for a good approximation. These guarantees become tight if these approximations (Nyström subspace, coresets) are aligned with data. In our work, we aim for an adaptive approach that is able to provide a good approximation for any DPP.
The second class of approaches are based on Markov chain Monte-Carlo techniques . There are known polynomial bounds on the mixing rates of MCMC chains with arbitrary DPPs as their limiting measure. In particular, showed them for cardinality-constrained DPPs and for the general case. The two chains have mixing times which are, respectively, linear and quadratic in (see Table 1). Unfortunately, for any subsequent sample we need to wait until the chain mixes again.
Neither the known low-rank approximations or the known MCMC methods are able to provide samples that are exactly distributed (also called perfect sampling) according to a DPP. This is not surprising as having scalable and exact sampling is very challenging in general. For example, methods based on rejection sampling are always exact, but they typically do not scale with the dimension and are adversely affected by the spikes in the distribution , resulting in high rejection rate and inefficiency. Surprisingly, our method is based on both low-rank approximation (a source of inaccuracy) and rejection sampling (a common source of inefficiency). In the following section, we show how to obtain a perfect DPP sampler from a Nyström approximation of the -kernel. Then, to guarantee efficiency, in Section 3 we bound the number of rejections, which is possible thanks to the use of intermediate downsampling.
Exact sampling using any Nyström approximation
As discussed in the introduction, our method relies on an intermediate downsampling distribution to reduce the size of the problem. The exactness of our sampler relies on the careful choice of that intermediate distribution. To that end, we use regularized determinantal processes, introduced by . In the below definition, we adapt them to the kernel setting.
For any , , and defined as in Definition 3,
To sample from the R-DPP, DPP-VFX uses rejection sampling, where the proposal distribution is sampling i.i.d. proportionally to the approximate 1-ridge leverage scores (see Definition 1 and the following discussion), computed using any Nyström approximation of matrix . Apart from , the algorithm also requires an additional parameter , which controls the size of the intermediate sample. Because of rejection sampling and Proposition 1, the correctness of the algorithm does not depend on the choice of and , as demonstrated in the following result. The key part of the proof involves showing that the acceptance probability in Line 4 is bounded by 1. Here, we obtain a considerably tighter bound than the one achieved by , which allows us to use a much smaller intermediate sample (see Section 3) while maintaning the efficiency of rejection sampling.
Proof We start by showing that the Bernoulli probability in Line 4 is bounded by 1. Note that this is important not only to sample correctly, but also when we later establish the efficiency of the algorithm. If we showed a weaker upper bound, say , we could always divide the expression by and retain the correctness, however it would also be times less likely that .
Since is a Nyström approximation for some , it can be written as
for any such that , where is a projection (so that ). Let , where the th row of is the rescaled th row of , i.e. . Then, we have
Thus, we showed that the expression in Line 4 is valid. Let denote the random variable distributed as is after exiting the repeat loop. It follows that
Let be a random set variable with any distribution. Suppose that and are returned by two executions of DPP-VFX, both using inputs constructed from the same and . Then and are (unconditionally) independent.
Conditions for fast sampling
The complexity cost of DPP-VFX can be roughly summarized as follows: we pay a large one-time cost to precompute and all its associated quantities, and then we pay a smaller cost in the rejection sampling scheme which must be multiplied by the number of times we repeat the loop until acceptance. We first show that if the sum of the approximate RLS (i.e., , denoted by ) is sufficiently close to , then we will exit the loop with high probability. We then analyze how accurate the precomputing step needs to be to satisfy this condition.
If the Nyström approximation and the intermediate sample size parameter satisfy
then . Therefore, with probability Algorithm 1 exits the rejection sampling loop after at most iterations and, after precomputing all of the inputs, the time complexity of the rejection sampling loop is O\big{(}k^{6}\log\delta^{-1}+\log^{4}\!\delta^{-1}\big{)}.
Proof Le be distributed as in Line 3. The probability of exiting the repeat loop at each iteration is
Let be constructed by sampling columns proportionally to their RLS. Then, with probability , satisfies the assumption of Theorem 3.
There exist many algorithms to sample columns proportionally to their RLS. For example, we can take the BLESS algorithm from with the following guarantee.
There exists an algorithm that with probability samples columns proportionally to their RLS in time.
We can now compute the remaining preprocessing costs, given a Nyström approximation .
Given with rank , we can compute , , , and in time.
We are finally ready to combine these results to fully characterize the computational cost.
subset in: time,
then, in: \mathcal{O}\big{(}k^{6}\log\frac{1}{\delta}+\log^{4}\!\frac{1}{\delta}\big{)} time.
Discussion. Due to the nature of rejection sampling, as long as we exit the loop, i.e., we accept the sample, the output of DPP-VFX is guaranteed to follow the DPP distribution for any value of . In Theorem 1 we set to satisfy Theorem 3 and guarantee a constant acceptance probability in the rejection sampling loop, but this might not be necessary or even desirable in practice. Experimentally, much smaller values of , starting from seem to be sufficient to accept the sample, while at the same time a smaller greatly reduces the preprocessing costs. In general, we recommend to separate DPP-VFX in three phases. First, compute an accurate estimate of the RLS using off-the-shelf algorithms in time. Then, sample a small number of columns to construct an explorative , and try to run DPP-VFX If the rejection sampling loop does not terminate sufficiently fast, then we can reuse the RLS estimates to compute a more accurate for a larger . Using a simple doubling schedule for , this procedure will quickly reach a regime where DPP-VFX is guaranteed to accept w.h.p., maintaining its asymptotic complexity, while at the same time resulting in faster sampling in practice.
Reduction from DPPs to k-DPPs
We next show that with a simple extra rejection sampling step we can efficiently transform any exact DPP sampler into an exact -DPP sampler.
A common heuristic to sample from a -DPP is to first sample from a DPP, and then reject the sample if the size of is not exactly . The success probability of this procedure can be improved by appropriately rescaling by a constant factor ,
Experiments
In this section, we experimentally evaluate the performance of DPP-VFX compared to exact sampling and MCMC-based approaches . In particular, since Section 2 proves that DPP-VFX samples exactly from the DPP, we are interested in evaluating computational performance. This will be characterized by showing how DPP-VFX and baselines scale with the size of the matrix when taking a first sample, and how DPP-VFX achieves constant time when resampling.
To construct we use random subsets of the infinite MNIST digits dataset , where varies up to and . We use an RBF kernel with to construct . All algorithms are implemented in python. For exact and MCMC sampling we used the DPPy library, , while for DPP-VFX we reimplemented BLESS , and used DPPy to perform exact sampling on the intermediate subset. All experiments are carried out on a 24-core CPU and fully take advantage of potential parallelization. For the Nyström approximation we set . While this is much lower than the value suggested by the theory, as we will see it is already accurate enough to result in drastic runtime improvements over exact and MCMC. For each algorithm we controlFor simplicity we do not perform the full -DPP rejection step, but only adjust the expected size of the set. the size of the output set by rescaling the input matrix by a constant, following the strategy of Section 4. In Figure 1 we report our results, means and 95% confidence interval over 10 runs, for subsets of MNIST that go from to , i.e., the whole original MNIST dataset.
Exact sampling is clearly cubic in , and we cannot push our sampling beyond . For MCMC, we enforce mixing by runnning the chain for steps, the minimum recommended by . However, for the MCMC runtime is seconds and cannot be included in the plot, while DPP-VFX completes in seconds, an order of magnitude faster. Moreover, DPP-VFX rarely rejects more than 10 times, and the mode of the rejections up to is , that is we mostly accept at the first iteration. Figure 2 reports the cost of the second sample, i.e., of resampling. For exact sampling, this means that an eigendecomposition of is already available, but as the plot shows the resampling process still scales with . On the other hand, DPP-VFX’s complexity (after preprocessing) scales only with and remains constant regardless of .
Finally, we scaled DPP-VFX to points, a regime where neither exact nor MCMC approaches are feasible. We report runtime and average rejections, with mean and 95% confidence interval over 5 runs. DPP-VFX draws its first sample in seconds, with only rejections.
MD thanks the NSF for funding via the NSF TRIPODS program.
References
Appendix A Omitted proofs for the main algorithm
In this section we present the proofs omitted from Sections 2 and 3, which regarded the correctness and efficiency of DPP-VFX. We start by showing that multiple samples drawn using the same Nyström approximation are independent.
Let be a random set variable with any distribution. Suppose that and are returned by two executions of DPP-VFX, both using inputs constructed from the same and . Then and are (unconditionally) independent.
Proof Let and be two subsets of representing elementary events for and , respectively. Theorem 2 implies that
Now, for any representing elementary events for and we have that
Since , we get that and are independent. We now bound the precompute cost, starting with the construction of the Nyström approximation .
Let be constructed by sampling columns proportionally to their RLS. Then, with probability , satisfies the assumption of Theorem 3.
Proof Let and (where is a projection matrix). Using algebraic manipulation, we can write
The matrix in the above expression been recently analyzed by in the context of RLS sampling who gave the following result that we use in the proof.
Let the projection matrix be constructed by sampling columns proportionally to their RLS. Then,
Tuning we obtain and reordering gives us the desired accuracy result. Similarly, we can invert the bound of Proposition 3 to obtain
Given and an arbitrary Nyström approximation of rank , computing , , , and requires time.
Appendix B Omitted proofs for the reduction to k-DPPs
In this section we present the proofs omitted from Section 4. Recall that our approach is based on the following rejection sampling strategy:
First, we show the existence of the factor for which the rejection sampling is efficient.
Our starting point is a standard Chernoff bound for .
The distribution of is given by , where is the th elementary symmetric polynomial of the eigenvalues of a matrix. Denoting as the eigenvalues of , we can express the elementary symmetric polynomials as the coefficients of the following univariate polynomial with real non-positive roots,
The non-negative coefficients of such a real-rooted polynomial form a unimodal sequence (Lemma 1.1 in ), i.e., , with the mode (shared between no more than two positions ) being close to the mean : (Theorem 2.2 in ). Moreover, it is easy to see that and for large enough , so since the sequence is continuous w.r.t. , for every there is an such that (every can become one of the modes). In light of (2), this means that
where the last inequality holds because . Finally, we show how to find efficiently.
Given a Poisson binomial r.v. with mean , let . The mode is
Let be constructed by sampling columns proportionally to their RLS. Then with probability
Proof of Lemma 9 We simply apply the same reasoning of Lemma 2 on both sides. Let , with that will be tuned shortly. Then proving the first inequality to satisfy Proposition 5 is straightforward: . To satisfy the other side we upper bound We must now choose such that . Substituting, we obtain Plugging this in the definition of we obtain that must be optimized to satisfy
which we plug in the definition of obtaining our neccessary accuracy . Therefore, sampling columns gives us a sufficiently accurate to be optimized. However, we still need to bound , which we can do as follows using Lemma 9 and
Therefore suffices accuracy wise. Moreover, since is parametrized only in terms of the eigenvalues of , which can be found in time, we can compute an such that in time, which guarantees Finally, note that these bounds on the accuracy of are extremely conservative. In practice, it is much faster to try to optimize on a much coarser first, e.g., for , and only if this approach fails to increase the accuracy of .