<<

Exponential Family Graph Matching and Ranking

James Petterson, Tiberio´ Caetano, Julian McAuley, Jin Yu ∗ September 7, 2021

Abstract We present a method for learning max-weight matching predictors in bipartite graphs. The method consists of performing maximum a posteriori estimation in exponential families with sufficient statistics that encode permutations and data features. Although inference is in general hard, we show that for one very rele- vant application–web page ranking–exact inference is efficient. For general model instances, an appropriate sampler is readily available. Contrary to existing max- margin matching models, our approach is statistically consistent and, in addition, experiments with increasing sample sizes indicate superior improvement over such models. We apply the method to graph matching in computer vision as well as to a standard benchmark dataset for learning web page ranking, in which we obtain state-of-the-art results, in particular improving on max-margin variants. The draw- back of this method with respect to max-margin alternatives is its runtime for large graphs, which is comparatively high.

1 Introduction

The Maximum-Weight Bipartite Matching Problem (henceforth ‘matching problem’) is a fundamental problem in combinatorial optimization [26]. This is the problem of finding the ‘heaviest’ perfect match in a weighted . An exact optimal solution can be found in cubic time by standard methods such as the Hungarian algo- rithm. This problem is of practical interest because it can nicely model real-world applica- arXiv:0904.2623v2 [cs.LG] 5 Jun 2009 tions. For example, in computer vision the crucial problem of finding a correspondence between sets of image features is often modeled as a matching problem [2,3]. Ranking can be based on a matching framework [19], as can clustering algorithms [14, 11]. When modeling a problem as one of matching, one central question is the choice of the weight matrix. The problem is that in real applications we typically observe edge feature vectors, not edge weights. Consider a concrete example in computer vision: it

∗NICTA’s Statistical Machine Learning program, Locked Bag 8001, ACT 2601, Australia, and Research School of Information Sciences and Engineering, Australian National University, ACT 0200, Australia. NICTA is funded by the Australian Government’s Backing Australia’s Ability initiative, and the Australian Research Council’s ICT Centre of Excellence program. e-mails: [email protected]

1 is difficult to tell what the ‘similarity score’ is between two image feature points, but it is straightforward to extract feature vectors (e.g. SIFT) associated with those points. In this setting, it is natural to ask whether we could parameterize the features, and use labeled matches in order to estimate the parameters such that, given graphs with ‘similar’ features, their resulting max-weight matches are also ‘similar’. This idea of ‘parameterizing algorithms’ and then optimizing for agreement with data is called structured estimation [31, 33]. [31] and [3] describe max-margin structured estimation formalisms for this prob- lem. Max-margin structured estimators are appealing in that they try to minimize the loss that one really cares about (‘structured losses’, of which the Hamming loss is an example). However structured losses are typically piecewise constant in the parame- ters, which eliminates any hope of using smooth optimization directly. Max-margin estimators instead minimize a surrogate loss which is easier to optimize, namely a con- vex upper bound on the structured loss [33]. In practice the results are often good, but known convex relaxations produce estimators which are statistically inconsistent [22], i.e., the in general fails to obtain the best attainable model in the limit of infinite training data. The inconsistency of multiclass support vector machines is a well-known issue in the literature that has received careful examination recently [8,7]. Motivated by the inconsistency issues of max-margin structured estimators as well as by the well-known benefits of having a full probabilistic model, in this paper we present a maximum a posteriori (MAP) estimator for the matching problem. The ob- served data are the edge feature vectors and the labeled matches provided for training. We then maximize the conditional posterior likelihood of matches given the observed data. We build an exponential family model where the sufficient statistics are such that the mode of the distribution (the prediction) is the solution of a max-weight matching problem. The resulting partition function is ]P-complete to compute exactly. However, we show that for learning to rank applications the model instance is tractable. We then compare the performance of our model instance against a large number of state-of-the- art ranking methods, including DORM [19], an approach that only differs to our model instance by using max-margin instead of a MAP formulation. We show very compet- itive results on standard webpage ranking datasets, and in particular we show that our model performs better than or on par with DORM. For intractable model instances, we show that the problem can be approximately solved using sampling and we provide experiments from the computer vision domain. However the fastest suitable sampler is still quite slow for large models, in which case max-margin matching estimators like those of [3] and [31] are likely to be preferable even in spite of their potential inferior accuracy.

2 2 Background 2.1 Structured Prediction In recent years, great attention has been devoted in Machine Learning to so-called structured predictors, which are predictors of the kind

g : X Y, (1) θ 7→ where X is an arbitrary input space and Y is an arbitrary discrete space, typically expo- nentially large. Y may be, for example, a space of matrices, trees, graphs, sequences, strings, matches, etc. This structured nature of Y is what structured prediction refers to. In the setting of this paper, X is the set of vector-weighted bipartite graphs (i.e., each edge has a feature vector associated to it), and Y is the set of perfect matches induced by X. If N graphs are available, along with corresponding annotated matches (i.e., a set (xn, yn) N ), our task will be to estimate θ such that when we apply the predictor { }n=1 gθ to a new graph it produces a match that is similar to matches of similar graphs from the annotated set. Structured learning or structured estimation refers to the process of estimating a vector θ for predictor g when data (x1, y1),..., (xN , yN ) (X Y)N θ { } ∈ × are available. Structured prediction for input x means computing y = g(x; θ) using the estimated θ. Two generic estimation strategies have been popular in producing structured predic- tors. One is based on max-margin estimators [33, 32, 31], and the other on maximum- likelihood (ML) or MAP estimators in exponential family models [18]. The first approach is a generalization of support vector machines to the case where the set Y is structured. However the resulting estimators are known to be inconsistent in general: in the limit of infinite training data the algorithm fails to recover the best model in the model class [22,7,8]. McAllester recently provided an interesting anal- ysis on this issue, where he proposed new upper bounds whose minimization results in consistent estimators, but no such bounds are convex [22]. The other approach uses ML or MAP estimation in conditional exponential families with ‘structured’ sufficient statistics, such as in probabilistic graphical models, where they are decomposed over the cliques of the graph (in which case they are called Conditional Random Fields, or CRFs [18]). In the case of tractable graphical models, dynamic programming can be used to efficiently perform inference. Other tractable models of this type include mod- els that predict spanning trees and models that predict binary labelings in planar graphs [9, 17]. ML and MAP estimators in exponential families not only amount to solving an unconstrained and convex optimization problem; in addition they are statistically consistent. The main problem with these types of models is that often the partition function is intractable. This has motivated the use of max-margin methods in many scenarios where such intractability arises.

