Introduction to Pairwise loss function

HEMANTHKUMAR GADI
4 min readSep 9, 2019

--

Learning to rank has become an important research topic in many fields, such as machine learning and information retrieval. The process of learning to rank is as follows. In training, a number of sets are given, each set consisting of objects and labels representing their rankings (e.g., in terms of multi-level ratings 1 ). Then a ranking function is constructed by minimizing a certain loss function on the training data. In testing, given a new set of objects, the ranking function is applied to produce a ranked list of the objects. Many learning-to-rank methods have been proposed in the literature, with different motivations and formulations. Learning to Rank (LTR) is a class of techniques that apply supervised machine learning (ML) to solve ranking problems.

The main difference between LTR and traditional supervised ML is this:

  • Traditional ML solves a prediction problem (classification or regression) on a single instance at a time. E.g. if you are doing spam detection on email, you will look at all the features associated with that email and classify it as spam or not. The aim of traditional ML is to come up with a class (spam or no-spam) or a single numerical score for that instance.
  • LTR solves a ranking problem on a list of items. The aim of LTR is to come up with optimal ordering of those items. As such, LTR doesn’t care much about the exact score that each item gets, but cares more about the relative ordering among all the items.

The most common application of LTR is Information Retrieval, Recommendation Systems, Drug Discovery but it’s useful anywhere you need to produce a ranked list of items.

In general, these methods can be divided into three categories . The pointwise approach (such as subset regression ), The pairwise approach (such as Ranking SVM, RankBoost and RankNet)regards a pair of objects as the learning instance. The listwise approach, such as (ListNet ), takes the entire ranked list of objects as the learning instance. Almost all these methods learn their ranking functions by minimizing certain loss functions, namely the pointwise, pairwise, and listwise losses.Here we maily focus on pairwise loss function.

Loss functions in learning to rank:

Let x = {x1, · · · , xn} be the objects be to ranked. Suppose the labels of the objects are given as multi-level ratings L = {l(1), …, l(n)}, where l(i) ∈ {r1, …, rK} denotes the label of xi [11]. Without loss of generality, we assume l(i) ∈ {0, 1, …, K − 1} and name the corresponding labels as K-level ratings. If l(i) > l(j), then xi should be ranked before xj . Let F be the function class and f ∈ F be a ranking function. The optimal ranking function is learned from the training data by minimizing a certain loss function defined on the objects, their labels, and the ranking function. Several approaches have been proposed to learn the optimal ranking function.

Pairwise approach:

In this case, the learning-to-rank problem is approximated by a classification problem — learning a binary classifier that can tell which document is better in a given pair of documents. The goal is to minimize the average number of inversions in ranking.In the pairwise approach, the loss function is defined on the basis of pairs of objects whose labels are different.

For example, the loss functions of Ranking SVM [7], RankBoost [6], and RankNet [2] all have the following form

where the ϕ functions are hinge function ( ϕ(z) = (1 − z)+), exponential function (ϕ(z) = e−z),and logistic function (ϕ(z) = log(1 + e−z)) respectively, for the three algorithms.

Evaluation measures:

There are several measures (metrics) which are commonly used to judge how well an algorithm is doing on training data and to compare the performance of different MLR algorithms. Often a learning-to-rank problem is reformulated as an optimization problem with respect to one of these metrics.

Examples of ranking quality measures:

Here we introduce two of them, NDCG and MAP, which are popularly used in information retrieval.

Interested to learn more go through the below links

--

--

HEMANTHKUMAR GADI
HEMANTHKUMAR GADI

No responses yet