for idx, line in enumerate(lines): label, line = extractContent(line) #Sampling Accounter hamProb = .0 spamProb = .0 #Gibbs Inference for i in xrange(iternum): #sampling theta hamTheta = thetaSample(hamHyper) spamTheta = thetaSample(spamHyper) #get likelihood tokenDict = getTokenList(line) hamLikelihood = getLikelihood(tokenDict, hamTheta, reverseIdx) spamLikelihood = getLikelihood(tokenDict, spamTheta, reverseIdx) #get numerator hamNumerator = hamLikelihood * hamPrior spamNumerator = spamLikelihood * spamPrior normalizer = hamNumerator + spamNumerator + 0.0000000000000000000001 #get probability hamProb += hamNumerator / normalizer spamProb += spamNumerator / normalizer #approximation hamProb /= iternum spamProb /= iternum