Skip to main content

Information Retrieval System

Information retrieval (IR) task deals with finding all relevant documents related to user query. Central concepts to IR are removing stop words from corpus (collection of all documents) and query, stemming, lemmatization, representing documents and query to vector, and using some measure of proximity or distance to determine which documents could be relevant to query.

Each word in the document after going through stemming and lemmatization is called term. Each unique term in corpus is represented as one dimension in document space. Thus the vectors representing the documents can have more than 10,000 dimension and thus suffer from high dimensionality. Since not all words occur in each document, documents vectors are very sparse and these words seems to follow Zipf's distribution.

Value of each term in the document vector could be binary (term occur in the document or not), frequency (how often that term is found in the document), or using term frequency-inverse document frequency (TF-IDF).  TF-IDF capture the notion that the terms that uniquely defines a document are given higher weightage then commonly occurring terms in the document.

Both documents in the corpus and user query are represented as high dimension vectors in document space. All these vectors are collected into a matrix with column could be representing terms and rows as documents. Then finding the relevant documents is equivalent to finding those row vectors which are more similar to query vector.

To reduce the dimensionality of document vectors, technique such as Latent Semantic Index (LSI) which is somewhat similar to PCA (principle component analysis applied on covariance matrix) can be applied on term-document frequency matrix.

Similarity measurement can be calcualted using cosine,  Jaccard's, or Dice, some of the common techniques for similarity finding,  to find the relevant documents.

Comments

Popular posts from this blog

UnSupervised Sentimental Analysis

We are using the method where we have a list of positive words and a list of negative words. We use these words to calculate a sentiment score based on whether the sentence contains more of positive or negative words.  The code is in R. List of positive and negative words positive_words <- c('abounded', 'contentment','exceed') negative_words <- c('abolish', 'baseless','caustic') sentence <- c("manufacturing is abounded in St. Louis and exceed the expectation though it abolished traditional industries", "Acme has to deal with baseless and caustic arguments") Normally, we should be reading these sentence from some file, but here we are creating a sample text to show the process categorizing text based on the sentimental score. Convert the sentence into a list of words using str_split function. word_list = str_split(sentence, '\\s+') words = unlist(word_list) The object 'words' ...

Recommender System using Collaborative filtering

Recommender system using collaborative filtering approach uses the past users' behavior to predict what items the current user would like. We create a UxM matrix where U is the number of users and M is the number of different items or products. Uij is the rating expressed by the user-i for product-j. In the real world, not every user expresses an opinion about every product. For example, let us say there are five users including Bob has expressed their opinion about four movies as shown below Table 1: movie1 movie2 movie3 movie4 user1 1 3 3 5 user2 2 4 5 user3 3 2 2 user4 1 3 4 Bob 3 2 5 ?  Our goal is to predict what movies to recommend to Bob, or put it another way should we recommend movie4 to Bob, knowing the rating for four movies from other users including Bob. Traditionally, we could do item to item comparison, which means if the user has liked item1 in the past then that user may like other items similar to item1. Another way to recommend...

Decision Tree

Decision tree is a multi-class classification tool allowing a data point to be classified into one of many (two or more) classes available.  A decision tree divides the sample space into a rectilinear region. This will be more clear with an example. Let us say we have this auto-insurance claim related data as shown in the following table. We want to predict what type of customer profile may more likely lead to claim payout.  The decision tree model may first divide the sample space based on age. So, now we have two regions divided based on the age. Next, one of those regions will further sub-divided based Marital_status, and then that newly divided sub-regision may further get divide based on Num_of_vehicle_owned.  A decision tree is made up of a root node followed by intermediate node and leaf node.  Each leaf node represents one of the class into which data points have been classified to. An intermediate node represents the decision rule based...