logLikelihoodLGLFM: Log of the Likelihood from the Linear Gaussian Latent Feature...

Description Usage Arguments Value See Also Examples

View source: R/logLikelihoodLGLFM.R

Description

The log of the likelihood of a feature allocation from the linear Gaussian latent feature model (LGLFM) is computed. The standard deviation of the error term (sdX) may be supplied or the associated precision (precisionX) can be provided instead. Likewise, only one of sdA and precisionA should be supplied.

Usage

1
2
3
4
5
6
7
8
9
logLikelihoodLGLFM(
  featureAllocation,
  X,
  precisionX,
  precisionA,
  sdX,
  sdA,
  implementation = "scala"
)

Arguments

featureAllocation

An N-by-K binary feature allocation matrix.

X

An N-by-D matrix of observed data.

precisionX

The scalar precision of the data error variance. This must be specified if sdX is missing.

precisionA

The scalar precision of a latent feature. This must be specified if sdA is missing.

sdX

The scalar standard deviation of the data error variance. This must be specified if precisionX is missing.

sdA

The scalar precision of a latent feature. This must be specified if precisionA is missing.

implementation

The default of "scala" should be used. The "R" option is not a supported implementation.

Value

A numeric vector giving the log of the likelihood.

See Also

This function is an implementation of the log of Equation (26) in "The Indian Buffet Process: An Introduction and Review" by Griffiths and Ghahramani (2011) in the Journal of Machine Learning.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
 # Regardless of size, the initial warmup can exceed CRAN's 5 seconds threshold
sigx <- 0.1
siga <- 1.0
dimA <- 1
nItems <- 8  # Should be a multiple of 4
Z <- matrix(c(1,0,1,1,0,1,0,0),byrow=TRUE,nrow=nItems,ncol=2)
A <- matrix(rnorm(ncol(Z)*dimA,sd=siga),nrow=ncol(Z),ncol=dimA)
e <- rnorm(nrow(Z)*ncol(A),0,sd=sigx)
X <- Z %*% A + e
logLikelihoodLGLFM(Z, X, sdX=sigx, sdA=siga)

aibd documentation built on June 5, 2021, 1:06 a.m.