Vector space model or term vector model is an algebraic model for representing text documents (or more generally, items) as vectors such that the distance between vectors represents the relevance between the documents. It is used in information filtering, information retrieval, indexing and relevancy rankings. Its first use was in the SMART Information Retrieval System.[1]
In this section we consider a particular vector space model based on the bag-of-words representation. Documents and queries are represented as vectors.
dj=(w1,j,w2,j,...c,wn,j)
q=(w1,q,w2,q,...c,wn,q)
Each dimension corresponds to a separate term. If a term occurs in the document, its value in the vector is non-zero. Several different ways of computing these values, also known as (term) weights, have been developed. One of the best known schemes is tf-idf weighting (see the example below).
The definition of term depends on the application. Typically terms are single words, keywords, or longer phrases. If words are chosen to be the terms, the dimensionality of the vector is the number of words in the vocabulary (the number of distinct words occurring in the corpus).
Vector operations can be used to compare documents with queries.[2]
Candidate documents from the corpus can be retrieved and ranked using a variety of methods. Relevance rankings of documents in a keyword search can be calculated, using the assumptions of document similarities theory, by comparing the deviation of angles between each document vector and the original query vector where the query is represented as a vector with same dimension as the vectors that represent the other documents.
In practice, it is easier to calculate the cosine of the angle between the vectors, instead of the angle itself:
\cos{\theta}=
| |||
|
Where
d2 |
⋅ q
\left\|
d2 |
\right\|
\left\|q\right\|
\left\|q\right\|=
n | |
\sqrt{\sum | |
i=1 |
2} | |
q | |
i |
Using the cosine the similarity between document dj and query q can be calculated as:
cos(dj,q)=
| |||
|
=
| ||||||||||||||
|
\sqrt{\sum
N | |
i=1 |
2}} | |
q | |
i |
As all vectors under consideration by this model are element-wise nonnegative, a cosine value of zero means that the query and document vector are orthogonal and have no match (i.e. the query term does not exist in the document being considered). See cosine similarity for further information.
In the classic vector space model proposed by Salton, Wong and Yang [3] the term-specific weights in the document vectors are products of local and global parameters. The model is known as term frequency-inverse document frequency model. The weight vector for document d is
vd=[w1,d,w2,d,\ldots,wN,d]T
wt,d=tft,d ⋅ log{
|D| | |
|\{d'\inD|t\ind'\ |
|}}
and
tft,d
log{ | |D| |
|\{d'\inD|t\ind'\ |
|}}
|D|
|\{d'\inD|t\ind'\}|
The vector space model has the following advantages over the Standard Boolean model:
Most of these advantages are a consequence of the difference in the density of the document collection representation between Boolean and term frequency-inverse document frequency approaches. When using Boolean weights, any document lies in a vertex in a n-dimensional hypercube. Therefore, the possible document representations are
2n
\sqrt{n}
The vector space model has the following limitations:
Many of these difficulties can, however, be overcome by the integration of various tools, including mathematical techniques such as singular value decomposition and lexical databases such as WordNet.
Models based on and extending the vector space model include:
The following software packages may be of interest to those wishing to experiment with vector models and implement search services based upon them.