2.2 The Matching Problem Consider a weighted bipartite graph with m nodes in each part, G = (V, E, w), where V is the set of vertices, E is the set of edges and w : E R is a set of real-valued 7→ weights associated to the edges. G can be simply represented by a matrix (wij) where

3 N n n to attain the graph G = (V, E, w). See Figure 1 for an n=1 p(y x ; θ). Therefore, illustration. | Q N p(θ Y,X) p(θ) exp ( φ(xn, yn), θ g(xn; θ)) G G | ∝ h i − x n=1 Y N = exp log p(θ) + ( φ(xn, yn), θ g(xn; θ)) . h i − n=1 ! X (7) i j xij wij = xij, θ h i We impose a Gaussian prior on θ. Instead of maximiz- Figure 1. Left: Illustration of an input vector-weighted bi- ing the posterior we can instead minimize the negative Figure 1: Left: Illustrationpartite graph of anGx inputwithvector-weighted 3 3 edges. Therebipartite is a vector graphxe Glog-posteriorwith 3 `(3Y X; θ), which becomes our loss func- × x | associated to each edge e (for clarity only xij is shown, tion (we suppress× the constant term): edges. There is a vectorcorrespondingxe associated to the solid to eachedge). edge Right:e weighted(for clarity bipar- only xij is shown, N corresponding to thetite solid graph edge).G obtained Right: by weighted evaluating bipartiteGx on the graph learnedG obtained by eval- λ 2 1 n n n vector θ (again only edge ij is shown). `(Y X; θ) = θ + (g(x ; θ) φ(x , y ), θ ) uating Gx on the learned vector θ (again only edge ij is shown). | 2 k k N − h i n=1 X (8) More formally, assume that a training set X,Y = (x1, y1),..., (xN , yN ) is available, for n = where λ is a regularization constant. `(Y X; θ) is a the entry wij is the weight of the edge ij. Consider also a bijection y : 1, 2, . . . , m | {1, 2,...,N} { (where xn := (xn ,} xn . . . , xn )). { convex function} 7→ of θ since the log-partition function 1, 2, . . . , m , i.e., a permutation. Then the matching11 12 problemM(n)M consists(n) of computing { } Here M(n) is the number of nodes in each part of g(θ) is a convex function of θ (Wainwright & Jordan, the vector-weighted bipartite graph xn. We then 2003) and the other terms are clearly convex in θ. parameterize xij as wiy(i) m= f(xiy(i); θ), and the goal is to find the θ which maximizes the posterior 3.3. Feature Parameterization y∗ = argmax wiy(i). (2) likelihood of the observedy data. We will assume f to i=1 The critical observation now is that we equate the so- be bilinear, i.e. f(xiy(i); θ) =Xxiy(i), θ . lution of the matching problem (2) to the prediction 3 This is a well-studied problem; it is tractable and can be solved in O(m )oftime the exponential[16, 26]. family model (5), i.e. i wiy(i) = 3.2. Exponential Family Model φ(x, y), θ . Since our goal is to parameterize fea- This model can be used to match features in images [3], improve classificationh i algo- P rithms [11] and rank webpages [19], to cite a few applications. Thetures typical of settingindividual pairs of nodes (so as to produce We assume an exponential family model, where the the weight of an edge), the most natural model is consists of engineeringprobability the score model matrix is wij according to domain knowledge and sub- sequently solving the combinatorial problem. M φ(x, y) = x , which gives (9) p(y x; θ) = exp ( φ(x, y), θ g(x; θ)), (3) iy(i) i=1 | h i − X w = x , θ , (10) 3 The Modelwhere iy(i) iy(i) i.e. linear in both x and θ (see Figure 1, right). The g(x; θ) = log exp φ(x, y), θ (4) specific form for xij will be discussed in the experi- h i 3.1 Basic Goal y mental section. In light of (10), (2) now clearly means X a prediction of the best match for Gx under the model In this paper we assumeis the that log-partition the weights function,wij are which instead is a convex to be andestimated dif- θ.from training data. More precisely,ferentiable the weight functionwij ofassociatedθ (Wainwright to the & Jordan, edge ij 2003).in a graph will be the result of an appropriateThe composition prediction in ofthis a modelfeature is vectorthe mostxij likely(observed)y, i.e. and4. a Learningparameter the Model vector θ (estimated from training data). Therefore, in practice, our input is a vector- n 4.1. Basics weighted bipartite graphy∗G=x argmax= (V,p( E,y x x; θ))( =x argmax: E φ(x,R y)),, θ which(5) is ‘evaluated’ at a y | y 7→h i particular θ (obtained from previous training) so as to attain the graph GWe= need (V, E,to solve w). θ∗ = argmin `(Y X; θ). `(Y X; θ) is θ | | See Figure1 for an illustration.and ML estimation amounts to maximizing the con- a convex and differentiable function of θ (Wainwright ditional likelihood of a sample X,YX,Y , i.e.= computing(xn, yn) N & Jordan, 2003), therefore gradient descent will find More formally, assume that a training set { } n=1 is available, n n argmaxn θ p(nY X; θ). In practice{ we will} in{ general in- } the global optimum. In order to compute θ`(Y X; θ), where x := (x11, x12 . . . , xM|(n)M(n)). Here M(n) is the number of nodes in each ∇ | troduce a prior on θ and performn MAP estimation: we need to compute θg(θ). It is a standard result part of the vector-weighted bipartite graph x . We then parameterize xofij exponentialas wiy(i) = families∇ that the gradient of the log- f(xiy(i); θ), and the goalθ∗ = is argmax to findp(Y theX;θθ)whichp(θ) = argmaxmaximizesp(θ Y,X the). posterior(6) partition likelihood function of is the expectation of the sufficient θ | θ | statistics: the observed data. We will assume f to be bilinear, i.e., f(xiy(i); θ) = xiy(i), θ . Assuming iid sampling, we have p(Y X; θ) = θg(x; θ) = Ey p(y x;θ)[φ(x, y)]. (11) | ∇ ∼ |

