Topic Modelling is essentially a method to find the topics from a document. These topics are set of words which best describe the document. It helps us to understand and organize large amount of information.
In the era of exponentially increasing data, it is very difficult to understand and summarize the large collections of unstructured textual documents. Topic Modelling not only helps to understand the semantics of documents, it also helps to annotate them.
It helps to recover hidden and recurring patterns in texts and can be considered as a text mining tool.
Latent Dirichlet Allocation (LDA)
LDA is a statistical model. Intuition behind LDA is that every document contains some topics and every word in the document is attributable to one of the topics. It is different from PLSA in the idea that every document is a mixture of small number of topics only and each topic contains few words which are used very frequently.
The topic is identified on the basis of likelihood of term co-occurrence. It might happen that a word appearing with probability p in topic A, can occur with probability p’ in topic B in the same document. However, the set of neighbours for the word would be different in both the topics.
LDA is a generative model. To find out the topics in a document, we need to know the number of topics ie value of k.
Working steps :
- Iterative over each word in every document and assign it randomly to one of the k topics
- This random assignment will give us a distribution which will not be accurate
- Until we get an improved static model :
- For each word, w in every document, d, calculate
- p ( topic t | document d) = number of words in doc d with topic t / number of words in document d
- p ( word w | topic t ) = frequency word w is assigned topic t in all docs / number of words assigned topic t in all docs
- Probability that word w would be assigned topic t’ = p(topic t’|doc d)*p(word w|topic t’)
- Thus we have the probability that topic t’ is associated with word w
Number of Topics
But the question arises that how can we find the correct number of topics. We will make use of perplexity in this. We will train our model for a range of number of topics and calculate the perplexity. Where the downward curve makes an elbow bend, it marks the optimum number of topics.
Applications
Topic Modelling finds it application in a range of topics. From information retrieval, networks, genetics, images to bio-informatics, it is not confined to the domain of text analysis anymore.
Its other applications include dimensionality reduction, recommendation systems and text summarisation.
There are a lot of libraries we can use to train our Topic Models. Some of them are :
References :
Comments
Post a Comment