# This file was generated by Rcpp::compileAttributes
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#' LDA: Variational EM
#'
#' This implements the variational inference algorithm for the LDA (full
#' Bayesian) model. This includes optimization routines for both \eqn{\alpha}
#' and \eqn{\eta} hyperparameters.
#'
#' References:
#' * Latent Dirichlet Allocation. D. Blei, A. Ng, M.I. Jordan (2003)
#'
#' @param num_topics Number of topics in the corpus
#' @param vocab_size Vocabulary size
#' @param docs_tf A list of corpus documents read from the Blei corpus using
#' \code{\link{read_docs}} (term indices starts with 0)
#' @param alpha_h Hyperparameter for \eqn{\theta} sampling
#' @param eta_h Smoothing parameter for the \eqn{\beta} matrix
#' @param vi_max_iter Maximum number of iterations for variational inference
#' @param em_max_iter Maximum number of iterations for variational EM
#' @param vi_conv_threshold Convergence threshold for the document variational
#' inference loop
#' @param em_conv_threshold Convergence threshold for the variational EM loop
#' @param estimate_alpha If true, run hyperparameter \eqn{\alpha} optimization
#' @param estimate_eta If true, run hyperparameter \eqn{\eta} optimization
#' @param verbose from {0, 1, 2}
#'
#' @return TBA
#'
#' @export
#'
#' @family Variational Inference
#'
#' @note Created on April 26, 2016
#'
lda_vem <- function(num_topics, vocab_size, docs_tf, alpha_h, eta_h, vi_max_iter, em_max_iter, vi_conv_thresh, em_conv_thresh, estimate_alpha, estimate_eta, verbose) {
.Call('ldavem_lda_vem', PACKAGE = 'ldavem', num_topics, vocab_size, docs_tf, alpha_h, eta_h, vi_max_iter, em_max_iter, vi_conv_thresh, em_conv_thresh, estimate_alpha, estimate_eta, verbose)
}
#' A speedy sampling from a multimomial distribution
#'
#' @param theta a multinomial probability vector (K x 1 vector)
#'
#' @return returns a class index from [0, K)
#'
#' @note
#' Author: Clint P. George
#'
#' Created on: February 11, 2016
#'
#' @family utils
#'
#' @export
sample_multinomial <- function(theta) {
.Call('ldavem_sample_multinomial', PACKAGE = 'ldavem', theta)
}
#' Samples from a Dirichlet distribution given a hyperparameter
#'
#' @param num_elements the dimention of the Dirichlet distribution
#' @param alpha the hyperparameter vector (a column vector)
#'
#' @return returns a Dirichlet sample (a column vector)
#'
#' @note
#' Author: Clint P. George
#'
#' Created on: 2014
#'
#' @family utils
#'
#' @export
sample_dirichlet <- function(num_elements, alpha) {
.Call('ldavem_sample_dirichlet', PACKAGE = 'ldavem', num_elements, alpha)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.