4 3.2 Exponential Family Model We assume an exponential family model, where the probability model is

p(y x; θ) = exp ( φ(x, y), θ g(x; θ)), where (3) | h i −

g(x; θ) = log exp φ(x, y), θ (4) h i y X is the log-partition function, which is a convex and differentiable function of θ [35]. The prediction in this model is the most likely y, i.e.,

y∗ = argmax p(y x; θ) = argmax φ(x, y), θ (5) y | y h i and ML estimation amounts to maximizing the conditional likelihood of the training set X,Y , i.e., computing argmax p(Y X; θ). In practice we will in general introduce { } θ | a prior on θ and perform MAP estimation:

θ∗ = argmax p(Y X; θ)p(θ) = argmax p(θ Y,X). (6) θ | θ |

Assuming iid sampling, we have p(Y X; θ) = N p(yn xn; θ). Therefore, | n=1 | N Q p(θ Y,X) p(θ) exp ( φ(xn, yn), θ g(xn; θ)) | ∝ h i − n=1 Y N = exp log p(θ) + ( φ(xn, yn), θ g(xn; θ)) . (7) h i − n=1 ! X We impose a Gaussian prior on θ. Instead of maximizing the posterior we can in- stead minimize the negative log-posterior `(Y X; θ), which becomes our loss function | (we suppress the constant term):

λ 1 N `(Y X; θ) = θ 2 + (g(xn; θ) φ(xn, yn), θ ) (8) | 2 k k N − h i n=1 X where λ is a regularization constant. `(Y X; θ) is a convex function of θ since the log- | partition function g(θ) is a convex function of θ [35] and the other terms are clearly convex in θ.

3.3 Feature Parameterization The critical observation now is that we equate the solution of the matching problem (2) to the prediction of the exponential family model (5), i.e., w = φ(x, y), θ . i iy(i) h i P

5 Since our goal is to parameterize features of individual pairs of nodes (so as to produce the weight of an edge), the most natural model is

M

φ(x, y) = xiy(i), which gives (9) i=1 X wiy(i) = xiy(i), θ , (10) i.e., linear in both x and θ (see Figure1, right). The specific form for xij will be dis- cussed in the experimental section. In light of (10), (2) now clearly means a prediction of the best match for Gx under the model θ.

4 Learning the Model 4.1 Basics

We need to solve θ∗ = argmin `(Y X; θ). `(Y X; θ) is a convex and differentiable θ | | function of θ [35], therefore gradient descent will find the global optimum. In order to compute `(Y X; θ), we need to compute g(θ). It is a standard result of expo- ∇θ | ∇θ nential families that the gradient of the log-partition function is the expectation of the sufficient statistics:

θg(x; θ) = Ey p(y x;θ)[φ(x, y)]. (11) ∇ ∼ | Therefore in order to perform gradient descent we need to compute the above expecta- tion. Opening the above expression gives

Ey p(y x;θ)[φ(x, y)] = φ(x, y)p(y x; θ) (12) ∼ | | y X 1 M = φ(x, y) exp( x , θ ), (13) Z(x; θ) iy(i) y i=1 X Y which reveals that the partition function Z(x; θ) needs to be computed. The partition function is:

M

Z(x; θ) = exp( xiy(i), θ ) . (14) y i=1 X Y =: Biy(i) Note that the above is the expression for the| permanent{z of} matrix B [23]. The per- manent is similar in definition to the determinant, the difference being that for the latter sgn(y) comes before the product. However, unlike the determinant, which is computable efficiently and exactly by standard linear algebra manipulations [17], com- puting the permanent is a ]P-complete problem [34]. Therefore we have no realistic hope of computing (11) exactly for general problems.

6 4.2 Exact Expectation The exact partition function itself can be efficiently computed for up to about M = 30 using the O(M2M ) algorithm by Ryser [29]. However for arbitrary expectations we are not aware of any exact algorithm which is more efficient than full enumeration (which would constrain tractability to very small graphs). However we will see that even in the case of very small graphs we find a very important application: learning to rank. In our experiments, we successfully apply a tractable instance of our model to benchmark webpage ranking datasets, obtaining very competitive results. For larger graphs, we have alternative options as indicated below.

