# Algorithm to find the probability of a given text to be about a large topic

I want the conditional probability for each topic (being the word that we give as input). For example, the text being

have seen and reviewed your requirements you posted here. If you can give me the fix criteria/category of your data mining then I can do this job. If you want me to define and allot criteria and categorize it in then charges will be extra for per categorization included.

I have seen and reviewed your requirements you posted here. If you can give me the fix criteria/category of your data mining then I can do this job. If you want me to define and allot criteria and categorize it in then charges will be extra for per categorization included.

Assume that I give a word called research as an input, I want to know

What is the likelihood/probability that the text relates to research?


What algorithms we should create to get the above?

-
You can use term frequency–inverse document frequency or one of its variants used in the probabillistic information retrieval models. From Wikipedia: ... A high weight in tf–idf is reached by a high term frequency (in the given document) and a low document frequency of the term in the whole collection of documents; the weights hence tend to filter out common terms. ... –  Vor Oct 9 '12 at 7:38
Are you familiar with the Natural Language Toolkit in Python? –  mac389 Nov 8 '12 at 18:47
A term-frequency model is helpful in itself. The example text, it doesn't even contain the search term. Assuming the OP intends it to have some relevance, you need intermediate text/keywords. So, if you're looking for a statistical model, you'll ned to search the corpus for the term and find related terms or phrases with which to analyze the text block above. –  svidgen Nov 9 '12 at 22:26
Yes, inverse document frequency is the way to go, as @Vor described. However, this question should be in a data mining domain and not computer science. –  user4933 Dec 8 '12 at 18:36
latent dirichlet allocation and topic models –  asd Mar 9 '13 at 23:36

You can try simple probabilistic graphical models, the simplest one being Naive Bayes.

One way to do this would be to represent a portion of text as a word frequency vector, that will be associated with a topic (the "class variable"). Then you use many such texts that are associated with topics to train your model (i.e. you model the probability of a frequency vector given a certain topic). Finally, given a new text you can ask what is the most likely topic assignment.

Naive Bayes, the simplest graphical model, would miss dependencies between the frequencies of the various words, but it is worth a shot as it is easy to implement. More complicated models could be used to capture these dependencies.

-
@Raphael A portion of text can be represented as a word frequency vector, and will be associated with a topic (the "class variable"). Then you use many such texts that are associated with topics to train your model (i.e. you model the probability of a frequency vector given a certain topic). Finally, given a new text you can ask what is the most likely topic assignment. –  Bitwise Mar 10 '13 at 16:06
@Bitwise You should add this in your answer to make it more complete. –  Paresh Mar 10 '13 at 18:33
@Paresh done, thanks. –  Bitwise Mar 10 '13 at 19:38

Try Latent Semantic Analysis or the similar Latent Semantic Indexing which reduces documents to vectors, and typically finds principal components via singular value decomposition, SVD that roughly relate or correspond to intrinsic or latent "subjects". It had major or key success in the Netflix datamining contest. Similarity is computed using vector algebra e.g. the cosine similarity or similar metrics.

-