Lecture 5 Term and Document Frequency CS 6633 資訊檢索 Information Retrieval and Web Search 資電 125 Based on ppt files by Hinrich Schütze.

Slides:



Advertisements
Similar presentations
Chapter 5: Introduction to Information Retrieval
Advertisements

Beyond Boolean Queries Ranked retrieval  Thus far, our queries have all been Boolean.  Documents either match or don’t.  Good for expert users with.
Lecture 11 Search, Corpora Characteristics, & Lucene Introduction.
| 1 › Gertjan van Noord2014 Zoekmachines Lecture 4.
Ranking models in IR Key idea: We wish to return in order the documents most likely to be useful to the searcher To do this, we want to know which documents.
Introduction to Information Retrieval (Manning, Raghavan, Schutze) Chapter 6 Scoring term weighting and the vector space model.
TF-IDF David Kauchak cs160 Fall 2009 adapted from:
ADFOCS 2004 Prabhakar Raghavan Lecture 3. Zones A zone is an identified region within a doc E.g., Title, Abstract, Bibliography Generally culled from.
CpSc 881: Information Retrieval
Information Retrieval Lecture 6. Recap of lecture 4 Query expansion Index construction.
Parametric search and zone weighting Lecture 6. Recap of lecture 4 Query expansion Index construction.
Scoring and Ranking 198:541. Scoring Thus far, our queries have all been Boolean Docs either match or not Good for expert users with precise understanding.
Information Retrieval IR 5. Plan Last lecture Index construction This lecture Parametric and field searches Zones in documents Wild card queries Scoring.
CS276 Information Retrieval and Web Mining
Hinrich Schütze and Christina Lioma
Evaluating the Performance of IR Sytems
Information Retrieval IR 6. Recap of the last lecture Parametric and field searches Zones in documents Scoring documents: zone weighting Index support.
Retrieval Models II Vector Space, Probabilistic.  Allan, Ballesteros, Croft, and/or Turtle Properties of Inner Product The inner product is unbounded.
Vector Space Model : TF - IDF
CES 514 Data Mining March 11, 2010 Lecture 5: scoring, term weighting, vector space model (Ch 6)
CS246 Basic Information Retrieval. Today’s Topic  Basic Information Retrieval (IR)  Bag of words assumption  Boolean Model  Inverted index  Vector-space.
Chapter 5: Information Retrieval and Web Search
CSCI 5417 Information Retrieval Systems Jim Martin Lecture 6 9/8/2011.
CS276A Text Information Retrieval, Mining, and Exploitation Lecture 4 15 Oct 2002.
Documents as vectors Each doc j can be viewed as a vector of tf.idf values, one component for each term So we have a vector space terms are axes docs live.
Web search basics (Recap) The Web Web crawler Indexer Search User Indexes Query Engine 1 Ad indexes.
Boolean and Vector Space Models
Scoring, Term Weighting, and Vector Space Model Lecture 7: Scoring, Term Weighting and the Vector Space Model Web Search and Mining 1.
Chapter 2 Architecture of a Search Engine. Search Engine Architecture n A software architecture consists of software components, the interfaces provided.
Web Search and Text Mining Lecture 3. Outline Distributed programming: MapReduce Distributed indexing Several other examples using MapReduce Zones in.
Information Retrieval Lecture 2 Introduction to Information Retrieval (Manning et al. 2007) Chapter 6 & 7 For the MSc Computer Science Programme Dell Zhang.
Basic ranking Models Boolean and Vector Space Models.
Xiaoying Gao Computer Science Victoria University of Wellington Intelligent Agents COMP 423.
Advanced topics in Computer Science Jiaheng Lu Department of Computer Science Renmin University of China
Term Frequency. Term frequency Two factors: – A term that appears just once in a document is probably not as significant as a term that appears a number.
Chapter 6: Information Retrieval and Web Search
Search Engines. Search Strategies Define the search topic(s) and break it down into its component parts What terms, words or phrases do you use to describe.
Introduction to Digital Libraries hussein suleman uct cs honours 2003.
Ranking in Information Retrieval Systems Prepared by: Mariam John CSE /23/2006.
Comparing and Ranking Documents Once our search engine has retrieved a set of documents, we may want to Rank them by relevance –Which are the best fit.
Web search basics (Recap) The Web Web crawler Indexer Search User Indexes Query Engine 1.
Information Retrieval and Web Mining Lecture 6. This lecture Parametric and field searches Zones in documents Scoring documents: zone weighting Index.
Introduction to Information Retrieval Introduction to Information Retrieval COMP4210: Information Retrieval and Search Engines Lecture 5: Scoring, Term.
CSCI 5417 Information Retrieval Systems Jim Martin Lecture 5 9/6/2011.
Vector Space Models.
Search Engines WS 2009 / 2010 Prof. Dr. Hannah Bast Chair of Algorithms and Data Structures Department of Computer Science University of Freiburg Lecture.
Web-Mining Agents Cooperating Agents for Information Retrieval Prof. Dr. Ralf Möller Universität zu Lübeck Institut für Informationssysteme Karsten Martiny.
Introduction to Information Retrieval CSE 538 MRS BOOK – CHAPTER VI SCORING, TERM WEIGHTING AND THE VECTOR SPACE MODEL 1.
1 Information Retrieval LECTURE 1 : Introduction.
Lecture 6: Scoring, Term Weighting and the Vector Space Model
Information Retrieval Techniques MS(CS) Lecture 7 AIR UNIVERSITY MULTAN CAMPUS Most of the slides adapted from IIR book.
Information Retrieval and Web Search IR models: Vector Space Model Instructor: Rada Mihalcea [Note: Some slides in this set were adapted from an IR course.
Xiaoying Gao Computer Science Victoria University of Wellington COMP307 NLP 4 Information Retrieval.
Introduction to Information Retrieval Introduction to Information Retrieval Lecture 9: Scoring, Term Weighting and the Vector Space Model.
Web Information Retrieval
Web-Mining Agents Cooperating Agents for Information Retrieval Prof. Dr. Ralf Möller Universität zu Lübeck Institut für Informationssysteme Karsten Martiny.
Information Retrieval and Web Search IR models: Vector Space Model Term Weighting Approaches Instructor: Rada Mihalcea.
CS315 Introduction to Information Retrieval Boolean Search 1.
3: Search & retrieval: Structures. The dog stopped attacking the cat, that lived in U.S.A. collection corpus database web d1…..d n docs processed term-doc.
Introduction to Information Retrieval Introduction to Information Retrieval CS276: Information Retrieval and Web Search Pandu Nayak and Prabhakar Raghavan.
IR 6 Scoring, term weighting and the vector space model.
Plan for Today’s Lecture(s)
Information Retrieval and Web Search
Ch 6 Term Weighting and Vector Space Model
Basic Information Retrieval
Representation of documents and queries
Introduction to Search Engines
CS276: Information Retrieval and Web Search
Presentation transcript:

Lecture 5 Term and Document Frequency CS 6633 資訊檢索 Information Retrieval and Web Search 資電 125 Based on ppt files by Hinrich Schütze

This lecture Parametric and field searches Zones in documents Scoring documents: zone weighting Index support for scoring Term weighting

Parametric search Documents have text (data) and metadata (data about data) Metadata: a set of field-value pairs Examples Language = French Format = pdf Subject = Physics etc. Date = Feb 2000 Parametric search interface Combine a full-text query with selection of value for some fields

Fixed field values or range Parametric search example

Full-text search

Parametric/field search In these examples, we select field values Values can be hierarchical, e.g., Geography: Continent  Country  State  City Domain: tw, edu.tw, nthu.edu.tw Use field/value to navigate through the document collection, e.g., “Aerospace companies in Brazil” Select Geography = Brazil Select Line of Business = Aerospace Use fields to filter docs and run text searches to narrow down

Index support for field search Must be able to support queries of the form Find pdf documents that contain “stanford university” A field selection (on doc format) and a phrase query Field selection – use inverted index of field values  docids Organized by field name Use compression

Parametric index support Optional features Wildcards (Author = s*trup) Range: Date between 2003 and 2005 Use B-tree Use query optimization heuristics Process the part that has a small df first

Zones A zone is an identified region within a doc E.g., Title, Abstract, Bibliography Generally culled from marked-up input or document metadata (e.g., powerpoint) Zones contain free text Not database field with a “finite” vocabulary Indexes for each zone - allow queries like sorting in Title AND smith in Bibliography AND recur* in Body Not queries like “all papers whose authors cite themselves”: Why?

One index per zone Title AuthorBody etc.

Comparing information retrieval and database query? Databases do lots of things we don’t need Transactions Recovery (our index is not the system of record; if it breaks, simply reconstruct from the original source) Indeed, we never have to store text in a search engine – only indexes In information retrievl, we focuse on Optimize indexes for text-oriented queries Not an SQL command (matching field with value)

Scoring and Ranking

Scoring The nature of Boolean queries Docs either match or not: score of 0 and 1 Do people like Boolean queries Experts with good understanding of needs and the doc collection can use Boolean query effectively Difficult for casual users Good for small collections For large collections (the Web), search results can be thousands of documents Difficult to go through thousands of results

Scoring We wish to return ranked results where the most likely documents are placed at the top How can we rank order the docs in the corpus with respect to a query? Give each document a score in [0,1] for the query Assume a perfect world without (keyword) spammers No stuffing keywords into a doc to make it match queries Will talk about “adversarial IR” (in Web Search part)

Linear zone combinations First generation of scoring methods Use a linear combination of Booleans: e.g. Score = 0.6* + 0.3* * * Each expression (keyword, e.g. ) is given a value in [0,1]  overall score is in [0,1] AND queries will still return doc’s when one keyword matches something (like OR query)

Linear zone combinations How to generates weights such as 0.6? The user? The IR system Mathematical model for weights and ranking Term frequency Document frequency

Exercise Query = bill OR rights bill rights bill rights bill rights Author Title Body

Combining Boolean and Ranking Perform Boolean query processing (AND query) Process keywords in query order by df desc Merge posting lists for keywords Stop when have more doc’s than necessary Instead of score 1 for all doc’s, give each doc a new score for ranking Keyword with small df is more important Doc with high tf is more relevant

General idea Assign a score to each doc/keyword Given a weight vector with a weight for each zone/field. Combine weights of keyword and zones/fields Present the top K highest-scoring docs K = 10, 20, 50, 100

Index support for zone combinations One index per zone Alternative one single index Qualify term with zone in dictionary E.g., The above scheme is still wasteful Each term is potentially replicated for each zone bill.author bill.title bill.body

Zone combinations index Yet another alternative Encode the zone in the postings as numbers At query time, merge postings and Match zone in query and postings Accumulate from matched zones bill 1.author, 1.body2.author, 2.body3.title

bill 1.author, 1.body2.author, 2.body3.title rights 3.title, 3.body5.title, 5.body Score accumulation As we walk the postings for the query bill OR rights, we accumulate scores for each doc in a linear merge as before. Note: we get both bill and rights in the Title field of doc 3, but score it no higher. Should we give more weight to more hits?

Where do these weights come from? Machine learned relevance Given A test corpus A suite of test queries A set of relevance judgments Learn a set of weights such that relevance judgments matched Can be formulated as ordinal regression More in next week’s lecture

Full text queries We just scored the Boolean query bill OR rights Most users more likely to type bill rights or bill of rights (free text query without Boolean connectives) Interpret such queries as AND (large collection) or OR (small collection) Google uses AND as default Yahoo! probably OR: match doc’s with missing keywords

Full text queries Combining zone with free text queries, we need A way of assigning a score to a pair Zero query terms in the zone should mean a zero score More query terms in the zone should mean a higher score Scores are in [0,1] Will look at some alternatives now

Incidence matrices Recall: Document (or a zone in it) is binary vector X in {0,1} v Query is a vector Score: Overlap measure (count of keyword hits)

Example On the query ides of march, Shakespeare’s Julius Caesar has a score of 3 All other Shakespeare plays have a score of 2 (because they contain march) or 1 Thus in a rank order, Julius Caesar would come out tops

Overlap matching What’s wrong with the overlap measure? It doesn’t consider: Term frequency in document Term specificity in collection (document frequency): of is more common than ides or march Length of documents Longer doc’s have advantage

Overlap matching One can normalize in various ways: Jaccard coefficient: Cosine measure: What documents would score best using Jaccard against a typical query? Does the cosine measure fix this problem?

Scoring: density-based Thus far: position and overlap of terms in a doc or zones (title, author) Intuitively, if a document talks about a keyword more Thee doc is more relevant Even when we only have a single query term Document relevant if it has a lot of instances This leads to the idea of term weighting.

Term weighting

Term-document count matrices Consider the number of occurrences of a term in a document: Bag of words model Document is a vector in ℕ v : a column below

Bag of words view of a doc Thus the doc John is quicker than Mary. is indistinguishable from the doc Mary is quicker than John. Which of the indexes discussed distinguish these two docs?

Counts vs. frequencies Consider again the ides of march query. Julius Caesar has 5 occurrences of ides No other play has ides march occurs in over a dozen All the plays contain of By frequency-based scoring measure The top-scoring play is likely to be the one with the most ofs

Digression: terminology WARNING: In a lot of IR literature, “frequency” is used to mean “count” Thus term frequency in IR literature is used to mean number of occurrences in a doc Not divided by document length (which would actually make it a frequency) We will conform to this misnomer In saying term frequency we mean the number of occurrences of a term in a document.

Term frequency tf Long docs are favored because they’re more likely to contain query terms Can fix this to some extent by normalizing for document length But is raw tf the right measure?

Weighting term frequency: tf What is the relative importance of 0 vs. 1 occurrence of a term in a doc 1 vs. 2 occurrences 2 vs. 3 occurrences … Unclear: while it seems that more is better, may be not proportionally better Can just use raw tf Another option commonly used in practice: W = 0 if tf = 0 W = 1+ log ti if tf > 0

Score computation Score for a query q = sum over terms t in q: [Note: 0 if no query terms in document] This score can be zone-combined Can use wf instead of tf in the above Still doesn’t consider term scarcity in collection (ides is rarer than of)

Weighting should depend on the term overall Which of these tells you more about a doc? 10 occurrences of hernia? 10 occurrences of the? Would like to lower the weight of a common term But what is “common”? Suggest looking at collection frequency (cf ) The total number of occurrences of the term in the entire collection of documents

Document frequency But document frequency (df ) may be better: df = number of docs in the corpus containing the term Wordcfdf ferrari insurance Document/collection frequency weighting is only possible in known (static) collection. So how do we make use of df ?

tf x idf term weights tf x idf measure combines: term frequency (tf ) or wf, some measure of term density in a doc inverse document frequency (idf ) measure of informativeness of a term: its rarity across the whole corpus could just be raw count of number of documents the term occurs in (idf i = 1/df i ) but by far the most commonly used version is: See Kishore Papineni, NAACL 2, 2002 for theoretical justification

Summary: tf x idf (or tf.idf) Assign a tf.idf weight to each term i in each document d Increases with the number of occurrences within a doc Increases with the rarity of the term across the whole corpus What is the wt of a term that occurs in all of the docs?

Real-valued term-document matrices Function (scaling) of count of a word in a document: Bag of words model Each is a vector in ℝ v Here log-scaled tf.idf Note can be >1!

Documents as vectors Each doc j can now be viewed as a vector of wf  idf values, one component for each term So we have a vector space terms are axes docs live in this space may have 20,000+ dimensions (even with stemming) (The corpus of documents gives us a matrix, which we could also view as a vector space in which words live – transposable data)

Recap We began by looking at zones in scoring Ended up viewing documents as vectors in a vector space We will pursue this view next time.