4.3 Approximate Expectation If we have a situation in which the set of feasible permutations is too large to be fully enumerated efficiently, we need to resort to some approximation for the expectation of the sufficient statistics. The best solution we are aware of is one by Huber and Law, who recently presented an algorithm to approximate the permanent of dense non-negative matrices [13]. The algorithm works by producing exact samples from the distribution of perfect matches on weighted bipartite graphs. This is in precisely the same form as the distribution we have here, p(y x; θ) [13]. We can use this algorithm for applications | that involve larger graphs.1 We generate K samples from the distribution p(y x; θ), and | directly approximate (12) with a Monte Carlo estimate

1 K Ey p(y x;θ)[φ(x, y)] φ(x, yi). (15) ∼ | ≈ K i=1 X In our experiments, we apply this algorithm to an image matching application.

5 Experiments 5.1 Ranking Here we apply the general matching model introduced in previous sections to the task of learning to rank. Ranking is a fundamental problem with applications in diverse areas such as document retrieval, recommender systems, product rating and others. We focus on web page ranking. We are given a set of queries q and, for each query q , a list of D(k) documents { k} k dk, . . . , dk with corresponding ratings rk, . . . , rk (assigned by a human ed- { 1 D(k)} { 1 D(k)} itor), measuring the relevance degree of each document with respect to query qk.A rating or relevance degree is usually a nominal value in the list 1,...,R , where R is { } k typically between 2 and 5. We are also given, for every retrieved document di , a joint k feature vector ψi for that document and the query qk. Training At training time, we model each query qk as a vector-weighted bipartite graph (Figure1) where the nodes on one side correspond to a subset of cardinality M of

1The algorithm is described in the appendix.

7 all D(k) documents retrieved by the query, and the nodes on the other side correspond to all possible ranking positions for these documents (1,...,M). The subset itself is chosen randomly, provided at least one exemplar document of every rating is present. Therefore M must be such that M R. ≥ The process is then repeated in a bootstrap manner: we resample (with replace- ment) from the set of documents dk, . . . , dk , M documents at a time (conditioned { 1 D(k)} on the fact that at least one exemplar of every rating is present, but otherwise randomly). This effectively boosts the number of training examples since each query qk ends up being selected many times, each time with a different subset of M documents from the original set of D(k) documents. In the following we drop the query index k to examine a single query. Here we follow the construction used in [19] to map matching problems to ranking problems (indeed the only difference between our ranking model and that of [19] is that they use a max-margin estimator and we use MAP in an exponential family.) Our edge feature vector xij will be the product of the feature vector ψi associated with document i, and a scalar cj (the choice of which will be explained below) associated with ranking position j

xij = ψicj. (16)

ψ is dataset specific (see details below). From (10) and (16), we have w = c ψ , θ , i ij j h i i and training proceeds as explained in Section4. Testing At test time, we are given a query q and its corresponding list of D associ- ated documents. We then have to solve the prediction problem, i.e.,

D D

y∗ = argmax xiy(i), θ = argmax cy(i) ψi, θ . (17) y y h i i=1 i=1 X X We now notice that if the scalar cj = c(j), where c is a non-increasing function of rank position j, then (17) can be solved simply by sorting the values of ψ , θ in h i i decreasing order.2 In other words, the matching problem becomes one of ranking the values ψ , θ . Inference in our model is therefore very fast (linear time).3 In this h i i setting it makes sense to interpret the quantity ψ , θ as a score of document d for h i i i query q. This leaves open the question of which non-increasing function c should be used. We do not solve this problem in this paper, and instead choose a fixed c. In theory it is possible to optimize over c during learning, but in that case the optimization problem would no longer be convex. We describe the results of our method on LETOR 2.0 [20], a publicly available benchmark data collection for comparing learning to rank algorithms. It is comprised of three data sets: OHSUMED, TD2003 and TD2004. Data sets OHSUMED contains features extracted from query-document pairs in the OHSUMED collection, a subset of MEDLINE, a database of medical publications. It contains 106 queries. For each query there are a number of associated documents, with relevance degrees judged by humans on three levels: definitely, possibly or not

2If r(v) denotes the vector of ranks of entries of vector v, then ha, π(b)i is maximized by the permutation π∗ such that r(a) = r(π∗(b)), a theorem due to Polya, Littlewood, Hardy and Blackwell [30]. 3Sorting the top k items of a list of D items takes O(k log k + D) time [21].

8 TD2003 TD2004 OHSUMED 0.55 0.65 RankMatch (Our Method), M=2 (all) 0.58 RankMatch (Our Method), M=2 DORM RankMatch (Our Method), M=3 DORM RankBoost DORM RankBoost RankSVM RankBoost 0.5 RankSVM 0.56 RankSVM FRank FRank FRank 0.6 ListNet ListNet ListNet AdaRank−MAP AdaRank−MAP AdaRank−MAP 0.45 AdaRank−NDCG AdaRank−NDCG 0.54 AdaRank−NDCG QBRank QBRank QBRank IsoRank IsoRank IsoRank 0.55 SortNet 10 hiddens MAP SortNet 20 hiddens MAP StructRank 0.4 SortNet 10 hiddens P@10 SortNet 20 hiddens P@10 0.52 C−CRF StructRank C−CRF

0.5 0.35 0.5 NDCG NDCG NDCG

0.3 0.48 0.45

0.25 0.46

0.4

0.2 0.44

