Google

Archives

关于修改/增加lucene排序算法的讨论

http://www.mail-archive.com/general@lucene.apache.org/msg00431.html

http://www.mail-archive.com/general@lucene.apache.org/msg00432.html

由于刚读研的时候就开始学习Lucene,所以一直对Lucene情有独钟,现在想在排序ranking方面做些研究,感觉最好先能花点时间把一些基本ranking算法实现,譬如tfidf,bm25什么的。想在lucene框架的基础上完成这个工作,但研究一段感觉有困难,今天看到上面链接里的帖子也遇到这样的问题,不知有没有大侠有过相关研究,还劳烦给点提示!

其实最开始是想实现一个Lab-Lucene,用于做各种IR相关实验,但一开始就被这个问题给难住了,挺郁闷。以后有进展,定分享之。

————————————–

PS:  2010-02-28

NEWS: Lab-Lucene 现在主要已经基本开发完,现在已经包括绝大多少basic weighting model (LM, BM25, DFR, TFIDF) , 以及各种Query Expansion Models, 性能在一些列 TREC ad hoc datasets 上,至少与公开实验数据是comparable.

计划在写完基于hadoop 分布式所以和检索后开源,当然还有文档。欢迎讨论!

Incoming search terms for the article:

  • lucene 排序算法 (13)
  • lucene 排序 (3)
  • lucene BM25檢索 (2)
  • lucene 2 4 排序 (2)
  • lm 排序算法源码 (2)

Related Posts

No comments yet to 关于修改/增加lucene排序算法的讨论

  • giantleap

    The score of query q for document d correlates to the cosine-distance or dot-product between document and query vectors in a Vector Space Model (VSM) of Information Retrieval. A document whose vector is closer to the query vector in that model is scored higher. The score is computed as follows:

    score(q,d) = coord(q,d) · queryNorm(q) · ∑ ( tf(t in d) · idf(t)2 · t.getBoost() · norm(t,d) )
    t in q

    where

    tf(t in d) correlates to the term’s frequency, defined as the number of times term t appears in the currently scored document d. Documents that have more occurrences of a given term receive a higher score. The default computation for tf(t in d) in DefaultSimilarity is:

    tf(t in d) = frequency½

    idf(t) stands for Inverse Document Frequency. This value correlates to the inverse of docFreq (the number of documents in which the term t appears). This means rarer terms give higher contribution to the total score. The default computation for idf(t) in DefaultSimilarity is:

    idf(t) = 1 + log ( numDocs
    –––––––––
    docFreq+1
    )

    coord(q,d) is a score factor based on how many of the query terms are found in the specified document. Typically, a document that contains more of the query’s terms will receive a higher score than another document with fewer query terms. This is a search time factor computed in coord(q,d) by the Similarity in effect at search time.

    queryNorm(q) is a normalizing factor used to make scores between queries comparable. This factor does not affect document ranking (since all ranked documents are multiplied by the same factor), but rather just attempts to make scores from different queries (or even different indexes) comparable. This is a search time factor computed by the Similarity in effect at search time. The default computation in DefaultSimilarity is:

    queryNorm(q) = queryNorm(sumOfSquaredWeights) = 1
    ––––––––––––––
    sumOfSquaredWeights½

    The sum of squared weights (of the query terms) is computed by the query Weight object. For example, a boolean query computes this value as:

    sumOfSquaredWeights = q.getBoost() 2 · ∑ ( idf(t) · t.getBoost() ) 2
    t in q

    t.getBoost() is a search time boost of term t in the query q as specified in the query text (see query syntax), or as set by application calls to setBoost(). Notice that there is really no direct API for accessing a boost of one term in a multi term query, but rather multi terms are represented in a query as multi TermQuery objects, and so the boost of a term in the query is accessible by calling the sub-query getBoost().

    norm(t,d) encapsulates a few (indexing time) boost and length factors:
    Document boost – set by calling doc.setBoost() before adding the document to the index.
    Field boost – set by calling field.setBoost() before adding the field to a document.
    lengthNorm(field) – computed when the document is added to the index in accordance with the number of tokens of this field in the document, so that shorter fields contribute more to the score. LengthNorm is computed by the Similarity class in effect at indexing.
    When a document is added to the index, all the above factors are multiplied. If the document has multiple fields with the same name, all their boosts are multiplied together:

    norm(t,d) = doc.getBoost() · lengthNorm(field) · ∏ f.getBoost()
    field f in d named as t

    However the resulted norm value is encoded as a single byte before being stored. At search time, the norm byte value is read from the index directory and decoded back to a float norm value. This encoding/decoding, while reducing index size, comes with the price of precision loss – it is not guaranteed that decode(encode(x)) = x. For instance, decode(encode(0.89)) = 0.75. Also notice that search time is too late to modify this norm part of scoring, e.g. by using a different Similarity for search.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>