Sesame HTTP: Overview of Learning to Rank

Learning to Rank, or learning to rank, or L2R for short, is a machine learning method for building ranking models, which plays an important role in information retrieval, natural language processing, data mining and other scenarios. The effect it achieves is: given a set of documents, any query request is given a document ranking that reflects the relevance of the documents. This paper briefly introduces the basic algorithm and evaluation index of L2R.

background

With the rapid development of the Internet, L2R technology has also received more and more attention, which is one of the common tasks of machine learning. During information retrieval, given a query target, we need to calculate and return the result that best meets the requirements. This involves some algorithms such as feature calculation and matching. For massive data, if we only rely on manual intervention to some of the parameters for sorting It is far from meeting the requirements, and the L2R algorithm is used to solve this problem. L2R applies the technology of machine learning to sorting, and proposes some new theories and methods to effectively solve the sorting problem. problems, and the efficiency has also leaped by several orders of magnitude compared with manual intervention.

L2R algorithm

The L2R algorithm mainly includes three categories: Pointwise, Pairwise, and Listwise, which will be introduced separately below.

1. Pointwise

Pointwise transforms the problem into a multi-classification or regression problem. If it comes down to a multi-classification problem, for a certain Query, label the degree of relevance between the document and this Query, and the labels are divided into limited categories, so that the problem is turned into a multi-classification problem; if it comes down to a regression problem, for a certain Query , then the relevance Score is calculated for the relevance of the document to this Query, so that the problem can be attributed to a regression problem.

Model

The applied Pointwise models include Subset Ranking, OC SVM, McRank, Prank and so on.

enter

A specific Query, the feature vector of the document.

output

The document's label category or relevance score for the Query.

loss function

Regression Loss, Classification Loss, ordinal regression Loss.

Advantages and disadvantages

Pointwise 算法实现简单,易于理解,但它只对给定 Query 单个文档的相关度进行建模,仅仅考虑了单个文档的绝对相关度,Pointwise 只学习到了文档和 Query 的全局相关性,对排序先后顺序有一定的影响。在某一些场景下,排在最前面的几个文档对排序结果的影响非常重要,如搜索引擎的第一页的内容非常重要,而 Pointwise 没有考虑这方面的影响,不对排序的先后顺序优劣做惩罚。

2. Pairwise

上文提到 Pointwise 方法只考虑了单个文档和 Query 的绝对相关度,Pairwise 考虑的则是两个文档之间的相对相关度,比较不同文档的先后顺序。Pairwise 方法是目前比较流行的方法,它将整个排序问题转为二元分类问题,即构建的是一个二分类器,对一个文档对 <Doc1, Doc2> 做二分类,一类是 Doc1 排序前于 Doc2,另一类则相反,通过两两比较,模型可以学习到不同文档之间的先后顺序。

模型

应用 Pairwise 的模型有 Ranking SVM、RankBoost、RankNet、GBRank、IR SVM 等。

输入

特定 Query,文档对 <Doc1, Doc2>。

输出

文档对偏向得分,{-1, 1}。

损失函数

Pairwise 分类 Loss。

优缺点

Pairwise 方法通过考虑两两文档之间的相关度来进行排序,有一定进步。但 Pairwise 使用的是两文档之间相关相关度的损失函数,而它和真正衡量排序效果的指标之间存在很大不同,甚至可能是负相关的,如可能出现 Pairwise Loss 越来越低,但 NDCG 分数也越来越低的现象。另外此方法只考虑了两个文档的先后顺序,且没有考虑文档在搜索列表中出现的位置,导致最终排序效果并不理想。

3. Listwise

Listwise 算法相对于 Pointwise 和 Pairwise 方法来说,它不再将排序问题转化为一个分类问题或者回归问题,而是直接针对评价指标对文档的排序结果进行优化,如常用的 MAP、NDCG 等。

模型

应用 Listwise 的模型有 ListNet、ListMLE、SVM MAP、AdaRank、SoftRank、LambdaRank、LambdaMART。其中 LambdaMART(对 RankNet 和 LambdaRank 的改进)在 Yahoo Learning to Rank Challenge 表现出最好的性能。

输入

特定Query,文档集合

输出

所有文档的打分或者排列顺序

损失函数

评价指标如 NDCG、MAP 等。

优缺点

由于此种方法是针对评价指标直接进行优化,所以它往往表现出不错的效果。

评价指标

L2R 评价指标主要有 NDCG、MAP、WTA、MRR 等,下面分别简单介绍一下。

1. NDCG

NDCG,全称为 Normalized Discounted Cumulative Gain,是一种综合考虑模型排序结果和真实序列之间的关系的一种指标,也是最常用的衡量排序结果的指标,其计算公式如下:

$$ \mathrm{NDCG@K} = \frac{DCG}{iDCG} $$

NDCG 其实是由 DCG 的值计算出来的,分子为模型计算出的 DCG 值,分母则为理想情况下的 DCG 值,而 DCG 的计算公式如下:

$$ \mathrm{DCG@K} = \sum_{i=1}^{k}{\frac {{2^{r(i)}-1}}{\log_{2}{(i+1)}}} $$

在 DCG 的表达式中,$\sum_{i=1}^{k}$ 是求和累积,${r(i)}$ 表示在模型给出的排序中,排名为 i 的元素的实际分数,这里通过 ${2^{r(i)}-1}$ 运算放大了其分数的差异,$\log_{2}{(i+1)}$ 是每个元素的折价,由于排序靠前的元素被选取的概率更大,所以这里可以使得排名前面的元素影响权重更大。

2. MAP

MAP,全称为 Mean Average Precision,即平均准确率。对于每个真实相关的文档,考虑其在模型排序结果中的位置 P,统计该位置之前的文档集合的分类准确率,取所有这些准确率的平均值。

对于一个 Query,原本有 4 个相关结果,查询时将 4 个结果都查询出来了,其 rank 分别为 1, 2, 4, 7,则 MAP 为 (1/1 + 2/2 + 3/4 + 4/7)/4 = 0.83。对于另一个 Query,原本有 5 个相关结果,查询只有 3 个相关结果,其 rank 分别为 1, 3, 5,则 MAP 为 (1/1 + 2/3 + 3/5 + 0 + 0)/5 = 0.45。则 MAP = (0.83 + 0.45)/2 = 0.64。

3. WTA

WTA,全称 Winners Take All,对于给定的查询 Query,如果模型返回的结果列表中,第一个文档是相关的,则 WTA =1, 否则为 0。

如对于一个 Query,本来有 5 个相关结果,查询结果中如果第一个结果是相关的,那么 WTA = 1,如果第一个结果是不相关的,则 WTA = 0。

4. MRR

MRR,全称 Mean Reciprocal Rank,是把相关文档在结果中的排序倒数作为准确度,然后再取平均。

如对于第一个 Query,查询结果将正确结果排名 rank 为 3,则其 Reciprocal Rank 为 1/3,对于第二个 Query,查询结果将正确结果排名 rank 为 2,则其 Reciprocal Rank 为 1/2,对于第三个 Query,查询结果将正确结果排名 rank 为 1,则其 Reciprocal Rank 为 1,则 MRR = (1/3 + 1/2 + 1)/3 = 11/18 = 0.61。

参考资料

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326210692&siteId=291194637