Learn R Programming

Rlda (version 0.2.6)

rlda.binomialVB: LDA with binomial entry and Stick-Breaking prior and Variational Inference.

Description

This method implements the Latent Dirichlet Allocation with Stick-Breaking prior for binomial data with Variational Inference. rlda.binomialVB works with frequency data.frame.

Usage

rlda.binomialVB(data, loc.id, n_community, alpha0, alpha1,
  gamma, maxit=1000, thresh=0.0001)

Arguments

data

A abundance data.frame where each row is a sampling unit (i.e. Plots, Locations, Time, etc.) and each column is a categorical type of element (i.e. Species, Firms, Issues, etc.).

loc.id

ID variable in data.frame.

n_community

Total number of communities to return. It must be less than the total number of columns inside the data.

alpha0

Hyperparameter associated with the Beta prior Beta(alpha0, alpha1).

alpha1

Hyperparameter associated with the Beta prior Beta(alpha0, alpha1).

gamma

Hyperparameter associated with the Stick-Breaking prior.

maxit

Maximum number of iterations.

thresh

Threshold for ELBO convergence.

Value

A R List with three elements:

Theta

The individual probability for each observation (ex: location) belong in each cluster (ex: community). It is a matrix with dimension equal n_gibbs by nrow(data) * n_community

Phi

The individual probability for each variable (ex: Specie) belong in each cluster (ex: community). It is a matrix with dimension equal n_gibbs by ncol(data) * n_community

ELBO

The vector ofELBO compute for each iteration.

Details

rlda.binomialVB uses a modified Latent Dirichlet Allocation method to construct Mixed-Membership Clusters using Bayesian Variational Inference. The data must be a non-empty data.frame with the frequencies for each variable (column) in each observation (row).

References

  • Blei, David M., Andrew Y. Ng, and Michael I. Jordan. "Latent dirichlet allocation." Journal of machine Learning research 3.Jan (2003): 993-1022. http://www.jmlr.org/papers/volume3/blei03a/blei03a.pdf

  • Valle, Denis, et al. "Decomposing biodiversity data using the Latent Dirichlet Allocation model, a probabilistic multivariate statistical method." Ecology letters 17.12 (2014): 1591-1601.

See Also

rlda.multinomial, rlda.bernoulli

Examples

Run this code
# NOT RUN {
	
# }
# NOT RUN {
		library(Rlda)
		# Set seed
		set.seed(5874)
		# Hyperparameters for each prior distribution
		gamma  <- 0.01
		alpha0 <- 0.01
		alpha1 <- 0.01
		# Execute the LDA for the Binomial entry
		res<- rlda.binomialVB(data=tmp, loc.id='loc.id', n_community=10,
		alpha0=0.01, alpha1=0.99, gamma=0.1, maxit=100, thresh=0.0001)
	
# }

Run the code above in your browser using DataLab