## Learning From Ordered Sets and Applications in Collaborative Ranking

Truyen Tran †‡ , Dinh Phung , Svetha Venkatesh † † † Pattern Recognition and Data Analytics, Deakin University, Australia ‡ Department of Computing, Curtin University, Australia { truyen.tran,dinh.phung,svetha.venkatesh } @deakin.edu.au

## Abstract

Ranking over sets arise when users choose between groups of items. For example, a group may be of those movies deemed 5 stars to them, or a customized tour package. It turns out, to model this data type properly, we need to investigate the general combinatorics problem of partitioning a set and ordering the subsets. Here we construct a probabilistic log-linear model over a set of ordered subsets. Inference in this combinatorial space is highly challenging: The space size approaches ( N / ! 2)6 93145 . N +1 as N approaches infinity. We propose a split-and-merge Metropolis-Hastings procedure that can explore the statespace efficiently. For discovering hidden aspects in the data, we enrich the model with latent binary variables so that the posteriors can be efficiently evaluated. Finally, we evaluate the proposed model on large-scale collaborative filtering tasks and demonstrate that it is competitive against state-of-the-art methods.

## 1 Introduction

Rank data has recently generated a considerable interest within the machine learning community, as evidenced in ranking labels [7, 21] and ranking data instances [5, 23]. The problem is often cast as generating a list of objects (e.g., labels, documents) which are arranged in decreasing order of relevance with respect to some query (e.g., input features, keywords). The treatment effectively ignores the grouping property of compatible objects [22]. This phenomenon occurs when some objects are likely to be grouped with some others in certain ways. For example, a grocery basket is likely to contain a variety of goods which are complementary for household needs and at the same time, satisfy weekly budget constraints. Likewise, a set of movies are likely to given the same quality rating according to a particular user. In these situations, it is better to consider ranking groups instead of individual objects. It is beneficial not only when we need to recommend a subset (as in the case of grocery shopping), but also when we just want to produce a ranked list (as in the case of watching movies) because we would better exploit the compatibility among grouped items.

This poses a question of how to group individual objects into subsets given a list of all possible objects. Unlike the situation when the subsets are pre-defined and fixed (e.g., sport teams in a particular season), here we need to explore the space of set partitioning and ordering simultaneously. In the grocery example we need to partition the stocks in the store into baskets and then rank them with respect to their utilities; and in the movie rating example we group

movies in the same quality-package and then rank these groups according to their given ratings. The situation is somewhat related to multilabel learning, where our goal is to produce a subset of labels out of many for a given input, but it is inherently more complicated: not only we need to produce all subsets, but also to rank them.

This paper introduces a probabilistic model for this type of situations, i.e., we want to learn the statistical patterns from which a set of objects is partitioned and ordered, and to compute the probability of any scheme of partitioning and ordering. In particular, the model imposes a log-linear distribution over the joint events of partitioning and ordering. It turns out, however, that the state-space is prohibitively large: If the space of complete ranking has the complexity of N ! for N objects, then the space of partitioning a set and ordering approaches ( N / ! 2)6 93145 . N +1 in size as N approaches infinity [11, pp. 396-397]. Clearly, the latter grows much faster than the former by an exponential factor of 6 93145 . N +1 . To manage the exploration of this space, we design a split-and-merge Metropolis-Hastings procedure which iteratively visits all possible ways of partitioning and ordering. The procedure randomly alternates between the split move, where a subset is split into two consecutive parts, and the merge move, where two consecutive subsets are merged. The proposed model is termed Ordered Sets Model (OSM).

To discover hidden aspects in ordered sets (e.g., latent aspects that capture the taste of a user in his or her movie genre), we further introduce binary latent variables in a fashion similar to that of restricted Boltzmann machines (RBMs) [18]. The posteriors of hidden units given the visible rank data can be used as a vectorial representation of the data - this can be handy in tasks such as computing distance measures or visualisation. This results in a new model called Latent OSM.

Finally, we show how the proposed Latent OSM can be applied for collaborative filtering, e.g., when we need to take seen grouped item ratings as input and produce a ranked list of unseen item for each user. We then demonstrate and evaluate our model on large-scale public datasets. The experiments show that our approach is competitive against several state-of-the-art methods.

The rest of the paper is organised as follows. Section 2 presents the log-linear model over ordered sets (OSM) together with our main contribution - the split-and-merge procedure. Section 3 introduces Latent OSM, which extends the OSM to incorporate latent variables in the form of a set of binary factors. An application of the proposed Latent OSM for collaborative filtering is described in Section 4. Related work is reviewed in the next section, followed by the conclusions.

## 2 Ordered Set Log-linear Models

## 2.1 General Description

We first present an intuitive description of the problem and our solutions in modelling, learning and inference. Fig. 1(a) depicts the problem of grouping items into subsets (represented by a box of circles) and ordering these subsets (represented by arrows which indicate the ordering directions). This looks like a high-order Markov chain in a standard setting, and thus it is tempting to impose a chain-based distribution. However, the difficulty is that the partitioning of set into subsets is also random, and thus a simple treatment is not applicable. Recently, Truyen et al (2011) describe a model in this direction with a careful treatment of the partitioning effect. However, their model does not allow fast inference since we need to take care of the high-order properties.

Figure 1: (a) Ordered Set Model; (b) the split operator; and (c) the merge operator. The figure in (c) represents the result of a merge of the middle two subsets in (b). Conversely, the (b) figure can be considered as result of a splitting the middle subset of the (c) figure. Arrows represent the preference orders, not the causality or conditioning.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1408.0043v1-figure-811a5f62-bd22-4a32-8cea-8cecf5640041.jpg)

Our solution is as follows. To capture the grouping and relative ordering, we impose on each group a subset potential function capturing the relations among compatible elements, and on each pair of subsets a ordering potential function. The distribution over the space of grouping and ordering is defined using a log-linear model, where the product of all potentials accounts for the unnormalised probability. This log-linear parameterization allows flexible inference in the combinatorial space of all possible groupings and orderings.