0.35 0.42 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 k 1 2 3 4 5 6 7 8 9 10 k k Figure 2: Results of NDCG@k for state-of-the-art methods on TD2004 (left), TD2003 (middle) and OHSUMED (right). This is best viewed in color. relevant. Each query-document pair is associated with a 25 dimensional feature vector, ψi. The total number of query-document pairs is 16,140. TD2003 and TD2004 contain features extracted from the topic distillation tasks of TREC 2003 and TREC 2004, with 50 and 75 queries, respectively. Again, for each query there are a number of associated documents, with relevance degrees judged by humans, but in this case only two levels are provided: relevant or not relevant. Each query-document pair is associated with a 44 dimensional feature vector, ψi. The total number of query-document pairs is 49,171 for TD2003 and 74,170 for TD2004. All datasets are already partitioned for 5-fold cross-validation. See [20] for more details. Evaluation Metrics In order to measure the effectiveness of our method we use the normalized discount cumulative gain (NDCG) measure [15] at rank position k, which is defined as

1 k 2r(j) 1 NDCG@k = − , (18) Z log(1 + j) j=1 X where r(j) is the relevance of the jth document in the list, and Z is a normalization constant so that a perfect ranking yields an NDCG score of 1.

External Parameters The regularization constant λ is chosen by 5-fold cross- validation, with the partition provided by the LETOR package. All experiments are repeated 5 times to account for the randomness of the sampling of the training data. We use c(j) = M j on all experiments. − Optimization To optimize (8) we use a standard BFGS Quasi-Newton method with a backtracking line search, as described in [25]. Results For the first experiment training was done on subsets sampled as described above, where for each query q we sampled 0.4 D(k) M subsets, therefore increasing k · ·

9 the number of samples linearly with M. For TD2003 we also trained with all possible subsets (M = 2(all) in the plots). In Figure2 we plot the results of our method (named RankMatch), for M = R, compared to those achieved by a number of state-of-the-art methods which have published NDCG scores in at least two of the datasets: RankBoost [6], RankSVM [10], FRank [5], ListNet [4], AdaRank [36], QBRank [38], IsoRank [37], SortNet [28], StructRank [12] and C-CRF [27]. We also included a plot of our implementation of DORM [19], using precisely the same resampling methodology and data for a fair comparison. RankMatch performs among the best methods on both TD2004 and OHSUMED, while on TD2003 it performs poorly (for low k) or fairly well (for high k). We notice that there are four methods which only report results in two of the three datasets: the two SortNet versions are only reported on TD2003 and TD2004, while StructRank and C-CRF are only reported on TD2004 and OHSUMED. RankMatch compares similarly with SortNet and StructRank on TD2004, similarly to C-CRF and StructRank on OHSUMED and similarly to the two versions of SortNet on TD2003. This exhausts all the comparisons against the methods which have results reported in only two datasets. A fairer comparison could be made if these methods had their performance published for the respective missing dataset. When compared to the methods which report results in all datasets, RankMatch entirely dominates their performance on TD2004 and is second only to IsoRank on OHSUMED (and performing similarly to QBRank). These results should be interpreted cautiously; [24] presents an interesting discus- sion about issues with these datasets. Also, benchmarking of ranking algorithms is still in its infancy and we don’t yet have publicly available code for all of the competitive methods. We expect this situation to change in the near future so that we are able to compare them on a fair and transparent basis. Consistency In a second experiment we trained RankMatch with different training subset sizes, starting with 0.03 D(k) M and going up to 1.0 D(k) M. Once again, · · · · we repeated the experiments with DORM using precisely the same training subsets. The purpose here is to see whether we observe a practical advantage of our method with increasing sample size, since statistical consistency only provides an asymptotic indication. The results are plotted in Figure3-right, where we can see that, as more training data is available, RankMatch improves more saliently than DORM. Runtime The runtime of our algorithm is competitive with that of max-margin for small graphs, such as those that arise from the ranking application. For larger graphs, the use of the sampling algorithm will result in much slower runtimes than those typically obtained in the max-margin framework. This is certainly the benefit of the max-margin matching formulations of [3, 19]: it is much faster for large graphs. Table 1 shows the runtimes for graphs of different sizes, both for exponential family and max-margin matching models.

10 Table 1: Training times (per observation, in seconds) for the exponential model and max-margin. Runtimes for M = 3, 4, 5 are from the ranking experiments, computed by full enumeration; M = 20 corresponds to the image matching experiments, which use the sampler from [13]. A problem of size 20 cannot be practically solved by full enumeration. M exponential model max margin 3 0.0006661 0.0008965 4 0.0011277 0.0016086 5 0.0030187 0.0015328 20 36.0300000 0.9334556

5.2 Image Matching For our computer vision application we used a silhouette image from the Mythologi- cal Creatures 2D database4. We randomly selected 20 points on the silhouette as our interest points and applied shear to the image creating 200 different images. We then randomly selected N pairs of images for training, N for validation and 500 for testing, and trained our model to match the interest points in the pairs. In this setup,

x = ψ ψ 2, (19) ij | i − j| where denotes the elementwise difference and ψ is the Shape Context feature vector |·| i [1] for point i. For a graph of this size computing the exact expectation is not feasible, so we used the sampling method described in Section 4.3. Once again, the regularization constant λ was chosen by cross-validation. Given the fact that the MAP estimator is consistent while the max-margin estimator is not, one is tempted to investigate the practical performance of both estimators as the sample size grows. However, since consistency is only an asymptotic property, and also since the Hamming loss is not the criterion optimized by either estimator, this does not imply a better large-sample performance of MAP in real experiments. In any case, we present results with varying training set sizes in Figure3-left. The max-margin method is that of [3]. After a sufficiently large training set size, our model seems to enjoy a slight advantage.

6 Conclusion and Discussion

