O NLINE MAP I NFERENCE AND L EARNING FOR N ONSYMMETRIC D ETERMINANTAL P OINT P ROCESSES
Anonymous authors
Paper under double-blind review
A BSTRACT
In this paper, we introduce the online and streaming MAP inference and learning problems for Non-symmetric Determinantal Point Processes (NDPPs) where data points arrive in an arbitrary order and the algorithms are constrained to use a singlepass over the data as well as sub-linear memory.
The online setting has an additional requirement of maintaining a valid solution at any point in time.
For solving these new problems, we propose algorithms with theoretical guarantees, evaluate them on several real-world datasets, and show that they give comparable performance to state-of-the-art ofﬂine algorithms that store the entire data in memory and take multiple passes over it.
I NTRODUCTION
Determinantal Point Processes (DPPs) were ﬁrst introduced in the context of quantum mechanics (Macchi, 1975) and have subsequently been extensively studied with applications in several areas of pure and applied mathematics like graph theory, combinatorics, random matrix theory (Hough et al., 2006; Borodin, 2009), and randomized numerical linear algebra (Derezinski & Mahoney, 2021).
Discrete DPPs have gained widespread adoption in machine learning following the seminal work of
Kulesza & Taskar (2012) and there has been a recent explosion of interest in DPPs in the machine learning community.
For instance, some of the very recent uses of DPPs include automation of deep neural network design (Nguyen et al., 2021), deep generative models (Chen & Ahmed, 2021), document and video summarization (Perez-Beltrachini & Lapata, 2021), image processing (Launay et al., 2021), and learning in games (Perez-Nieves et al., 2021).
A DPP is a probability distribution over subsets of items and is characterized by some kernel matrix such that the probability of sampling any particular subset is proportional to the determinant of the submatrix corresponding to that subset in the kernel.
Until very recently, most prior work on
DPPs focused on the setting where the kernel matrix is symmetric. Due to this constraint, DPPs can only model negative correlations between items.
Recent work has shown that allowing the kernel matrix to be nonsymmetric can greatly increase the expressive power of DPPs and allows them to model compatible sets of items (Gartrell et al., 2019; Brunel, 2018).
To differentiate this line of work from prior literature on symmetric DPPs, the term Nonsymmetric DPPs (NDPPs) has often been used.
Modeling positive correlations can be useful in many practical scenarios.
For instance, an
E-commerce company trying to build a product recommendation system would want the system to increase the probability of suggesting a router if a customer adds a modem to a shopping cart.
State-of-the-art algorithms for learning and inference on NDPPs (Gartrell et al., 2021) require storing the full data in memory and take multiple passes over the complete dataset.
Therefore, these algorithms take too much memory to be useful for large scale data, where the size of the entire dataset can be much larger than the random-access memory available.
These algorithms are also not practical in settings where data is generated on the ﬂy, for example, in E-commerce applications where new items are added to the store over time, and more importantly, added to the carts of users instantaneously.
This work makes the following contributions:
Streaming and Online Inference: We formulate streaming and online versions of maximum a posteriori (MAP) inference on ﬁxed-size NDPPs and provide algorithms for solving these problems.
In the streaming setting, data points arrive in an arbitrary order and the algorithms are constrained to use a single-pass over the data as well as sub-linear memory (i.e. memory that is substantially smaller than the size of the data stream).
The online setting we consider has an additional restriction that we need to maintain a valid solution at every time step.
For both these settings, we provide algorithms which have comparable or even better solution quality than the ofﬂine greedy algorithm while taking only a single pass over the data and using a fraction of the memory used by the ofﬂine algorithm.
Online Learning: We introduce the online learning problem for NDPPs and provide an algorithm which solves this problem using a single-pass over the data and memory that is constant in m , the number of baskets in the training data (or equivalently the length of the stream).
In comparison, the ofﬂine learning algorithm takes a large number of passes over the entire data and uses memory linear in m .
Strikingly, our online learning algorithm shows comparable performance (log-likelihood) to the state-of-the-art ofﬂine learning algorithm, while converging signiﬁcantly faster in all cases (Figure 2).
This is notable, since our algorithm uses only a single pass over the data, while using a tiny fraction of the memory.
[Table]
R ELATED W ORK
Even in the case of (symmetric) DPPs, the study of online and streaming settings is in a nascent stage.
In particular, Bhaskara et al.
(2020) were the ﬁrst to propose online algorithms for MAP inference of DPPs and Liu et al.
(2021) were the ﬁrst to give streaming algorithms for the maximum induced cardinality objective proposed by Gillenwater et al.
However, no work has focused on either online or streaming MAP inference or online learning for Nonsymmetric DPPs.
A special subset of NDPPs called signed DPPs were the ﬁrst class of NDPPs to be studied (Brunel et al., 2017).
Gartrell et al.
(2019) studied a more general class of NDPPs and provided learning and MAP Inference algorithms, and also showed that NDPPs have additional expressiveness over symmetric DPPs and can better model certain problems.
This was improved by Gartrell et al.
(2021) in which they provided a new decomposition which enabled linear time learning and MAP
Inference for NDPPs.
More recently, Anari & Vuong (2021) proposed the ﬁrst algorithm with a k O ( k ) approximation factor for MAP Inference on NDPPs where k is the number of items to be selected.
These works are not amenable to the streaming nor online settings that are studied in our paper.
In particular, they store all data in memory and use multiple passes over the data, among other issues.
In this work, we formally introduce the streaming and online MAP inference and online learning problems for NDPPs and develop online algorithms for solving these problems.
To the best of our knowledge, our work is the ﬁrst to study NDPPs in the streaming and online settings, and develop algorithms for solving MAP inference and learning of NDPPs in these settings.
P RELIMINARIES
Notation.
Throughout the paper, we use uppercase bold letters ( A ) to denote matrices and lowercase bold letters ( a ) to denote vectors.
Letters in normal font ( a ) will be used for scalars.
For any positive integer n , we use [ n ] to denote the set { 1 , 2 , . . . , n } .
A matrix M is said to be skew-symmetric if
M = − M (cid:62) where (cid:62) is used to represent matrix transposition.
A DPP is a probability distribution on all subsets of [ n ] characterized by a matrix L ∈ R n × n .
The probability of sampling any subset S ⊆
[ n ] i.e. Pr[ S ] ∝ det( L S ) where L S is the submatrix of L obtained by keeping only the rows and columns corresponding to indices in S .
The normalization constant for this distribution can be computed efﬁciently since we know that (cid:80) S ⊆
[ n ] det( L S )
= det( L + I n )
(Kulesza & Taskar, 2012, Theorem 2.1).
Therefore, Pr[ S ] = det( L S ) det( L + I n ) .
For the DPP corresponding to L to be a valid probability distribution, we need det( L S ) ≥ 0 for all S ⊆ [ n ] since Pr[ S ] ≥ 0 for all S ⊆ [ n ] .
Matrices which satisfy this property are known as P 0 -matrices
(Fiedler & Pták, 1966).
For any symmetric matrix L , det( L S ) ≥ 0 for all S ⊆
[ n ] if and only if L is positive semi-deﬁnite (PSD) i.e. x T Lx ≥ 0 for all x ∈ R n .
Therefore, all symmetric matrices which correspond to valid DPPs are PSD.
But there are P 0 -matrices which are not necessarily symmetric (or even positive semi-deﬁnite).
For example, L = (cid:20) − 1(cid:21) is a nonsymmetric P 0 matrix.
Any matrix L can be uniquely written as the sum of a symmetric and skew-symmetric matrix:
L =
( L + L (cid:62) ) /
2 +
( L − L (cid:62) ) / 2 .
For the DPP characterized by L , the symmetric part of the decomposition can be thought of as encoding negative correlations between items and the skewsymmetric part as encoding positive correlations.
Gartrell et al.
(2019) proposed a decomposition which covers the set of all nonsymmetric PSD matrices (a subset of P 0 matrices) which allowed them to provide a cubic time algorithm (in the ground set size) for NDPP learning.
This decomposition is
L = V (cid:62) V +( BC (cid:62) − CB
(cid:62) ) .
Gartrell et al.
(2021) provided more efﬁcient (linear time) algorithms for learning and MAP inference using a new decomposition L = V (cid:62) V + B (cid:62) CB .
Although both these decompositions only cover a subset of P 0 matrices, it turns out that they are quite useful for modeling real world instances and provide improved results when compared to (symmetric) DPPs.
For the decomposition L = V (cid:62) V + B (cid:62) CB , we have V , B ∈ R d × n , C ∈ R d × d and C is skewsymmetric.
Here we can think of the items having having a latent low-dimensional representation ( v i , b i ) where v i , b i ∈ R d .
Intuitively, a low-dimensional representation (when compared to n ) is sufﬁcient for representing items because any particular item only interacts with a small number of other items in real-world datasets, as evidenced by the fact that the maximum basket size encountered in real-world data is much smaller than n .
S TREAMING MAP I NFERENCE
In this section, we formulate the streaming MAP inference problem for NDPPs and design an algorithm for this problem with guarantees on the solution quality, space, and time.
4. S TREAMING MAP I NFERENCE P ROBLEM
We study the MAP Inference problem in low-rank NDPPs in the streaming setting where we see columns of a 2 d × n matrix in order (column-arrival model).
Given some ﬁxed skew-symmetric matrix C ∈ R d × d , consider a stream of 2 d -dimensional vectors (which can be viewed as pairs of d -dimensional vectors) arriving in order:
[Equation]
The main goal in the streaming setting is to output the maximum likelihood subset S ⊆
[ n ] of cardinality k at the end of the stream assuming that S is drawn from the NDPP characterized by
L = V (cid:62) V + B (cid:62) CB i.e.
[Equation]
For any S ⊆ [ n ] , V S ∈ R d ×| S | is the matrix whose each column corresponds to { v i , i ∈ S } .
Similarly, B S ∈ R d ×| S | is the matrix whose columns correspond to { b i , i ∈ S } .
In the case of symmetric DPPs, this maximization problem in the non-streaming setting corresponds to MAP
Inference in cardinality constrained DPPs, also known as k -DPPs (Kulesza & Taskar, 2011).
Usually, designing a streaming algorithm can be viewed as a dynamic data-structure design problem.
We want to maintain a data-structure with efﬁcient time and small space over the entire stream.
Therefore, the secondary goals are to minimize the following:
• Space: We consider word-RAM model, and use number of words * to measure it.
Deﬁnition 1.
Given three matrices V ∈ R d × k , B ∈ R d × k and C ∈ R d × d , let T det ( k, d ) denote the running time of computing
[Equation]
Note that T det ( k, d ) =
2 T mat ( d, k, d ) + T mat ( d, d, k ) + T mat ( k, k, k ) where T mat ( a, b, c ) is the time required to multiply two matrices of dimensions a × b and b × c .
We have the last T mat ( k, k, k ) term because computing the determinant of a k × k matrix can be done (essentially) in the same time as computing the product of two matrices of dimension
k × k
(Aho et al., 1974, Theorem 6.6).
We will now describe a streaming algorithm for MAP inference in NDPPs, which we call the "Streaming Partition Greedy" algorithm.
4. S TREAMING P ARTITION G REEDY
Outline of Algorithm 1 : Our algorithm picks the ﬁrst element of the solution greedily from the ﬁrst seen nk elements, the second element from the next sequence of nk elements and so on.
As described in Algorithm 1, let us use S 0 , S 1 , . .
, S k to denote the solution sets maintained by the algorithm, where S i represents the solution set of size i .
In particular, we have that S i
=
S
i − 1 ∪ { s i } where s i = arg max j ∈P i f
( S ∪ { j } ) and P i denotes the i ’th partition of the data i.e. P i :=
{ ( i − 1) · n k
[Equation]
Theorem 2.
For a random-order arrival stream, if S is the solution output by Algorithm 1 at the end of the stream and σ min > 1 where σ min and σ max denote the smallest and largest singular values of
L S among all S ⊆
[ n ] and | S | ≤ 2 k , then
[Equation]
where L S = V (cid:62) S V S + B (cid:62) S CB S and OPT =
[Equation]
|
[Equation]
=
[Equation]
det
[Equation]
CB
[Equation]
We defer the proofs of the above and the following theorem to Appendix A.
Theorem 3.
For any length- n stream ( v 1 , b 1 ) , . . .
, ( v n , b n ) where ( v t , b t ) ∈ R
d × R d ∀ t ∈ [ n ] , the worst-case update time of Algorithm 1 is O
( T det ( k, d )) where T det ( k, d ) is the time taken to compute f ( S )
= det( V (cid:62) S V + B (cid:62) S CB ) for | S | =
k .
The total time taken is O ( n · T det ( k, d )) and the space used at any time step is O
( k 2 + d 2 ) .
O NLINE MAP I NFERENCE FOR NDPP S
We now consider the online MAP inference problem for NDPPs, which is natural in settings where data is generated on the ﬂy.
In addition to the constraints of the streaming setting (Section 4.1), our online setting requires us to maintain a valid solution at every time step.
In this section, we provide two algorithms for solving this problem.
5. O NLINE L OCAL S EARCH WITH A S TASH
Outline of Algorithm 2 : On a high-level, our algorithm is a generalization of the Online-LS algorithm for DPPs from Bhaskara et al. At each time step t ∈ [ n ] (after t ≥ k ), our algorithm maintains a candidate solution subset of indices S of cardinality k from the data seen so far i.e. S ⊆
[ t ] s.t.
| S |
= k in a streaming fashion.
Additionally, it also maintains two matrices V S , B S ∈ R d ×| S | where the columns of V S are { v i , i ∈ S } and the columns of B S are { b i , i ∈ S } .
Whenever the algorithm sees a new data point ( v t , b t ) , it replaces an existing index from S with the newly arrived index if doing so increases f ( S ) at-least by a factor of α ≥ 1 where α is a parameter to be chosen (we can think of α being 2 for understanding the algorithm).
Instead of just deleting the index replaced from S , it is stored in an auxiliary set T called the “stash" (and also maintains corresponding matrices V T , B T ), which the algorithm then uses to performs a local search over to ﬁnd a locally optimal solution.
We now deﬁne a data-dependent parameter ∆ which we will need to describe the time and space used by Algorithm 2.
Deﬁnition 4.
Let the ﬁrst non-zero value of f ( S ) with | S | =
k that can be achieved in the stream without any swaps be val nz i.e. till S reaches a size k , any index seen is added to S if f ( S ) remains nonzero even after adding it.
Let us deﬁne ∆ :=
OPT k val nz where OPT k = max S ⊆
[ n ] , | S | = k det( V (cid:62) S V S +
B (cid:62) S C B S ) .
Theorem 5.
For any length- n stream ( v 1 , b 1 ) , . . .
, ( v n , b n ) where ( v t , b t ) ∈ R
d × R d ∀ t ∈ [ n ] , the worst case update time of Algorithm 2 is O
( T det ( k, d ) · k log 2 (∆)) where T det ( k, d ) is the time taken to compute f ( S )
= det( V (cid:62) S V + B (cid:62) S CB ) for | S | =
k .
Furthermore, the amortized update time is
O ( T det ( k, d ) · ( k + k log 2 (∆) n )) and the space used at any time step is at most O ( k 2 + d 2 + d log α (∆))
We defer the proof for the above theorem and all following theorems in this section to Appendix B.
5. O NLINE 2- NEIGHBORHOOD L OCAL S EARCH A LGORITHM WITH A S TASH
Before we describe our algorithm, we will deﬁne a neighborhood of any solution, which will be useful for describing the local search part of our algorithm.
S ← S ∪
7: else 8: { i, j } ← arg max a,b ∈ S ( f ( S ∪ { t } \ { a } ) , f ( S ∪ { t − 1 , t } \ { a, b } )) 9: f max ← max a,b ∈ S ( f S ∪ { t } \ { a } , f S ∪ { t − t }
{ a b items replaced then 12:
S ← S ∪ { t − 1 , t } \ { i, j } 13:
T ← T ∪ { i, j } 14: else 15:
S ← S ∪ { t } \ { i } 16:
T ← T ∪ { i } 17: while ∃ a, b ∈ S, c, d ∈ T : f ( S ∪ { c d
{ a b }
> α f ( do 18:
S ← S ∪ { c, d } \ { a, b } 19:
T ← T ∪ { a, b } \ { c, d } 20: return S
Deﬁnition 6 ( N r ( S, T ) ) .
For any natural number r ≥ 1 and any sets S, T we deﬁne the rneighborhood of S with respect to T
[Equation]
[Table] Outline of Algorithm 3 : Similar to Algorithm 2, our new algorithm also maintains two subsets of indices S and T , and corresponding data matrices V S , B S , V T , B T .
Whenever the algorithm sees a new data-point ( v t , b t ) , it checks if the solution quality f ( S ) can be improved by a factor of α by replacing any element in S with the newly seen data-point.
Additionally, it also checks if the solution quality can be made better by including both the points ( v t , b t ) and the data-point ( v t − 1 , b t − 1 ) .
Further, the algorithm tries to improve the solution quality by performing a local search on N 2 ( S, T ) i.e. the neighborhood of the candidate solution S using the stash T by replacing at most two elements of S .
There might be interactions captured by pairs of items which are much stronger than single items in NDPPs (see example 5 from Anari & Vuong (2021)).
A full description of Algorithm 3 can be found in Appendix B.
Theorem 7.
For any length- n stream ( v 1 , b 1 ) , . . .
, ( v n , b n ) where ( v t , b t ) ∈ R
d × R d ∀ t ∈ [ n ] , the worst case update time of Algorithm 3 is O ( T det ( k, d ) · k 2 log 3 (∆)) where T det ( k, d ) is the time taken to compute f ( S ) =
det( V (cid:62) S V + B (cid:62) S CB ) for | S | = k .
The amortized update time is O (cid:16) T det ( k, d ) · (cid:16) k 2 + k 2 log 3 (∆) n (cid:17)(cid:17) and the space used at any time step is at most O ( k 2 + d 2 + d log α (∆)) .
O NLINE L EARNING
In this section, we will ﬁrst formally introduce the online learning problem for NDPPs and then develop an online algorithm for this new setting with theoretical guarantees.
To the best of our knowledge, this is the ﬁrst work to study the online learning setting for NDPPs.
6. O NLINE S ETTING
The online learning problem for NDPPs is formally deﬁned as follows:
Deﬁnition 8 (Online NDPP Learning) .
Given a continuous stream of observed sets { S 1 , . . .
, S t , . . .
, } of items from [ n ] , the online learning problem is to maintain an NDPP kernel
L t =
( V (cid:62) V + B (cid:62) CB ) t t that maximizes the φ t ( V , B , C ) = 1 t t (cid:88)
i = log det (cid:16) V (cid:62) S i V S
i + B (cid:62) S
i CB S
i (cid:17) − log det (cid:16) V (cid:62) V + B (cid:62) CB
+ I (cid:17) − R ( V , B ) (3) where V S i , B S i ∈ R d ×| S
i | denote sub-matrices of V and B which are formed by the columns that correspond to the items in S i , and the regularizer R ( V , B )
=
α (cid:80) ni
=
1 µ i (cid:107) v i (cid:107) 22 + β (cid:80) ni =1 1 µ i (cid:107) b i (cid:107)where µ
i
is the number of occurrences of the item i in all the training data (subsets), α, β > 0 are tunable hyperparameters.
An online learning algorithm for NDPPs needs to:
• Use space that is independent of the length of the stream seen so far.
• Use only a single sequential pass over the stream of subsets { S i ⊆
[ n ] | i = 1 to t } .
• Update the NDPP model upon arrival of the subset S t at time t , then discards it.
• Have a fast update time that is sub-linear in the number of unique items n .
Our online setting is the natural setting to be studied for learning NDPPs in the real-world, as new subsets are generated continuously over time, for instance in an E-commerce application.
In contrast, the state-of-the-art learning algorithm Gartrell et al.
(2021) has the following limitations that make it fundamentally ofﬂine: First, it stores all training data in memory and so uses O ( td (cid:48) ) space where d (cid:48)
=
max i | S
i | is the size of the largest subset in the stream { S 1 , . . .
, S t } .
Second, it takes multiple passes over the data.
Third, subsets are not processed as they arrive sequentially, instead that algorithm requires all data to be stored in memory, and updates a large group of points simultaneously over multiple rounds.
Thus, incurring a large processing time that is not amenable to the online learning setting.
Finally, it also incurs an update time of O ( pnd 2 + ptd (cid:48) 3 ) , which is too much for the online setting.
6. O NLINE A LGORITHM
We present our online learning approach for NDPPs in Algorithm 4.
To update ( V , B , C ) at every time step t , we use the gradient of the following objective function ψ t , which is an approximation of the regularized log-likelihood φ t ( V , B , C ) .
Let us deﬁne Z ( V , B , C ) :
= log det (cid:0) V (cid:62) V + B (cid:62) CB
+ I (cid:1) .
Our approximate objective ψ t ( V , B , C ) = log det (cid:0) V (cid:62) S t V S t + B (cid:62) S t CB S t (cid:1) − Z
( V S t , B S t , C
[Equation]
[Equation]
For every time step t , we only update V S t , B S t , C using the gradient of ψ t i.e. ∇ V St , B St , C ψ t .
[-S t (cid:107) b i (cid:107) 2 . Therefore, ∇ V St R = 
 α V S t , ∇ B St R = 2 β B S t .-] We defer the gradient derivations to Appendix D.
We defer the proof of the following theorem to Appendix D.
Theorem 9.
Algorithm 4 uses O ( d (cid:48) 2 + d 2 ) space † .
Also, the update time for a single subset S t arriving at time t in the stream is O ( d 3 + d (cid:48) 3 ) where d (cid:48) is the size of the largest set in the stream.
For every new subset S t arriving in the stream, Algorithm 4 updates only the columns of V and
B corresponding to the elements in S t , hence, V S t , B S t .
It uses total space O ( nd + d (cid:48) 2 ) , which is independent of the stream length (and is therefore sub-linear in it as well); takes a single pass over the stream; updates the NDPP model only using the subset S t and then discards S t ; has an O ( d 3 + d (cid:48) 3 ) update time.
This is in contrast to the ofﬂine learning algorithm that uses O ( md (cid:48) ) space where m is the length of the stream and d (cid:48) is the size of the largest set ( m (cid:29) d, d (cid:48) , n ).
E XPERIMENTS
Our experiments are designed to evaluate the effectiveness of the proposed online inference and learning algorithms for NDPPs.
Experiments are performed using a standard desktop computer (Quad-Core Intel Core i7, 16 GB RAM) using many real-world datasets.
Details of the datasets can be found in Appendix E.
7. O NLINE I NFERENCE
As a point of comparison, we also use the state-of-the-art ofﬂine greedy algorithm from Gartrell et al.
This algorithm stores all data in memory and makes k passes over the dataset and in each round, picks the data point which gives the maximum marginal gain in solution value.
Online-Greedy replaces a point in the current solution set with the observed point if doing so increases the objective.
See Algorithm 5 in Appendix B for more details.
We ﬁrst learn all the matrices B , C , and V by applying the ofﬂine learning algorithm.
The learning algorithm takes as input a parameter d , which is the embedding size for V , B , C .
We use d = 10 for all datasets other than Instacart, Customer Dashboards, Company Retail where d = 50 is used and
Million Song, where d = 100 is used.
We perform MAP inference by running our algorithms on the learned B , C , and V .
For all the following results, we set α = 1 . 1 and k = 8 .
[Figure]
MAP Inference results for a variety of different datasets are provided in Figure 1.
Surprisingly, the solution quality of our online algorithms compare favorably with the ofﬂine greedy algorithm while using only a single-pass over the data, and a tiny fraction of memory.
In most cases, Online2-neighbor (Algorithm 3) performs better than Online-LSS (Algorithm 2) which in turn performs better than the online greedy algorithm (Algorithm 5).
Strikingly, our online-2-neighbor algorithm performs even better than ofﬂine greedy in many cases.
Furthermore, in some cases the other online algorithms also perform better than the ofﬂine greedy algorithm.
We also perform several experiments comparing the number of determinant computations (as a system-independent proxy for time) and the number of swaps (as a measure of solution consistency) of all our online algorithms.
Results for determinant computations (Figure 3) and swaps (Figure 4) can be found in Appendix F.
We summarize the main ﬁndings here.
The number of determinant computations of Online-LSS is comparable to that of Online Greedy but the number of swaps performed is signiﬁcantly smaller.
Online-2-neighbor is the most time-consuming but superior performing algorithm in terms of solution quality.
We also investigate the performance of our algorithms under the random stream paradigm, where we consider a random permutation of some of the datasets used earlier.
Results for the solution quality (Figure 5), number of determinant computations and swaps (Figure 6) can be found in Appendix F.3.
In this setting, we see that Online-LSS and Online-2-neighbor have nearly identical performance and are always better than Online-Greedy in terms of solution quality and number of swaps.
We study the effect of varying α in Online-LSS (Algorithm 2) for various values of set sizes k in
Appendices F.4 and F.5.
We notice that, in general, the solution quality, number of determinant computations, and the number of swaps increase as α decreases (Figure 7).
We also see that as k increases, the solution value decreases across all values of α (Figure 8).
This is in accordance with our intuition that the probability of larger sets should be smaller.
7. O NLINE L EARNING R ESULTS
Here, we compare our online learning algorithm for NDPPs with the state-of-the-art ofﬂine learning algorithm.
In Figure 2, we compare our online learning algorithm to the ofﬂine algorithm using negative log-likelihood over time.
In all cases, the ofﬂine learning algorithm uses signiﬁcantly more time, usually taking between 6x to 15x more time to converge.
Furthermore, the negative log-likelihood from our online learning algorithm decreases signiﬁcantly faster compared to the ofﬂine.
[Figure]
Strikingly, our online learning algorithm shows comparable performance, while converging signiﬁcantly faster in all cases.
Furthermore, it also uses only a single pass, while using a small fraction of the space. See text for discussion.
C ONCLUSION
In this paper, we formulate and study the streaming and online MAP inference and learning problems for Nonsymmetric Determinantal Point Processes.
To the best of our knowledge, this is the ﬁrst work to study these problems in these practical settings.
We design new algorithms for these problems, prove theoretical guarantees for them in terms of space required, time taken, and solution quality for our algorithms, and empirically show that they perform comparably or (sometimes) even better than state-of-the-art ofﬂine algorithms.
We believe our work opens up completely new avenues for practical application of NDPPs and can lead to deployment of NDPPs in many more real-world settings.
R EPRODUCIBILITY S TATEMENT
For all of our theoretical results, we have provided clear explanations of all the assumptions in the main text (Sections 4, 5, and 6) and have also provided complete proofs in the corresponding sections in the Appendix (Sections A, B and D).
For our experimental results, we have provided all details needed to reproduce our results (like the setup etc) in the main text (Section 7) and have also provided details of the datasets used in our experiments in Appendix E.
A S TREAMING MAP I NFERENCE D ETAILS
Theorem 2.
For a random-order arrival stream, if S is the solution output by Algorithm 1 at the end of the stream and σ min > 1 where σ min and σ max denote the smallest and largest singular values of
L S among all S ⊆
[ n ] and | S | ≤ 2 k , then
[Equation]
where L
[Equation]
We will ﬁrst give a high-level proof sketch for our this theorem.
Proof sketch.
For a random-order arrival stream, the distribution of any set of consecutive n/k elements is the same as the distribution of n/k elements picked uniformly at random (without replacement) from [ n ] .
If the objective function f is submodular, then this algorithm has an approximation guarantee of (1 − 2 /e ) by Mirzasoleiman et al.
But neither det( L S ) nor log det( L S ) are submodular.
Instead, Gartrell et al.
(2021)[Equation 45] showed that log det( L S ) is “close” to submodular when σ min > 1 where this closeness is measured using a parameter known as “submodularity ratio” (Bian et al., 2017).
Using this parameter, we can prove a guarantee for our algorithm.
[Equation]
We will now provide a more complete proof.
Proof.
As described in Algorithm 1, we will use S 0 , S 1 , . .
, S k to denote the solution sets maintained by the algorithm, where S i represents the solution set of size i .
In particular, we have that S i =
S i − 1 ∪ { s i } where s i = arg max j ∈ B i f ( S ∪ { j } ) and B i denotes the i ’th partition i.e. B i :=
{ ( i − 1) · n k + 1 , ( i − 1) · n k + 2 , . .
, i · nk } .
For i ∈ [ k ] , let us use X i :=
[ B i ∩ ( S ∗ \ S i − 1 ) (cid:54) = ∅ ] to denote the event that there is at least one element of the optimal solution which has not already been picked by the algorithm in the batch B
i and λ i :=
| S ∗ \ S i − 1 | .
Then,
[Equation]
Here we use the facts: e x ≥ 1+ x for all x ∈ R , 1 − e − λk is concave as a function of λ , and λ ∈ [0 , k ] .
For any element s ∈ [ n ] and set S ⊆ [ n ] , let us use f
( s | S ) :
= f ( S ∪ { s } ) − f ( S ) to denote the marginal gain in f obtained by adding the element s to the set S .
For any round i ∈ [ k ] , we then have that f ( S i ) − f ( S i − 1 ) =
f ( s i | S i − 1 ) .
Note that
[Equation]
This happens due to the fact that conditioned on X i , every element in S ∗ \ S i − 1 is equally likely to be present in B i and the algorithm picks s i such that f ( s i | S i − 1 ) ≥ f
( s | S
i − 1 ) for all s ∈ B i .
[Equation]
For the last 2 inequalities, we use the fact that f ( S ) =
log det( L S ) is monotone non-decreasing and has a submodularity ratio of γ = (cid:16) 2 log σ max log σ min − 1 (cid:17) − 1 when σ min > 1 (Gartrell et al., 2021)[Eq.
Taking expectation over all random draws of S i − 1 , we get
[Equation]
Combining the above equation with f ( s i | S i − 1 ) =
f ( S i ) − f
( S i − 1 ) , we have
[Equation]
Next we have
[Equation]
Re-organizing the above equation, we obtain
[Equation]
Applying the above equation recursively k times,
[Equation]
where the last step follows from f ( S 0 )
= 0 .
Re-organized the terms again, we have
[Equation]
[Table]
When we substitute γ = (cid:16) 2 log σ max log σ min − 1 (cid:17) − 1 , we get our ﬁnal inequality:
[Equation]
Theorem 3.
For any length- n stream ( v 1 , b 1 ) , . . .
, ( v n , b n ) where ( v t , b t ) ∈ R
d × R d ∀ t ∈ [ n ] , the worst-case update time of Algorithm 1 is O
( T det ( k, d )) where T det ( k, d ) is the time taken to compute f ( S )
= det( V (cid:62) S V + B (cid:62) S CB ) for | S | =
k .
The total time taken is O ( n · T det ( k, d )) and the space used at any time step is O
( k 2 + d 2 ) .
Proof.
For any particular data-point ( v t , b t ) , Algorithm 1 needs to compute f ( S i − 1 ∪ { t } ) , which takes at most T det ( k, d ) time.
All the other comparison and update steps are much faster and so the worst-case update time is O
( T det ( k, d )) .
The space needed to compute det( V (cid:62) S V + B (cid:62) S C B S ) is at most O ( k 2 + d 2 ) where S = S
i − 1 ∪{ t } .
The algorithm also needs to store S i − 1 , s i and f ( S i − 1 ∪{ s i } ) but all of these are dominated by O ( k 2 + d 2 ) space needed to compute the determinant.
(cid:4)
B O NLINE MAP I NFERENCE D ETAILS
Theorem 5.
For any length- n stream ( v 1 , b 1 ) , . . .
, ( v n , b n ) where ( v t , b t ) ∈ R
d × R d ∀ t ∈ [ n ] , the worst case update time of Algorithm 2 is O
( T det ( k, d ) · k log 2 (∆)) where T det ( k, d ) is the time taken to compute f ( S )
= det( V (cid:62) S V + B (cid:62) S CB ) for | S | =
k .
Furthermore, the amortized update time is
O ( T det ( k, d ) · ( k + k log 2 (∆) n )) and the space used at any time step is at most O ( k 2 + d 2 + d log α (∆)) .
Proof.
For every iteration of the while loop in line 4 : It takes at most T det ( k, d ) time for checking the ﬁrst if condition (lines 5-6).
The argmax j ∈ S f ( S ∪ { t } \ { j } step takes at most k · T det ( k, d ) time.
The while loop in line 12 takes time at most | S | · | T | · T det ( k, d ) for every instance of an increase in f ( S ) .
Note that f ( S ) can increase at most log α (∆) times since the value of f ( S ) cannot exceed
OPT k .
Therefore, the update time of Algorithm 2 is at most T det ( k, d ) + k · T det ( k, d ) + log α (∆) · ( | S | · | T | · T det ( k, d )) ≤ T det ( k, d ) · (cid:0) k
+ 1 + k log 2 α (∆) (cid:1) since | S | ≤ k and | T | ≤ log α (∆) .
Notice that the cardinality of T can increase by 1 only when the value of f ( S ) increases at least by a factor of α and so | T | ≤ log α (∆) .
During any time step t , the algorithm needs to store the indices in S, T and the corresponding matrices
V S , B S , V T , B T .
Since | S | ≤ k, | T | ≤ log α (∆) and it takes d words to store every v i and b i , we need at most k +log α (∆)+2 dk +2 d log α (∆) words to store all these in memory.
The space needed to compute det( V (cid:62) S V S + B (cid:62) S CB S ) is at most O ( k 2 + d 2 ) .
We compute all such determinants one after the other in our algorithm.
So the algorithm only needs space for one such computation during it’s run.
Therefore, the space required by Algorithm 2 is O ( k 2 + d 2 + d log α (∆)) .
(cid:4)
Theorem 7.
For any length- n stream ( v 1 , b 1 ) , . . .
, ( v n , b n ) where ( v t , b t ) ∈ R
d × R d ∀ t ∈ [ n ] , the worst case update time of Algorithm 3 is O ( T det ( k, d ) · k 2 log 3 (∆)) where T det ( k, d ) is the time taken to compute f ( S ) =
det( V (cid:62) S V + B (cid:62) S CB ) for | S | = k .
The amortized update time is O (cid:16) [Equation] (cid:17)(cid:17) and the space used at any time step is at most O ( k 2 + d 2 + d log α (∆)) .
Proof.
It takes at most T det ( k, d ) time for lines 5-6 (same as in LSS).
The arg max a,b ∈ S ( f ( S ∪ { t } \ { a } ) , f ( S ∪ { t − 1 , t } \ { a, b } )) step takes at most k 2 · T det ( k, d ) time.
The while loop in line 18 takes time at most | S | 2 · | T | 2 · T det ( k, d ) for every instance of an increase in f ( S ) .
Similar to LSS, f ( S ) can increase at most by a factor of log α (∆) since the value of f ( S ) cannot exceed OPT k .
Therefore, the update time of Algorithm 3 is at most
T det ( k, d )+ k 2 ·T det ( k, d )+log α (∆) · (cid:16)
[Table]
since | S | ≤ k and | T | ≤ log α (∆) .
Although Algorithm 3 executes more number of determinant computations than Algorithm 2, all of them are done sequentially and only the maximum value among all the previously computed values in any speciﬁc iteration needs to be stored in memory.
Therefore, the space needed is (nearly) the same for both the algorithms. (cid:4)
C H ARD INSTANCE FOR O NLINE MAP I NFERENCE OF NDPP S
Outline : We will now give a high-level description of a hard instance for online MAP inference of
NDPPs (this is inspired by (Anari & Vuong, 2021, Example 5)) . Suppose we have a total of 2 d items consisting of pairs of complementary items like modem-router, printer-ink cartridge, pencil-eraser etc. Let us use { 1 , 1 c , 2 , 2 c , . . . , d, d c } to denote them.
Any item i is independent of every item other than it’s complement i c .
Individually, Pr[ { i } ] =
Pr[ { i c } ] = 0 .
And Pr[ { i, i c } ] = x 2 i with x i >for all i ∈
[ d ] .
Also, we have Pr[ { i, j } ] = 0 for any i (cid:54) =
j .
Suppose any of our online algorithms are given the sequence { 1 , 2 , 3 , . . .
, d, r c } where r ∈ [ d ] is some arbitrary item and the algorithm needs to pick 2 items i.e. k = 2 .
Then, OPT > 0 whereas all of our online algorithms (Online LSS, Online 2-neighbor, Online-Greedy) will fail to output a valid solution.
Details : Let 0 < x 1 < x 2 < · · · < x d .
Suppose
[Equation]
C ∈ R 2 d × 2 d is a skew-symmetric (i.e. C = − C (cid:62) ) block diagonal matrix where the blocks are of the form
[Equation]
Suppose we have a total of 2 d items consisting of d pairs of complementary items. We use { 1 , 1 c , 2 , 2 c , . . . , d, d c } to denote them. Let v i
= v i c = 0 ∀ i ∈
[ d ] and b 1 = e 1 , b 1 c = e 2 , . . .
, b d c = e 2 d where e 1 , e 2 , . . .
, e 2 d are the standard unit vectors in R 2 d i.e. B =
I 2 d .
For a pair of complementary items S
= {
i, i c } , f ( S ) = x 2 i .
Without loss of generality, consider
S = { 1 , 1 c } .
Then we can compute B (cid:62) S CB S as follows: [Equation] In this case, we have f ( S ) = x 21 . For any pair of non-complementary items S = { i 1 , i 2 } where the indices are distinct, f ( S ) = 0 .
Without loss of generality, we can consider S = { 1 , 2 } .
Then,
[Equation]
And so, we have that f ( S ) = 0 . D L EARNING D ETAILS Our approximate objective
[Equation] We will now provide a derivation of i.e. ∇ V St , B St , C ψ t . Let us ﬁrst look at the gradient of the ﬁrst term [Equation]
Now, we consider the gradient of Z ( V S t , B S t , C ) , which consists of three parts: ∇ [Equation] , ∇
[Equation]
Z, ∇ C Z . Let X = I − V (cid:62) S t
( I d + V S t V (cid:62) S t ) − 1 V S t .
Note that
Z = log
[Equation]
We refer the reader to (Gartrell et al., 2021, Eqn 19) for a derivation of the above form of Z .
Then,
[Equation]
Since we only have one subset at a time step, R ( V S t , B S
[Equation]
S t
[Equation]
b i
[Equation]
{+Therefore, ∇ V St R = 
+}
α V S t , ∇ B St R = 2 β B S t .
We can then substitute ∇ Z from Equations 6,7,8 in the following equations to get the gradient required for updates ∇ ψ t :
[Equation]
Theorem 9.
Algorithm 4 uses O ( d (cid:48) 2 + d 2 ) space ‡ .
Also, the update time for a single subset S t arriving at time t in the stream is O ( d 3 + d (cid:48) 3 ) where d (cid:48) is the size of the largest set in the stream.
Proof.
To compute ∇ V St Z , it takes space at most O ( d (cid:48)
2 + d 2 ) as it involves matrix multiplications and inversions of matrices of sizes d (cid:48)
× d, d × d, d (cid:48) ×
d (cid:48) .
Similarly for ∇ B St Z, ∇ C Z .
Computing the gradient of the ﬁrst term in Equation 4 requires inversion of a d (cid:48)
× d (cid:48) matrix, which takes at most
O ( d (cid:48) 2 ) space.
And the gradient of the sum of norms term in Equation 4 takes at most O ( d (cid:48)
d ) space to compute.
As described in the proof of the previous lemma, we will need to compute matrix multiplications and inversions of size at most d × d, d (cid:48)
× d (cid:48) , and d (cid:48) × d .
All of these can be done in time O
( d 3 + d (cid:48) 3 ) .
(cid:4)
Theorem 10.
Given a stream of subsets { S 1 , S 2 , . . .
, S m } of length- m , Algorithm 4 learns an NDPP kernel L = V (cid:62) V + B (cid:62) CB of rank-
d using only a single-pass over the stream in O ( md (cid:48)
+ md 3 ) time where d (cid:48)
=
max t ( | S t | ) (cid:28) n .
Note V , B ∈ R d × n , C ∈ R d × d , and d (cid:28) n .
In comparison, the ofﬂine learning algorithm (Gartrell et al., 2021) takes at most T max passes over the entire data ( m subsets), and since all m subsets are stored in memory (ofﬂine, non-streaming), they use all available data at once to update the embedding matrices of the NDPP model.
Notice that log det (cid:0) V (cid:62) S t V S t + B (cid:62) S t CB S t (cid:1) in Eq.
3 is computed for every subset, thus taking O ( md (cid:48) ) time for all m sets in the stream where d (cid:48) is the size of the largest set in the stream.
Furthermore, log det (cid:0) V (cid:62) V + B (cid:62) CB
+ I (cid:1) (2nd term in Eq.
3) takes O ( nd 2 ) time where n (cid:28) m , and this can be computed a constant number of times with respect to m .
Similarly for the regularization term
R ( V , B ) .
E D ATASETS
We use several real-world datasets composed of sets (or baskets) of items from some ground set of items.
• UK Retail: This is an online retail dataset consisting of sets of items all purchased together by users (in a single transaction)
(Chen et al., 2012).
There are 19,762 transactions (sets of items purchased together) that consist of 3,941 items.
Transactions with more thanitems are discarded.
• MovieLens: This dataset contains sets of movies that users watched (Sharma et al., 2019).
There are 29,516 sets consisting of 12,549 movies.
• Amazon Apparel : This dataset consists of 14,970 registries (sets) from the apparel category of the Amazon Baby Registries dataset, which is a public dataset that has been used in prior work on NDPPs (Gartrell et al., 2021; 2019).
These apparel registries are drawn fromitems in the apparel category.
• Amazon 3-category : We also use a dataset composed of the apparel, diaper, and feeding categories from Amazon Baby Registries, which are the most popular categories, giving us 31,218 registries made up of 300 items (Gartrell et al., 2019).
• Instacart:
This dataset represents sets of items purchased by users on Instacart (Instacart, 2017).
Sets with more than 100 items are ignored.
This gives 3.2 million total item-sets from 49,677 unique items.
• Million Song: This is a dataset of song playlists put together by users where every playlist is a set (basket) of songs played by Echo Nest users (McFee et al., 2012).
Playlists with more than 150 songs are discarded.
This gives 968,674 playlists from 371,410 songs.
• Customer Dashboards: This dataset consists of dashboards or baskets of visualizations created by users (Qian et al., 2020).
Each dashboard represents a set of visualizations selected by a user.
There are 63436 dashboards (baskets/sets) consisting of 1206 visualizations.
• Web Logs: This dataset consists of sets of webpages (baskets) that were all visited in the same session.
There are 2.8 million baskets (sets of webpages) drawn from 2 million webpages.
• Company Retail: This dataset contains the set of items viewed (or purchased) by a user in a given session.
Sets (baskets) with more than 100 items are discarded.
This results in 2.
million baskets consisting of 107 , 349 items.
The last two datasets are proprietary company data.
F A DDITIONAL E XPERIMENTAL R ESULTS F. N UMBER OF D ETERMINANT C OMPUTATIONS
We perform several experiments comparing the number of determinant computations (as a systemindependent proxy for time) of all our online algorithms.
We do not compare with ofﬂine greedy here because that algorithm doesn’t explicitly compute all the determinants.
Results comparing the number of determinant computations as a function of the number of data points analyzed for a variety of datasets are provided in Figure 3.
Online-2-neighbor requires the most number of determinant computations but also gives the best results in terms of solution value.
Online-LSS and Online-Greedy use very similar number of determinant computations
[Figure]
D e t .
c o m p u t a t i o n
[Figure]
F. N UMBER OF S WAPS
Results comparing the number of swaps (as a measure of solution consistency) of all our online algorithms can be found in Figure 4.
Online-Greedy has the most number of swaps and therefore the least consistent solution set.
On most datasets, the number of swaps by Online-2-neighbor is very similar to Online-LSS.
[Figure]
-LSS
. F. R ANDOM S TREAMS
We also investigate our algorithms under the random stream paradigm.
For this setting, we use some of the previous real-world datasets, and randomly permute the order in which the data appears in the stream.
We do this 100 times and report the average of solution values in Figure 5 and the average of number of determinant computations and swaps in Figure 6.
We observe that Online-2neighbor and Online-LSS give very similar performance in this regime and they are always better than Online-Greedy.
F. A BLATION STUDY VARYING (cid:15)
To study the effect of (cid:15) in Online-LSS (Algorithm 2), we vary (cid:15) ∈ { 0 . 05 , 0 . 1 , 0 . 3 , 0 . 5 } and analyze the value of the obtained solutions, number of determinant computations, and number of swaps.
We notice that, in general, the solution quality, number of determinant computations, and the number of swaps increase as (cid:15) decreases.
Results are provided in Figure 7.
[Figure]
[Figure] [Figure]
[Figure]
F. A BLATION STUDY VARYING SET SIZE k AND (cid:15)
In this set of experiments on the Amazon-Apparel dataset using Online-LSS, we study the choice of set size k and (cid:15) on the solution quality, number of determinant computations, and number of swaps while ﬁxing all other settings to be same as those used previously in Figure 5.
We can see that as k increases, the solution value decreases across all values of (cid:15) .
This is in accordance with our intuition that the probability of larger sets should be smaller.
In general, the number of determinant computations and swaps increases for increasing k across different values of (cid:15) .
[Figure]
F. O NLINE L EARNING R ESULTS
Figure 9 shows that the heat maps of the kernel matrices learned by our online learning algorithm and the ofﬂine learning algorithm are quite similar.
We use the Amazon Apparel dataset for this set of experiments.
[Figure]
(a) d =
[Figure] [Figure]
(b) d =
[Figure] [Figure]
[Figure]
(c) d =
[Figure]