BTM Learning Little Mind

Source: Internet
Author: User

The principle of BTM is very similar to LDA, and here is the probability plot for the model:

It can be seen from the graph that the difference between the LDA is to determine the topic distribution and Word distribution corresponding to take two words (and LDA only one, that is, the analogy of the common dice: the first throw K-face dice to get the theme Z, and then according to the corresponding V-face dice, throw two times, get a pair of vocabulary ), these two words are called biterm(that is, after a document word breaker, the set of these words a distance indicator, from the first to the J words between 22 pairs, can be regarded as a pair of biterm). Get the Biterm code from the original document as follows:

def build_biterms (self, sentence):

"""

Get biterms of document

:P Aram Sentence:word ID list sentence is the ID of each word after the word is cut

: Return:biterm List

"""

Win = # set window size

Biterms = []

For i in xrange (len (sentence)-1):

For J in xrange (i+1, min (i+win+1, len (sentence))):

Biterms.append (biterm (int (sentence[i)),Int (sentence[j] ))

Return biterms

BTM uses the entire text set to estimate a theta, which solves the sparse problem (we usually have a huge amount of data). Relaxed the mixture of unigram the entire document must belong to a subject Z (equivalent to two words relaxed from the entire document to the window length), Reinforced the assumption that each word in LDA corresponds to a Z (the two words in BTM that constrain the length of a window make up a biterm corresponds to a z). This hypothesis is very close to human cognition, as we know that topic often changes little in a shorter text.

BTM Learning Little Mind

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.