We presented a method for learning max-weight bipartite matching predictors, and ap- plied it extensively to well-known webpage ranking datasets, obtaining state-of-the-art results. We also illustrated–with an image matching application–that larger problems can also be solved, albeit slowly, with a recently developed sampler. The method has a number of convenient features. First, it consists of performing maximum-a-posteriori estimation in an exponential family model, which results in a simple unconstrained convex optimization problem solvable by standard algorithms such as BFGS. Second,

4http://tosca.cs.technion.ac.il

11 grows. However, since consistency is only an asymptotic property, and also since the Hamming loss is not the criterion optimized by either estimator, this does not imply a better large-sample performance of MAP in real experiments. In any case, we present results with varying training set sizes in Figure 2. In Figure ?? we can see an example of a match with and without learning. The max-margin method is that of [?]. The methods perform almost identically after a sufficiently large training set size, although the experiment was truncated at 500 training/testing pairs due to computational overload. (The dataset has in total about 20,000 different image pairs.)

0.2 max margin exponential model 0.18 0.2 OHSUMED exponential model 0.57 max margin

0.18 0.565 0.16 0.56 0.16

0.555 RankMatch 0.14 DORM

0.14 error 0.55 error NDCG−1

0.12 0.545

0.54 0.12 0.1 0.535

0.08 0.53 −1 0 0 50 100 150 200 250 300 350 400 450 500 10 10 0.1 number of training pairs sample size (x M D)

Figure 3: Performance with increasing sample size. Left: hamming loss for different 0.08 0 50 100 150 200 numbers250 300 of350 training400 pairs450 in500 the image matching problem (test set size fixed to 500 number ofpairs). training pairs Right: results of NDCG@1 on the ranking dataset OHSUMED. This evidence is in agreement with the fact that our estimator is consistent, while max-margin is not. Figure 2: Learning image matching. Left: hamming loss for different numbers of training pairs (test set size fixed to 500 pairs). Right:the estimator an example is not only statistically match from consistent the but test also set in practice (blue it are seems correct to benefit and red more from increasing sample sizes than its max-margin alternative. Finally, being fully incorrect matches). probabilistic, the model can be easily integrated as a module in a Bayesian framework, for example. The main direction for future research consists of finding more efficient ways to solve large problems. This will most likely arise from appropriate exploitation of data sparsity in the permutation group. retrieval, recommender systems, product rating and others. We are going to focus on web page ranking. References

