R/predictive.distribution.R

predictive.distribution <-
function (document_sums, topics, alpha, eta) 
{
    smoothed.topics <- (topics + eta)/rowSums(topics + eta)
    apply(document_sums, 2, function(x) {
        props <- (x + alpha)/sum(x + alpha)
        colSums(props * smoothed.topics)
    })
}

Try the lda package in your browser

Any scripts or data that you put into this service are public.

lda documentation built on May 1, 2019, 10:34 p.m.