In this paper inference is carried out in a MCMC manner. At each step, we randomly choose a split or a merge operator. The split operator takes a subset at random (e.g., Fig. 1(c)) and uniformly splits it into two smaller subsets. The order between these two smaller subset is also random, but their relative positions with respect to other subsets remain unchanged (e.g., Fig. 1(b)). The merge operator is the reverse (e.g., converting Fig. 1(b) into Fig. 1(c)). With an appropriate acceptance probability, this procedure is guaranteed to explore the entire combinatorial space.

Armed with this sampling procedure, learning can be carried out using stochastic gradient techniques [25].

## 2.2 Problem Description

Given two objects x i and x j , we use the notation x i glyph[follows] x j to denote the expression of x i is ranked higher than x j , and x i ∼ x j to denote the between the two belongs to the same group. Furthermore, we use the notation of X = { x , x 1 2 , . . . , x N } as a collection of N objects. Assume that X is partitioned into T subsets { X t } T t =1 . However, unlike usual notion of partitioning of a set, we further posit an order among these subsets in which members of each subset presumably share the same rank. Therefore, our partitioning process is order-sensitive instead of being exchangeable at the partition level. Specifically, we use the indices 1 2 , , ..., T to denote the decreasing order in the rank of subsets. These notations allow us to write the collection of objects X = { x , . . . , x 1 N } as a union of T ordered subsets: 1

$$X = \ X _ { 1 } \cup X _ { 2 } \dots \cup X _ { T }$$

glyph[negationslash]

where { X t } T t =1 are non-empty subsets of objects so that x i ∼ x , j ∀ x , x i j ∈ X i t = j, ∀ t .

1 Alternatively, we could have proceeded from the permutation perspective to indicate the ordering of the subsets, but we simplify the notation here for clarity.

As a special case when T = N , we obtain an exhaustive ordering among objects wherein each subset has exactly one element and there is no grouping among objects. This special case is equivalent with a complete ranking scenario. To illustrate the complexity of the problem, let us characterise the state-space, or more precisely, the number of all possible ways of partitioning and ordering governed by the above definition. Recall that there are s ( N,T ) ways to divide a set of N objects into T partitions, where s ( N,T ) denotes the Stirling numbers of second kind [20, p. 105]. Therefore, for each pair ( N,T ), there are s ( N,T ) T ! ways to perform the partitioning with ordering. Considering all the possible values of T give us the size of our model state-space:

$$\sum _ { T = 1 } ^ { N } s \left ( N, T \right ) T! \ = \ F u b { i } { \left ( N \right ) } = \sum _ { k = 1 } ^ { \infty } \frac { k ^ { N } } { 2 ^ { k + 1 } }$$

which is also known in combinatorics as the Fubini's number [11, pp. 396-397]. This number grows super-exponentially and it is known that it approaches N / ! (2 (log 2) N +1 ) as N →∞ [11, pp. 396-397]. Taking the logarithm, we get log N ! -( N +1)loglog 2 -log 2. As log log 2 &lt; 0, this clearly grows faster than log N !, which is the log of the size of the standard complete permutations.

## 2.3 Model Specification

Denote by Φ( X t ) ∈ R + a positive potential function over a single subset 2 X t and by Ψ( X t glyph[follows] X t ′ ) ∈ R + a potential function over a ordered pair of subsets ( X , X t t ′ ) where t &lt; t ′ . Our intention is to use Φ( X t ) to encode the compatibility among all member of X t , and Ψ( X t glyph[follows] X t ′ ) to encode the ordering properties between X t and X t ′ . We then impose a distribution over the collection of objects as:

$$P ( X ) \ = \ \frac { 1 } { Z } \Omega ( X ), \quad \text{ where } \Omega ( X ) = \prod _ { t } \Phi ( X _ { t } ) \prod _ { t ^ { \prime } > t } \Psi ( X _ { t } \succ X _ { t ^ { \prime } } ) \quad \quad ( 3 )$$

and Z = ∑ X Ω( X ) is the partition function. We further posit the following factorisation for the potential functions:

$$\Phi ( X _ { t } ) \ = \ \prod _ { i, j \in X _ { t } | j > i } \varphi ( x _ { i } \sim x _ { j } ) ; \quad \ \Psi ( X _ { t } \succ X _ { t ^ { \prime } } ) = \prod _ { i \in X _ { t } \ j \in X _ { t ^ { \prime } } } \psi ( x _ { i } \succ x _ { j } ) \quad ( 4 )$$

where ϕ x ( i ∼ x j ) ∈ R + captures the effect of grouping , and ψ x ( i glyph[follows] x j ) ∈ R + captures the relative ordering between objects x i and x j . Hereafter, we shall refer to this proposed model as the Ordered Set Model (OSM).

## 2.4 Split-and-Merge MCMC Inference

In order to evaluate P X ( ) we need to sum over all possible configurations of X which is in the complexity of the Fubini( N ) over the set of N objects (cf. Section 2.2, Eq. 2). We develop a Metropolis-Hastings (MH) procedure for sampling P X ( ). Recall that the MH sampling involves

2 In this paper, we do not consider the case of empty sets, but it can be assumed that φ ( ∅ ) = 1.

a proposal distribution Q that allows drawing a new sample X ′ from the current state X with probability Q X X ( ′ | ). The move is then accepted with probability

$$P _ { \text{accept} } = \min \left \{ 1, l \times p \right \}, \quad \text{ where } l = \frac { P ( X ^ { \prime } ) } { P ( X ) } = \frac { \Omega ( X ^ { \prime } ) } { \Omega ( X ) } \text{ and } p = \frac { Q ( X | X ^ { \prime } ) } { Q ( X ^ { \prime } | X ) } \text{ \quad \ } ( 5 )$$

To evaluate the likelihood ratio l we use the model specification defined in Eq (3). We then need to compute the proposal probability ratio p . The key intuition is to design a random local move from X to X ′ that makes a relatively small change to the current partitioning and ordering. If the change is large, then the rejection rate is high, thus leading to high cost (typically the computational cost increases with the step size of the local moves). On the other hand, if the change is small, then the random walks will explore the state-space too slowly.

