Example #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
Example #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()
Example #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)