Exemplo n.º 1
0
def runBatchVB(workQueue, lockingPost):
    for (W, K, docs, alpha, maxiters, thr, hbb) in iter(workQueue.get, "none"):
        #read current parameter value (and copy)
        lam = copy.deepcopy(lockingPost.value())
        #calculate correction
        batchVB = batchvb.BatchLDA(W, K, docs, alpha, lam, useHBBBound=hbb)
        lam = batchVB.train(maxiters, thr)
        ss = (lam - batchVB._eta)
        #apply correction
        lockingPost.increment(ss)
        workQueue.task_done()
def runBatchVB(W, K, docs, alpha, lam, maxiters, thr, hbb):
    batchVB = batchvb.BatchLDA(W, K, docs, alpha, lam, useHBBBound=hbb)
    lam = batchVB.train(maxiters, thr)
    return lam
Exemplo n.º 3
0
def getSuffStats(vocab, K, docs, alpha, lam):
        batchVB = batchvb.BatchLDA(vocab, K, docs, alpha, lam)
        batchVB.set_lambda(copy.deepcopy(lam))
        return batchVB.do_e_step()
Exemplo n.º 4
0
 def update_lambda(self, docs):
     batchVB = batchvb.BatchLDA(self._W, self._K, docs, self._alpha, self._lambda, self._useHBBBound)
     self._lambda = batchVB.train(self._maxiters, self._threshold) #1E-4)
     return (self._alpha,self._lambda)