We propose two operators to enable the proposal move: the split operator takes a nonsingleton subset X t and randomly splits it into two sub-subsets { X ,X 1 t 2 t } , where X 2 t is inserted right next to X 1 t ; and the merge operator takes two consecutive subsets { X , X t t +1 } and merges them. This dual procedure will guarantee exploration of all possible configurations of partitioning and ordering, given enough time (See Figure 1 for an illustration).

## 2.4.1 Split Operator

Assume that among the T subsets, there are T split non-singleton subsets from which we randomly select one subset to split, and let this be X t . Since we want the resulting sub-subsets to be non-empty, we first randomly draw two distinct objects from X t and place them into the two subsets. Then, for each remaining object, there is an equal chance going to either X 1 t or X 2 t . Let N t = | X t | , the probability of this drawing is ( N N t ( t -1)2 N t -2 ) -1 . Since the probability that these two sub-subsets will be merged back is T -1 , the proposal probability ratio p split can be computed as in Eq (6). Since our potential functions depend only on the relative orders between subsets and between objects in the same set, the likelihood ratio l split due to the split operator does not depend on other subsets, it can be given as in Eq (7). This is because the members of X 1 t are now ranked higher than those of X 2 t while they are of the same rank previously.

$$p _ { s p l i t } = \frac { T _ { s p l i t } N _ { t } ( N _ { t } - 1 ) 2 ^ { N _ { t } - 2 } } { T } \quad \ ( 6 ) \quad \ l _ { s p l i t } = \prod _ { x _ { i } \in X _ { i } ^ { 1 } } \prod _ { x _ { j } \in X _ { i } ^ { 2 } } \frac { \psi ( x _ { i } \succ x _ { j } ) } { \varphi ( x _ { i } \sim x _ { j } ) } \quad \ ( 7 )$$

## 2.4.2 Merge Operator

For T subsets, the probability of merging two consecutive ones will be ( T -1) -1 since there are T -1 pairs, and each pair can be merged in exactly one way. Let T merge be the number of non-singleton subsets after the merge, and let N t and N t +1 be the sizes of the two subsets X t and X t +1 , respectively. Let N ∗ t = N t + N t +1 , the probability of recovering the state before the merge (by applying the split operator) is ( T merge N ∗ t ( N ∗ t -1)2 N ∗ t -2 ) -1 . Consequently, the proposal probability ratio p merge can be given as in Eq (8), and the likelihood ratio l merge is clearly the inverse of the split case as shown in Eq (9).

$$p _ { \text{merge} } = \frac { T - 1 } { T _ { \text{merge} } N _ { t } ^ { * } ( N _ { t } ^ { * } - 1 ) 2 ^ { N _ { t } ^ { * } - 2 } } \quad ( 8 ) \quad l _ { \text{merge} } = \prod _ { x _ { i } \in X _ { t } } \prod _ { x _ { j } \in X _ { t + 1 } } \frac { \varphi ( x _ { i } \sim x _ { j } ) } { \psi ( x _ { i } \succ x _ { j } ) } \quad ( 9 )$$

Algorithm 1 Pseudo-code of the split-and-merge Metropolis-Hastings for OSM.

- 1. Given an initial state X .
- 2. Repeat until convergence
- 2a. Draw a random number η ∈ [0 , 1].
- 2b. If η &lt; 0 5 . { Split }
- i. Randomly choose a non-singleton subset.
- ii. Split into two sub-subsets and insert one sub-subset right after the another.
- iii. Evaluate the acceptance probability P accept using Eqs.(6,7,5).
- iv. Accept the move with probability P accept .

## Else { Merge }

- i. Randomly choose two consecutive subsets.
- ii. Merge them in one, keeping the relative orders with other subsets unchanged.
- iii. Evaluate the acceptance probability P accept using Eqs.(8,9,5).
- iv. Accept the move with probability P accept .

## End

## End

Finally, the pseudo-code of the split-and-merge Metropolis-Hastings procedure for the OSM is presented in Algorithm 1.

## 2.5 Estimating Partition Function

To estimate the normalisation constant Z , we employ an efficient procedure called Annealed Importance Sampling (AIS) proposed recently [12]. More specifically, AIS introduces the notion of inverse-temperature τ into the model, that is P X τ ( | ) ∝ Ω( X ) τ .

Let { τ s } S s =0 be the (slowly) increasing sequence of temperature, where τ 0 = 0 and τ S = 1, that is τ 0 &lt; τ ... &lt; τ 1 S . At τ 0 = 0, we have a uniform distribution, and at τ S = 1, we obtain the desired distribution. At each step s , we draw a sample X s from the distribution P X τ ( | s -1 ) (e.g. using the split-and-merge procedure). Let P ∗ ( X τ | ) be the unnormalised distribution of P X τ ( | ), that is P X τ ( | ) = P ∗ ( X τ /Z τ | ) ( ). The final weight after the annealing process is computed as

$$w = \frac { P ^ { * } ( X ^ { 1 } | \tau _ { 1 } ) } { P ^ { * } ( X ^ { 1 } | \tau _ { 0 } ) } \frac { P ^ { * } ( X ^ { 2 } | \tau _ { 2 } ) } { P ^ { * } ( X ^ { 2 } | \tau _ { 1 } ) }.. \frac { P ^ { * } ( X ^ { S } | \tau _ { S } ) } { P ^ { * } ( X ^ { S } | \tau _ { S - 1 } ) }$$

The above procedure is repeated R times. Finally, the normalisation constant at τ = 1 is computed as Z (1) ≈ Z (0) ( ∑ R r =1 w ( r ) /R ) where Z (0) = Fubini( N ), which is the number of configurations of the model state variables X .

## 2.6 Log-linear Parameterisation and Learning

Here we assume that the model is in the log-linear form, that is ϕ x ( i ∼ x j ) = exp { ∑ a α f a a ( x , x i j ) } and ψ x ( i glyph[follows] x j ) = exp { ∑ b β g b b ( x , x i j ) } , where { f a ( ) · , g b ( ) · } are sufficient statistics (or feature functions) and { α , β a b } are free parameters.

