码迷,mamicode.com
首页 > 编程语言 > 详细

Solr相似度算法二:Okapi BM25

时间:2015-06-15 18:14:06      阅读:1356      评论:0      收藏:0      [点我收藏+]

标签:

 

In information retrievalOkapi BM25 (BM stands for Best Matching) is a ranking function used by search engines to rank matching documents according to their relevance to a given search query. It is based on the probabilistic retrieval framework developed in the 1970s and 1980s byStephen E. RobertsonKaren Spärck Jones, and others.

The name of the actual ranking function is BM25. To set the right context, however, it usually referred to as "Okapi BM25", since the Okapi information retrieval system, implemented at London‘s City University in the 1980s and 1990s, was the first system to implement this function.

BM25, and its newer variants, e.g. BM25F (a version of BM25 that can take document structure and anchor text into account), represent state-of-the-art TF-IDF-like retrieval functions used in document retrieval, such as web search.

 

The ranking function[edit]

BM25 is a bag-of-words retrieval function that ranks a set of documents based on the query terms appearing in each document, regardless of the inter-relationship between the query terms within a document (e.g., their relative proximity). It is not a single function, but actually a whole family of scoring functions, with slightly different components and parameters. One of the most prominent instantiations of the function is as follows.

Given a query 技术分享, containing keywords 技术分享, the BM25 score of a document 技术分享 is:

技术分享

where 技术分享 is 技术分享‘s term frequency in the document 技术分享技术分享 is the length of the document 技术分享 in words, and 技术分享 is the average document length in the text collection from which documents are drawn. 技术分享 and 技术分享 are free parameters, usually chosen, in absence of an advanced optimization, as 技术分享 and 技术分享.[1] 技术分享 is the IDF (inverse document frequency) weight of the query term 技术分享. It is usually computed as:

技术分享

where 技术分享 is the total number of documents in the collection, and 技术分享 is the number of documents containing 技术分享.

There are several interpretations for IDF and slight variations on its formula. In the original BM25 derivation, the IDF component is derived from the Binary Independence Model.

Please note that the above formula for IDF shows potentially major drawbacks when using it for terms appearing in more than half of the corpus documents. These terms‘ IDF is negative, so for any two almost-identical documents, one which contains the term and one which does not contain it, the latter will possibly get a larger score. This means that terms appearing in more than half of the corpus will provide negative contributions to the final document score. This is often an undesirable behavior, so many real-world applications would deal with this IDF formula in a different way:

  • Each summand can be given a floor of 0, to trim out common terms;
  • The IDF function can be given a floor of a constant 技术分享, to avoid common terms being ignored at all;
  • The IDF function can be replaced with a similarly shaped one which is non-negative, or strictly positive to avoid terms being ignored at all.

IDF information theoretic interpretation[edit]

Here is an interpretation from information theory. Suppose a query term 技术分享 appears in 技术分享 documents. Then a randomly picked document 技术分享 will contain the term with probability 技术分享 (where 技术分享 is again the cardinality of the set of documents in the collection). Therefore, the informationcontent of the message "技术分享 contains 技术分享" is:

技术分享

Now suppose we have two query terms 技术分享 and 技术分享. If the two terms occur in documents entirely independently of each other, then the probability of seeing both 技术分享 and 技术分享 in a randomly picked document 技术分享 is:

技术分享

and the information content of such an event is:

技术分享

With a small variation, this is exactly what is expressed by the IDF component of BM25.

Modifications[edit]

  • At the extreme values of the coefficient 技术分享 BM25 turns into ranking functions known as BM11 (for 技术分享) and BM15 (for 技术分享).[2]
  • BM25F[3] is a modification of BM25 in which the document is considered to be composed from several fields (such as headlines, main text, anchor text) with possibly different degrees of importance.
  • BM25+[4] is an extension of BM25. BM25+ was developed to address one deficiency of the standard BM25 in which the component of term frequency normalization by document length is not properly lower-bounded; as a result of this deficiency, long documents which do match the query term can often be scored unfairly by BM25 as having a similar relevancy to shorter documents that do not contain the query term at all. The scoring formula of BM25+ only has one additional free parameter 技术分享 (a default value is 技术分享 in absence of a training data) as compared with BM25:
技术分享

Solr相似度算法二:Okapi BM25

标签:

原文地址:http://www.cnblogs.com/lvfeilong/p/324dsfdsf.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!