For this problem we are given a[1] set Belongie, of queries S., & Malik,qk Jand, (2000). for Matching each query with shapeqk contexts., a list ofCBAIVL00D(k). documents11 dk, . . . , dk with corresponding ratings r{k, .} . . , rk (assigned by a human editor), measur- { 1 D(k)} [2] Belongie, S., Malik,{ 1 J., & Puzicha,D(k)} J. (2002). Shape matching and object recogni- ing the relevance degree of each documenttion using shape with contexts. respectIEEE to Trans. query on PAMIqk., 24 A, rating 509–521. or1 relevance degree is usually a nominal value in the[3] list Caetano,1,...,R T. S., Cheng,, where L., Le,R is Q. typically V., & Smola, between A. J. (2009). 2 and Learning 5. We graph are also Figure 3:Figure Left: 2: match Learning without image learning matching:{ k } (6/20 hamming correctk loss matches). for different Right: number match of training with pairs learning (test set (14/20 given, for every retrieved documentmatching.di ,IEEE a joint Trans. feature on PAMI vector, 31, 1048–1058.ψi for1,2 that,4, 10, document 11 and the query correct matches)sizeqk fixed. to 500 pairs). [4] Cao, Z., Qin, T., Liu, T.-Y., Tsai, M.-F., & Li, H. (2007). Learning to rank: from pairwise approach to listwise approach. ICML 10 Training At training time, we model each query qk as a vector-weighted bipartite graph (Figure 1) where the nodes on one side[5] correspondTsai, M., Liu, T., to Qin,a T.,subset Chen, H.,of & cardinality Ma, W. (2007).M Frank:of all A rankingD(k) methoddocuments with fidelity loss. SIGIR. 10 5.2retrieved Ranking by the query, and the nodes on the other side correspond to all possible ranking positions for and trainingthese of documentsθ proceeds (1,...,M as). explained The[6] Freund, subset Y., itself Iyer, R., inis Schapire, chosen Section R. randomly, E., & Singer, 4. provided Y. (2003). An at efficient least one boosting exemplar document of every rating is present.algorithm Therefore for combiningM must preferences. be suchJ. Mach. that Learn.M Res.R, 4., 933–969. 10 ≥ [7] Liu, Y. & Shen, X. (2006) Multicategory ψ-learning. JASA, 101, 500–509.2,3 Testing AtHere testThe we process time, apply is then we the repeated are general given in a bootstrap matching a query manner: modelq weand resample introduced its (with corresponding replacement) in previous from the sections list set of D to theassociated task of learning documents. k k [8] Liu, Y. & Shen, X. (2005) Multicategory ψ-learning and support vector machine: We then haveto rankof documents to. solve Rankingd1 the, . . . ,is d predictionD a(k) fundamental, M documents problem, at problem a time (conditioned i.e. with applications on the fact that at in least diverse one areas such as document { } Computational tools. J. Computational and Graphical Statistics, 14, 219–236.2,3 retrieval,exemplar ofrecommender every rating is present, systems, but otherwise product randomly). rating This and effectively others. boosts Wethe number are going of to focus on web page training examples since each query qk ends up being selected manyD times, each time with a different ranking.subset of M documents from the original set of D(k) documents. y∗ = argmax12 xiy(i), θ (19a) In the following we drop the query index k since wey examine a single query. Here we follow For this problem we are given a set of queries iq=1k and, for each query qk, a list of D(k) documents kthe constructionk used in [21] to map matching problems to{X rankingk } problems.k (Indeed the only d1difference, . . . , d betweenD(k) ourwith ranking corresponding model and that of ratings [21] is thatr they1D, . use . . a, rmax-marginD(k) (assigned estimator and by a human editor), measur- { we use MAP in an} exponential family.) Our edge feature vector{ xij will be the} product of feature ing the relevance degree of each document with respect to query qk. A rating or relevance degree is vector ψi associated with document i, and a= scalar argmaxcj (the choice of whichcy(i will) ψ bei explained, θ . below) (19b) usuallyassociated a nominal with ranking value position inj the list 1,...,Ry , where Rhis typicallyi between 2 and 5. We are also { k }i=1 k given, for every retrieved document di , a jointX feature vector ψi for that document and the query x = ψ c . (17) qk. ij i j We now notice that if the scalar cj = c(j), where c is a non-increasing function of rank position ψ is dataset specific (details below). 3 j, then (19b)Trainingi canAt be training solved time, simply we modelby sorting each query the valuesqk as a of vector-weightedψi, θ in decreasing bipartite graph order. (FigureIn other We therefore have from (10) and (17) that a subset h i M D(k) words, the1) matching where the nodesproblem on one becomes side correspond one of ranking to theof values cardinalityψi, θ .of Inference all indocuments our model is thereforeretrieved very fast by (linear the query, time). and the4 In nodes this on setting the other it sidemakes correspond sense to toh all interpret possiblei the ranking quantity positionsψ for, θ as a w = c ψ , θ , (18) i score of documentthese documentsd for (1 query,...,Mq).. This Theij subset leavesj h i itselfi open is chosenthe question randomly, of which provided non-increasing at least one exemplarh functioni c document ofi every rating is present. Therefore M must be such that M R. should be used.and training We of doθ proceeds not assolve explained this in Section problem 4. in this paper, and instead≥ choose a fixed c. In theory it is possibleThe toprocess optimize is then over repeatedc during in a bootstrap learning, manner: but in thatwe resample case the (with optimization replacement) problem from the would set no k k 6 longer beof convex. documents Wed describe1 , . . . , dD the(k) , resultsM documents of our at method a time (conditionedon LETOR on 2.0 the [22], fact thata publicly at least oneavailable benchmark data collection{ for comparing} learning to rank algorithms. It is comprised of three data sets: OHSUMED, TD2003 and TD2004. 6 Data sets OHSUMED contains features extracted from query-document pairs in the OHSUMED collection, a subset of MEDLINE, a database of medical publications. It contains 106 queries. For each query there are a number of associated documents, with relevance degrees judged by humans on three levels: definitely, possibly or not relevant. Each query-document pair has a 25 dimensional feature vector associated (our ψi). The total number of query-document pairs is 16,140. TD2003 and TD2004 contain features extracted from the topic distillation tasks of TREC 2003 and TREC 2004, with 50 and 75 queries respectively. Again, for each query there are a number of associated documents, with relevance degrees judged by humans, but in this case only two levels are provided: relevant or not relevant. Each query-document pair has a 44 dimensional feature vector associated (our ψi). The total number of query-document pairs is 49,171 for TD2003 and 74,170 for TD2004. All datasets are already partitioned for 5-fold cross-validation. See [22] for more detail. Evaluation Metrics In order to measure the effectiveness of our method we use the normalized discount cumulative gain (NDCG) measure [16] at rank position k, which is defined as

1 k 2r(j) 1 NDCG@k = − , (20) Z log(1 + j) j=1 X where r(j) is the relevance of the jth document in the list, and Z is a normalization constant so that a perfect ranking yields an NDCG score of 1.

3If r(v) denotes the vector of ranks of entries of vector v, then a, π(b) is maximized by the permutation h i π∗ such that r(a) = r(π∗(b)), a theorem due to Polya, Littlewood, Hardy and Blackwell [31]. 4Sorting the top k items of a list of D items takes O(k log k + D) time with a quicksort-style agorithm.

7 [9] Globerson, A., & Jaakkola, T. (2007). Approximate inference using planar graph decomposition. NIPS.3 [10] Herbrich, A., Graepel, T., & Obermayer, K. (2000). Large margin rank bound- aries for ordinal regression. In Advances in Large Margin Classifiers. 10

[11] Huang, B., & Jebara, T. (2007). Loopy belief propagation for bipartite maximum weight b-matching. AISTATS.1,4 [12] Huang, J. C., & Frey, B. J. (2008). Structured ranking learning using cumulative distribution networks. In NIPS. 10 [13] Huber, M., & Law, J. (2008). Fast approximation of the permanent for very dense problems. SODA.7, 11, 14, 15 [14] Jebara, T., & Shchogolev, V. (2006). B-matching for spectral clustering. ECML. 1 [15] Jarvelin, K., & Kekalainen, J. (2002). Cumulated gain-based evaluation of ir techniques. ACM Transactions on Information Systems, 20, 2002.9 [16] Jonker, R., & Volgenant, A. (1987). A shortest augmenting path algorithm for dense and sparse linear assignment problems. Computing, 38, 325–340.4 [17] Koo, T., Globerson, A., Carreras, X., & Collins, M. (2007). Structured prediction models via the matrix- theorem. EMNLP.3,6

[18] Lafferty, J. D., McCallum, A., & Pereira, F. (2001). Conditional random fields: Probabilistic modeling for segmenting and labeling sequence data. ICML.3 [19] Le, Q., & Smola, A. (2007). Direct optimization of ranking measures. http://arxiv.org/abs/0704.3359.1,2,4,8, 10

[20] Liu, T.-Y., Xu, J., Qin, T., Xiong, W., & Li, H. (2007). Letor: Benchmark dataset for research on learning to rank for information retrieval. LR4IR.8,9 [21] Martinez, C. (2004). Partial quicksort. SIAM.8 [22] McAllester, D. (2007). Generalization bounds and consistency for structured la- beling. Predicting Structured Data.2,3 [23] Minc, H. (1978). Permanents. Addison-Wesley.6 [24] Minka, T., & Robertson, S. (2008). Selection bias in the letor datasets. LR4IR. 10

[25] Nocedal, J., & Wright, S. J. (1999). Numerical optimization. Springer Series in Operations Research. Springer.9 [26] Papadimitriou, C. H., & Steiglitz, K. (1982). Combinatorial optimization: Algo- rithms and complexity. New Jersey: Prentice-Hall.1,4

13 [27] Qin, T., Liu, T.-Y., Zhang, X.-D., Wang, D.-S., & Li, H. (2009). Global ranking using continuous conditional random fields. NIPS. 10 [28] Rigutini, L., Papini, T., Maggini, M., & Scarselli, F. (2008). Sortnet: Learning to rank by a neural-based sorting algorithm. LR4IR. 10 [29] Ryser, H. J. (1963). Combinatorial mathematics. The Carus Mathematical Mono- graphs, No. 14, Mathematical Association of America.7 [30] Sherman, S. (1951). On a Theorem of Hardy, Littlewood, Polya, and Blackwell. Proceedings of the National Academy of Sciences, 37, 826–831.8 [31] Taskar, B. (2004). Learning structured prediction models: a large-margin ap- proach. Doctoral dissertation, Stanford University.2,3 [32] Taskar, B., Guestrin, C., & Koller, D. (2004). Max-margin Markov networks. NIPS 3 [33] Tsochantaridis, I., Joachims, T., Hofmann, T., & Altun, Y. (2005). Large margin methods for structured and interdependent output variables. JMLR, 6, 1453–1484. 2,3 [34] Valiant, L. G. (1979). The complexity of computing the permanent. Theor. Com- put. Sci. (pp. 189–201).6 [35] Wainwright, M. J., & Jordan, M. I. (2003). Graphical models, exponential fam- ilies, and variational inference (Technical Report 649). UC Berkeley, Department of Statistics.5,6 [36] Xu, J., & Li, H. (2007). Adarank: a boosting algorithm for information retrieval. SIGIR. 10 [37] Zheng, Z., Zha, H., & Sun, G. (2008a). Query-level learning to rank using isotonic regression. LR4IR. 10 [38] Zheng, Z., Zha, H., Zhang, T., Chapelle, O., Chen, K., & Sun, G. (2008b). A general boosting method and its application to learning ranking functions for web search. NIPS. 10

Appendix A

For completeness we include a description of the sampling algorithm presented in [13]. The algorithm is an accept-reject algorithm. The core idea of such an algorithm is very simple: assume we need to sample from a distribution p in a given domain M, but that such a task is intractable. Instead, we sample from a distribution q in a superset N of the original domain (in which sampling is easier), whose restriction to the original domain coincides with the original distribution: q = p. We then only ‘accept’ those |N samples that effectively fall within the original domain M. Clearly, the efficiency of such a procedure will be dictated by (i) how efficient it is to sample from q in N and

14 (ii) how much mass of q is in M. Roughly speaking, the algorithm presented in [13] manages to sample perfect matches of bipartite graphs such that both conditions (i) and (ii) are favorable. The reasoning goes as follows: the problem consists of generating variates y ∈ Y (y is a match) with the property that p(y) = w(y)/Z, where w(y) is the non- negative score of match y and Z = y w(y) is the partition function, which in our case is a permanent as discussed in Section 4.1. We first partition the space Y into P Y1,..., YI , where Yi = y : y(1) = i . Each part has its own partition function { } Y Zi = y Yi w(y). Next, a suitable upper bound U( i) Zi on the partition function ∈ ≥ is constructed such that the following two properties hold:5 P M (P1) U(Y ) U(Y). i ≤ i=1 X (P2) If Y = 1, then U(Y ) = Z = w(y). | i| i i That is, (i) the upper bound is super-additive in the elements of the partition and (ii) if Yi has a single match, the upper bound equals the partition function, which in this case is just the score of that match. Now the algorithm: consider the I where p(I = i) = U(Yi)/U(Y). By (P1), M p(i) 1, so assume p(I = 0) = 1 M p(i). Now, draw a variate i=1 ≤ − i=1 from this distribution, and if I = i = 0, reject and restart, otherwise recursively sample 6 P P in Yi. This algorithm either stops and restarts or it reaches Yfinal which consists of a match, i.e., Y = 1. This match is then a legitimate sample from p(y). The reason | final| this is the case is because of (P2), as shown below. Assuming the algorithm finishes after k samples, the probability of the match is the telescopic product

U(YI(1)) U(YI(2)) U(YI(k)) (P 2) w(y) ... = , (20) U(Y) U(YI(1)) U(YI(k 1)) U(Y) − and since the probability of acceptance is Z/U(Y), we have

w(y)/U(Y) w(y) p(y) = = , (21) Z/U(Y) Z which is indeed the distribution from which we want to sample. For pseudocode and a rigorous presentation of the algorithm, see [13].

5See [13] for details. 6Due to the self-reducibility of permutations, when we fix y(1) = i, what remains is also a set of permutations. We then sample y(2), y(3) . . . y(M).

15