Figure 2: (a) A Semi-Restricted Boltzmann Machine representation of vectorial data: each shaded node represents a visible variable and empty nodes the hidden units. (b) A Latent OSM for representing ordered sets: each box represents a subset of objects.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1408.0043v1-figure-3c252b9c-df4e-4cd1-ae08-92a21331aef6.jpg)

![image](https://ac.marcodsn.me/arxiv-markdown-images/1408.0043v1-figure-f803b933-6a79-49a3-96e1-e39fc751f6f2.jpg)

Learning by maximising (log-)likelihood in log-linear models with respect to free parameters often leads to computing the expectation of sufficient statistics. For example, 〈 f a ( x , x i j ) 〉 P x ( i ∼ x j ) is needed in the gradient of the log-likelihood with respect to α a , where P x ( i ∼ x j ) is the pairwise marginal. Unfortunately, computing P x ( i ∼ x j ) is inherently hard, and running a full MCMC chain to estimate it is too expensive for practical purposes. Here we follow the stochastic approximation proposed in [25], in that we iteratively update parameters after very short MCMC chains (e.g., using Algorithm 1).

## 3 Introducing Latent Variables to OSMs

In this section, we further extend the proposed OSM by introducing latent variables into the model. The latent variables serve multiple purposes. For example, in collaborative filtering, each person chooses only a small subset of objects, thus the specific choice of objects and the ranking reflects personal taste. This cannot be discovered by the standard OSM. Second, if we want to measure the distance or similarity between two ordered partitioned sets, e.g. for clustering or visualisation, it may be useful to first transform the data into some vectorial representation.

## 3.1 Model Specification

Denote by h = ( h , h 1 2 , ..., h K ) ∈ { 0 1 , } K the hidden units to be used in conjunction with the ordered sets. The idea is to estimate the posterior P h ( k = 1 | X ) - the probability that the k th hidden unit will be activated by the input X . Thus, the requirement is that the model should allow the evaluation of P h ( k = 1 | X ) efficiently. Borrowing from the Restricted Boltzmann Machine architecture [18, 24], we can extend the model potential function as follows:

$$\hat { \Omega } ( X, h ) = \Omega ( X ) \prod _ { k } \Omega _ { k } ( X ) ^ { h _ { k } }$$

where Ω ( k X ) admits the similar factorisation as Ω( X ), i.e. Ω ( k X ) = ∏ t Φ ( k X t ) ∏ t &gt;t ′ Ψ ( k X t glyph[follows] X t ′ ), and

$$\Phi _ { k } ( X _ { t } ) \ = \ \prod _ { i, j \in X _ { t } | j > i } \varphi _ { k } ( x _ { i } \sim x _ { j } ) ; \quad \Psi _ { k } ( X _ { t } \succ X _ { t ^ { \prime } } ) = \prod _ { i \in X _ { t } } \prod _ { j \in X _ { t ^ { \prime } } } \psi _ { k } ( x _ { i } \succ x _ { j } ) \quad ( 1 2 )$$

where ϕ k ( x i ∼ x j ) and ψ k ( x i glyph[follows] x j ) capture the events of tie and relative ordering between objects x i and x j under the presence of the k th hidden unit , respectively.

We then define the model with hidden variables as P X, ( h ) = ˆ ( Ω X, h ) /Z , where Z = ∑ X, h ˆ ( Ω X, h ). A graphical representation is given in Figure 2b. Hereafter, we shall refer to this proposed model as the Latent OSM.

## 3.2 Inference

The posteriors are indeed efficient to evaluate:

$$P ( h \, | \, X ) \ = \ \prod _ { k } P ( h _ { k } \, | \, X ), \ \text{ where } P ( h _ { k } = 1 \, | \, X ) = \frac { 1 } { 1 + \Omega _ { k } ( X ) ^ { - 1 } } \quad \quad ( 1 3 )$$

Denote by h 1 k as the shorthand for h k = 1, the vector ( P h ( 1 1 | X ,P h ) ( 1 2 | X ,..., P ) ( h 1 K | X )) can then be used as a latent representation of the configuration X .

The generation of X given h is, however, much more involved as we need to explore the whole subset partitioning and ordering space:

$$P ( X \, | \, h ) = \frac { \hat { \Omega } ( X, h ) } { \sum _ { X } \hat { \Omega } ( X, h ) } = \frac { \Omega ( X ) \prod _ { k } \Omega _ { k } ( X ) ^ { h _ { k } } } { \sum _ { X } \Omega ( X ) \prod _ { k } \Omega _ { k } ( X ) ^ { h _ { k } } } \quad \ ( 1 4 )$$

For inference, since we have two layers X and h , we can alternate between them in a Gibbs sampling manner, that is, sampling X from P X ( | h ) and then h from P ( h | X ). Since sampling from P ( h | X ) is straightforward, it remains to sample from P X ( | h ) = ˆ ( Ω X, h ) / ∑ X ˆ ( Ω X, h ). Since ˆ ( Ω X, h ) has the same factorisation structure into a product of pairwise potentials as Ω( X ), we can employ the split-and-merge technique described in the previous section in a similar manner.

To see how, let ˆ( ϕ x i ∼ x , j h ) = ϕ x ( i ∼ x j ) ∏ k ϕ k ( x i ∼ x j ) h k and ˆ ( ψ x i glyph[follows] x , j h ) = ψ k ( x i glyph[follows] x j ) ∏ k ψ k ( x i glyph[follows] x j ) h k , then from Eqs.(4,11,12). We can see that Ω( ˆ X, h ) is now factorised into products of ˆ( ϕ x i ∼ x , j h ) and ˆ ( ψ x i glyph[follows] x , j h ) in the same way as Ω( X ) into products of ϕ x ( i ∼ x j ) and ψ x ( i glyph[follows] x j ):

$$\hat { \Omega } ( X, h ) \ = \ \Omega ( X ) \prod _ { k } \Omega _ { k } ( X ) ^ { h _ { k } } = \prod _ { t } \hat { \Phi } ( X _ { t }, h ) \prod _ { t ^ { \prime } > t } \hat { \Psi } ( X _ { t } \succ X _ { t ^ { \prime } }, h )$$

where

$$\hat { \Phi } ( X _ { t }, h ) \ = \ \prod _ { i, j \in X _ { t } | j > i } \hat { \varphi } ( x _ { i } \sim x _ { j }, h ) ; \quad \hat { \Psi } ( X _ { t } \succ X _ { t ^ { \prime } }, h ) = \prod _ { i \in X _ { t } } \prod _ { j \in X _ { t ^ { \prime } } } \hat { \psi } ( x _ { i } \succ x _ { j }, h )$$

Estimating the normalisation constant Z can be performed using the AIS procedure described earlier (cf. Section 2.5), except that the unnormalised distribution P ∗ ( X τ | ) is given as:

$$P ^ { * } ( X \, | \, \tau ) \ = \sum _ { h } \hat { \Omega } ( X, h ) ^ { \tau } = \ \Omega ( X ) ^ { \tau } \prod _ { k } ( 1 + \Omega _ { k } ( X ) ^ { \tau } )$$

Algorithm 2 Pseudo-code of the split-and-merge Gibbs/Metropolis-Hastings for Latent OSM.

- 1. Given an initial state X . 2. Repeat until convergence 2a. Sample h from P ( h | X ) using Eq.(13). 2b. Sample X from P X ( | h ) using Eq.(14) and Algorithm 1. End End

which can be computed efficiently for each X .

For sampling X s from P X ( | τ s -1 ), one way is to sample directly from the P X ( | τ s -1 ) in a Rao-Blackwellised fashion (e.g. by marginalising over h we obtain the unnormalised P ∗ ( X τ | )). A more straightforward way is alternating between X | h and h | X as usual. Although the former would give lower variance, we implement the latter for simplicity. The remaining is similar to the case without hidden variables, and we note that the base partition function Z (0) should be modified to Z (0) = Fubini( N )2 K , taking into account of K binary hidden variables. A pseudo-code for the split-and-merge algorithm for Latent OSM is given in Algorithm 8.

## 3.3 Parameter Specification and Learning

Like the OSM, we also assume log-linear parameterisation. In addition to those potentials shared with the OSM, here we specify hidden-specific potentials as follows: ϕ k ( x i ∼ x j ) h k = exp { ∑ a λ ak f a ( x , x i j ) h k } and ψ k ( x i glyph[follows] x j ) h k = exp { ∑ b µ bk g b ( x , x i j ) h k } . Now f a ( x , x i j ) h k and g b ( x , x i j ) h k are new sufficient statistics. As before, we need to estimate the expectation of sufficient statistics, e.g., 〈 f a ( x , x i j ) h k 〉 P x ,x ,h ( i j k ) . Equipped with Algorithm 8, the stochastic gradient trick as in Section 2.6 can then be used, that is, parameters are updated after very short chains (with respect to the model distribution P X, ( h )).

## 4 Application in Collaborative Filtering

In this section, we present one specific application of our Latent OSM in collaborative filtering. Recall that in this application, each user has usually expressed their preferences over a set of items by rating them (e.g., by assigning each item a small number of stars). Since it is cumbersome to rank all the items completely, the user often joins items into groups of similar ratings. As each user often rates only a handful of items out of thousands (or even millions), this creates a sparse ordering of subsets. Our goal is to first discover the latent taste factors for each user from their given ordered subsets, and then use these factors to recommend new items for each individual.

## 4.1 Rank Reconstruction and Completion

In this application, we are limited to producing a complete ranking over objects instead of subset partitioning and ordering. Here we consider two tasks: (i) rank completion where we want to rank unseen items given a partially ranked set 3 , and (ii) rank reconstruction 4 where we want to reconstruct the complete rank ˆ from the posterior vector ( X P h ( 1 1 | X ,P h ) ( 1 2 | X .., , P ) ( h 1 K | X )).

3 This is important in recommendation, as we shall see in the experiments.

4 This would be useful in data compression setting.

Rank completion. Assume that an unseen item x j might be ranked higher than any seen item { x i } N i =1 . Let us start from the mean-field approximation

$$P ( x _ { j } \, | \, X ) \ = \ \sum _ { h } P ( x _ { j }, h \, | \, X ) \approx Q _ { j } ( x _ { j } \, | \, X ) \prod _ { k } Q _ { k } ( h _ { k } \, | \, X )$$

From the mean-field theory, we arrive at Eq (15), which resembles the factorisation in (11).

$$Q _ { j } ( x _ { j } \, | \, X ) \ \in \ \Omega ( x _ { j }, X ) \prod _ { k } \Omega _ { k } ( x _ { j }, X ) ^ { Q _ { k } ( h _ { k } ^ { 1 } | X ) }$$

Now assume that X is sufficiently informative to estimate Q k ( h k | X ), we make further approximation Q k ( h 1 k | x ) ≈ P h ( 1 k | x ). Finally, due to the factorisation in (12), this reduces to

$$Q _ { j } ( x _ { j } \, | \, X ) \otimes \prod _ { i } \left [ \psi ( x _ { j } \succ x _ { i } ) \prod _ { k } \psi _ { k } ( x _ { j } \succ x _ { i } ) ^ { P _ { k } ( h _ { k } ^ { 1 } | X ) } \right ]$$

The RHS can be used for the purpose of ranking among new items { x j } .

Rank reconstruction. The rank reconstruction task can be thought as estimating ˆ X = arg max X ′ Q X X ( ′ | ) where Q X X ( ′ | ) = ∑ h P X ( ′ | h ) P ( h | X ). Since this maximisation is generally intractable, we may approximate it by treating X ′ as state variable of unseen items, and apply the mean-field technique as in the completion task.

## 4.2 Models Implementation

To enable fast recommendation, we use a rather simple scheme: Each item is assigned a worth φ x ( i ) ∈ R + which can be used for ranking purposes. Under the Latent OSM, the worth is also associated with a hidden unit, e.g. φ k ( x i ). Then the events of grouping and ordering can be simplified as

$$\varphi _ { k } ( x _ { i } \sim x _ { j } ) \ = \ \theta \sqrt { \phi _ { k } ( x _ { i } ) \phi _ { k } ( x _ { j } ) } ; \ \text{ and } \ \psi _ { k } ( x _ { i } \succ x _ { j } ) = \phi _ { k } ( x _ { i } )$$

where θ &gt; 0 is a factor signifying the contribution of item compatibility to the model probability. Basically the first equation says that if the two items are compatible, their worth should be positively correlated. The second asserts that if there is an ordering, we should choose the better one. This reduces to the tie model of [6] when there are only two items.

For learning, we parameterise the models as follows

$$\theta = e ^ { \nu } ; \quad \phi ( x _ { i } ) \ = \ e ^ { u _ { i } } ; \quad \phi _ { k } ( x _ { i } ) = e ^ { W _ { i k } }$$

where ν , { u i } and { W ik } are free parameters. The Latent OSM is trained using stochastic gradient with a few samples per user to approximate the gradient (e.g., see Section 3.3). To speed up learning, parameters are updated after every block of 100 users. Figure 3(a) shows the learning progress with learning rate of 0 01 using parallel . persistent Markov chains, one chain per user [25]. The samples get closer to the observed data as the model is updated, while the acceptance rates of the split-and-merge decrease, possibly because the samplers are near the region of attraction. A notable effect is that the split-and-merge dual operators favour sets of small size due to the fact that there are far more many ways to split a big subset than to

Figure 3: Results with MovieLens data. (a) Learning progress with time: Dist(sample,observed) is the portion of pairwise orders being incorrectly sampled by the split-and-merge Markov chains ( N = 10, K = 20). (b) Rank completion, as measured in NDCG@T ( N = 20 , K = 50). (c) Rank reconstruction ( N = 10) - trained on 9 , 000 users and tested on 1 000 users. ,

![image](https://ac.marcodsn.me/arxiv-markdown-images/1408.0043v1-figure-2b5a8751-62cc-49c9-a23f-966ef5ab5ee0.jpg)

![image](https://ac.marcodsn.me/arxiv-markdown-images/1408.0043v1-figure-c7129e71-113a-46cf-a3fe-c8fd0399d58a.jpg)

![image](https://ac.marcodsn.me/arxiv-markdown-images/1408.0043v1-figure-6aabdecc-23aa-492d-a5e2-cae801f2948d.jpg)

merge them. For the AIS, we follow previous practice (e.g. see [16]), i.e. S = { 10 3 , 10 4 } and R = 10 100 . { , }

For comparison, we implemented existing methods including the Probabilistic Matrix Factorisation ( PMF ) [15] where the predicted rating is used as scoring function, the Probabilistic Latent Preference Analysis ( pLPA ) [10], the ListRank.MF [17] and the matrix-factored PlackettLuce model [19] ( Plackett-Luce.MF ). For the pLPA we did not use the MM algorithm but resorted to simple gradient ascent for the inner loop of the EM algorithm. We also ran the CoFi RANK variants [23] with code provided by the authors 5 . We found that the ListRank-MF and the Plackett-Luce.MF are very sensitive to initialisation, and good results can be obtained by randomly initialising the user-based parameter matrix with non-negative entries. To create a rank for Plackett-Luce.MF, we order the ratings according to quicksort .

The performance will be judged based on the correlation between the predicted rank and ground-truth ratings. Two performance metrics are reported: the Normalised Discounted Cumulative Gain at the truncated position T (NDCG@ T ) [9], and the Expected Reciprocal Rank (ERR) [4]:

$$\text{NDCG} \@@ T \ = \frac { 1 } { \kappa ( T ) } \sum _ { i = 1 } ^ { T } \frac { 2 ^ { r _ { i } } - 1 } { \log _ { 2 } ( 1 + i ) } ; \ \text{ERR} = \sum _ { i } \frac { 1 } { i } V ( r _ { i } ) \prod _ { j = 1 } ^ { i - 1 } ( 1 - V ( r _ { j } ) ) \ \text{ for } V ( r ) = \frac { 2 ^ { r - 1 } - 1 } { 1 6 }$$

where r i is the relevance judgment of the movie at position i , κ T ( ) is a normalisation constant to make sure that the gain is 1 if the rank is correct. Both the metrics put more emphasis on top ranked items.

Table 1: Average log-likelihood over 100 users of test data (Movie Lens 10M dataset), after training on the N = 10 movies per user ( K = 10). M is the number of test movies per user. The Plackett-Luce.MF and the Latent OSM are comparable because they are both probabilistic in ranks and can capture latent aspects of the data. The main difference is that the PlackettLuce.MF does not handle groupings or ties.

|                  |   M = 10 |   M = 20 |   M = 30 |
|------------------|----------|----------|----------|
| Plackett-Luce.MF |    -14.7 |    -41.3 |    -72.6 |
| Latent OSM       |     -9.8 |    -37.9 |    -73.4 |

## 4.3 Results

We evaluate our proposed model and inference on large-scale collaborative filtering datasets: the MovieLens 6 10M and the Netflix challenge 7 . The MovieLens dataset consists of slightly over 10 million half-integer ratings (from 0 to 5) applied to 10 681 movies by 71 567 users. , , The ratings are from 0 5 to 5 with 0 5 increments. . . We divide the rating range into 5 segments of equal length., and those ratings from the same segment will share the same rank. The Netflix dataset has slightly over 100 million ratings applied to 17 , 770 movies by 480 189 users, where , ratings are integers in a 5-star ordinal scale.

Data likelihood estimation . Table 1 shows the log-likelihood of test data averaged over 100 users with different numbers of movies per user. Results for the Latent OSM are estimated using the AIS procedure.

Rank reconstruction . Given the posterior vector, we ask whether we can reconstruct the original rank of movies for that data instance. For simplicity, we only wish to obtain a complete ranking, since it is very efficient (e.g. a typical cost would be N log N per user). Figure 3(c) indicates that high quality rank reconstruction (on both training and test data) is possible given enough hidden units. This suggests an interesting way to store and process rank data by using vectorial representation.

Rank completion . In collaborative filtering settings, we are interested in ranking unseen movies for a given user. To highlight the disparity between user tastes, we remove movies whose qualities are inherently good or bad, that is when there is a general agreement among users. More specifically, we compute the movie entropy as H i = -∑ 5 r =1 P i ( r ) log P i ( r ) where P i ( r ) is estimated as the proportion of users who rate the movie i by r points. We then remove half of the movies with lowest entropy. For each dataset, we split the data into a training set and a test set as follows. For each user, we randomly choose 10, 20 and 50 items for training, and the rest for testing. To ensure that each user has at least 10 test items, we keep only those users with no less than 20, 30 and 60 ratings, respectively.

Figs. 3(b), 4(a) and Table 2 report the results on the MovieLens 10M dataset; Figs. 4(b) and Table 3 show the results for the Netflix dataset. It can be seen that the Latent OSM performs better than rivals when N is moderate. For large N , the rating-based method (PMF) seems to work better, possibly because converting rating into ordering loses too much information in this case, and it is more difficult for the Latent OSM to explore the hyper-exponential state-space .

5 http://cofirank.org

6 http://www.grouplens.org/node/12

7 http://www.netflixprize.com

![image](https://ac.marcodsn.me/arxiv-markdown-images/1408.0043v1-figure-32f2fb1c-f6e0-402d-9f10-68344fa2e3f4.jpg)

![image](https://ac.marcodsn.me/arxiv-markdown-images/1408.0043v1-figure-a2eeeef5-8471-4d81-a39a-c2739b49d074.jpg)

Figure 4: Rank completion quality vs. number of hidden units - note that since the PMF is not defined when hidden size is 0, we substitute using the result for hidden size 1.

Table 2: Model comparison on the MovieLens data for rank completion ( K = 50). N@ T is a shorthand for NDCG@ T .

|                    | N = 10   | N = 10   | N = 20   | N = 20   | N = 50   | N = 50   |
|--------------------|----------|----------|----------|----------|----------|----------|
|                    | ERR      | N@5      | ERR      | N@5      | ERR      | N@5      |
| PMF                | 0.673    | 0.603    | 0.687    | 0.612    | 0.717    | 0.638    |
| pLPA               | 0.674    | 0.596    | 0.684    | 0.601    | 0.683    | 0.595    |
| ListRank.MF        | 0.683    | 0.603    | 0.682    | 0.601    | 0.684    | 0.595    |
| Plackett-Luce.MF   | 0.663    | 0.586    | 0.677    | 0.591    | 0.681    | 0.586    |
| CoFi RANK .Regress | 0.675    | 0.597    | 0.681    | 0.598    | 0.667    | 0.572    |
| CoFi RANK .Ordinal | 0.623    | 0.530    | 0.621    | 0.522    | 0.622    | 0.515    |
| CoFi RANK .N@10    | 0.615    | 0.522    | 0.623    | 0.517    | 0.602    | 0.491    |
| Latent OSM         | 0.690    | 0.619    | 0.708    | 0.632    | 0.710    | 0.629    |

Table 3: Model comparison on the Netflix data for rank completion ( K = 50).

|             | N = 10   | N = 10   | N = 10   | N = 10   | N = 20   | N = 20   | N = 20   | N = 20   |
|-------------|----------|----------|----------|----------|----------|----------|----------|----------|
|             | ERR      | N@1      | N@5      | N@10     | ERR      | N@1      | N@5      | N@10     |
| PMF         | 0.678    | 0.586    | 0.607    | 0.649    | 0.691    | 0.601    | 0.624    | 0.661    |
| ListRank.MF | 0.656    | 0.553    | 0.579    | 0.623    | 0.658    | 0.553    | 0.577    | 0.617    |
| Latent OSM  | 0.694    | 0.611    | 0.628    | 0.666    | 0.714    | 0.638    | 0.648    | 0.680    |

## 5 Related Work

This work is closely related to the emerging concept of preferences over sets in AI [3, 22] and in social choice and utility theories [1]. However, most existing work has focused on representing preferences and computing the optimal set under preference constraints [2]. These differ from our goals to model a distribution over all possible set orderings and to learn from example orderings. Learning from expressed preferences has been studied intensively in AI and machine learning, but they are often limited to pairwise preferences or complete ordering [5, 23].

On the other hand, there has been very little work on learning from ordered sets [26, 22]. The most recent and closest to our is the PMOP which models ordered sets as a locally normalised high-order Markov chain [19]. This contrasts with our setting which involves a globally normalised log-linear solution. Note that since the high-order Markov chain involves all previously ranked subsets, while our OSM involves pairwise comparisons, the former is not a special case of ours. Our additional contribution is that we model the space of partitioning and ordering directly and offer sampling tools to explore the space. This ease of inference is not readily available for the PMOP. Finally, our solution easily leads to the introduction of latent variables, while their approach lacks that capacity.

Our split-and-merge sampling procedure bears some similarity to the one proposed in [8] for mixture assignment. The main difference is that we need to handle the extra orderings between partitions, while it is assumed to be exchangeable in [8]. This causes a subtle difference in generating proposal moves. Likewise, a similar method is employed in [14] for mapping a set of observations into a set of landmarks, but again, ranking is not considered.

With respect to collaborative ranking, there has been work focusing on producing a set of items instead of just ranking individual ones [13]. These can be considered as a special case of OSM where there are only two subsets (those selected and the rest).

## 6 Conclusion and Future Work

We have introduced a latent variable approach to modelling ranked groups. Our main contribution is an efficient split-and-merge MCMC inference procedure that can effectively explore the hyper-exponential state-space. We demonstrate how the proposed model can be useful in collaborative filtering. The empirical results suggest that proposed model is competitive against state-of-the-art rivals on a number of large-scale collaborative filtering datasets.

## References

- [1] S. Barber`, W. Bossert, and P.K. Pattanaik. a Ranking sets of objects. Handbook of Utility Theory: Extensions , 2:893, 2004.
- [2] M. Binshtok, R.I. Brafman, S.E. Shimony, A. Martin, and C. Boutilier. Computing optimal subsets. In Proceedings of the National Conference on Artificial Intelligence , volume 22, page 1231. Menlo Park, CA; Cambridge, MA; London; AAAI Press; MIT Press; 1999, 2007.
- [3] R.I. Brafman, C. Domshlak, S.E. Shimony, and Y. Silver. Preferences over sets. In Proceedings of the National Conference on Artificial Intelligence , volume 21, page 1101. Menlo Park, CA; Cambridge, MA; London; AAAI Press; MIT Press; 1999, 2006.
- [4] O. Chapelle, D. Metlzer, Y. Zhang, and P. Grinspan. Expected reciprocal rank for graded relevance. In CIKM , pages 621-630. ACM, 2009.
- [5] W.W. Cohen, R.E. Schapire, and Y. Singer. Learning to order things. J Artif Intell Res , 10:243-270, 1999.
- [6] R.R. Davidson. On extending the Bradley-Terry model to accommodate ties in paired comparison experiments. Journal of the American Statistical Association , 65(329):317-328, 1970.
- [7] O. Dekel, C. Manning, and Y. Singer. Log-linear models for label ranking. Advances in Neural Information Processing Systems , 16, 2003.
- [8] S. Jain and R.M. Neal. A split-merge Markov chain Monte Carlo procedure for the Dirichlet process mixture model. Journal of Computational and Graphical Statistics , 13(1):158-182, 2004.
- [9] K. J¨rvelin and J. Kek¨l¨inen. a a a Cumulated gain-based evaluation of IR techniques. ACM Transactions on Information Systems (TOIS) , 20(4):446, 2002.
- [10] N.N. Liu, M. Zhao, and Q. Yang. Probabilistic latent preference analysis for collaborative filtering. In CIKM , pages 759-766. ACM, 2009.
- [11] M. Mure¸ san. A concrete approach to classical analysis . Springer Verlag, 2008.
- [12] R.M. Neal. Annealed importance sampling. Statistics and Computing , 11(2):125-139, 2001.
- [13] R. Price and P.R. Messinger. Optimal recommendation sets: Covering uncertainty over user preferences. In Proceedings of the National Conference on Artificial Intelligence , volume 20, page 541. Menlo Park, CA; Cambridge, MA; London; AAAI Press; MIT Press; 1999, 2005.
- [14] A. Ranganathan, E. Menegatti, and F. Dellaert. Bayesian inference in the space of topological maps. Robotics, IEEE Transactions on , 22(1):92-107, 2006.
- [15] R. Salakhutdinov and A. Mnih. Probabilistic matrix factorization. Advances in neural information processing systems , 20:1257-1264, 2008.
- [16] R. Salakhutdinov and I. Murray. On the quantitative analysis of deep belief networks. In Proceedings of the 25th international conference on Machine learning , pages 872-879. ACM, 2008.
- [17] Y. Shi, M. Larson, and A. Hanjalic. List-wise learning to rank with matrix factorization for collaborative filtering. In ACM RecSys , pages 269-272. ACM, 2010.
- [18] P. Smolensky. Information processing in dynamical systems: Foundations of harmony theory. Parallel distributed processing: Explorations in the microstructure of cognition , 1:194-281, 1986.
- [19] T. Truyen, D.Q Phung, and S. Venkatesh. Probabilistic models over ordered partitions with applications in document ranking and collaborative filtering. In Proc. of SIAM Conference on Data Mining (SDM) , Mesa, Arizona, USA, 2011. SIAM.
- [20] J.H. van Lint and R.M. Wilson. A course in combinatorics . Cambridge Univ Pr, 1992.
- [21] S. Vembu and T. G¨ artner. Label ranking algorithms: A survey. Preference Learning , page 45, 2010.
- [22] K.L. Wagstaff, Marie desJardins, and E. Eaton. Modelling and learning user preferences over sets. Journal of Experimental &amp; Theoretical Artificial Intelligence , 22(3):237-268, 2010.
- [23] M. Weimer, A. Karatzoglou, Q. Le, and A. Smola. CoFi RANK -maximum margin matrix factorization for collaborative ranking. Advances in neural information processing systems , 20:1593-1600, 2008.
- [24] M. Welling, M. Rosen-Zvi, and G. Hinton. Exponential family harmoniums with an application to information retrieval. In Advances in NIPS , volume 17, pages 1481-1488. 2005.
- [25] L. Younes. Parametric inference for imperfectly observed Gibbsian fields. Probability Theory and Related Fields , 82(4):625-645, 1989.
- [26] Y. Yue and T. Joachims. Predicting diverse subsets using structural SVMs. In Proceedings of the 25th international conference on Machine learning , pages 1224-1231. ACM, 2008.
Truyen Tran Dinh Phung Svetha Venkatesh
Learning From Ordered Sets and Applications in Collaborative Ranking
Ranking over sets arise when users choose between groups of items. For
example, a group may be of those movies deemed $5$ stars to them, or a
customized tour package. It turns out, to model this data type properly, we
need to investigate the general combinatorics problem of partitioning a set and
ordering the subsets. Here we construct a probabilistic log-linear model over a
set of ordered subsets. Inference in this combinatorial space is highly
challenging: The space size approaches $(N!/2)6.93145^{N+1}$ as $N$ approaches
infinity. We propose a \texttt{split-and-merge} Metropolis-Hastings procedure
that can explore the state-space efficiently. For discovering hidden aspects in
the data, we enrich the model with latent binary variables so that the
posteriors can be efficiently evaluated. Finally, we evaluate the proposed
model on large-scale collaborative filtering tasks and demonstrate that it is
competitive against state-of-the-art methods.