Beispiel #1
0
    def __init__(self, docs, K, alpha, eta):
        LDA.__init__(self, docs, K, alpha, eta)

        ### Gibbs sampler related data structures ###

        # C_VK[w,k] := number of times word w is assigned to topic k
        self.C_VK = np.zeros((self.V, self.K), dtype=int)
        # C_DK[d,k] := number of times topic k is present in document d
        self.C_DK = np.zeros((self.D, self.K), dtype=int)

        # Cache these values as we go (equivalent to performing column sums for above matrices)
        # For each document, total number of topics assigned
        self.total_topics_per_doc = np.zeros(self.D)
        # For each topic, total number of words assigned to it
        self.total_words_per_topic = np.zeros(self.K)

        # Save results here
        self.log_prob = []
        self.samples = []
 def __init__(self, n_topics, alpha=0.1, beta=0.01, random_state=0):
     LDA.__init__(self, n_topics, alpha=0.1, beta=0.01, random_state=0)
 def __init__(self, n_topics, alpha=0.1, beta=0.01, random_state=0):
     LDA.__init__(self, n_topics, alpha=0.1, beta=0.01, random_state=0)