Learn R Programming

bbricks (version 0.1.1)

MAP.CatDirichlet: MAP estimate of a "CatDirichlet" object

Description

Generate the MAP estimate of "pi" in following Categorical-Dirichlet structure: pi|alpha ~ Dirichlet(alpha) x|pi ~ Categorical(pi) the model structure and prior parameters are stored in a "CatDirichlet" object. MAP is pi_MAP = argmax p(pi|alpha,x).

Usage

# S3 method for CatDirichlet
MAP(obj, ...)

Arguments

obj

A "CatDirichlet" object.

...

Additional arguments to be passed to other inherited types.

Value

A numeric vector, the MAP estimate of "pi".

References

Murphy, Kevin P. Machine learning: a probabilistic perspective. MIT press, 2012.

See Also

CatDirichlet

Examples

Run this code
# NOT RUN {
obj <- CatDirichlet(gamma=list(alpha=rep(1,26),uniqueLabels = letters))
x <- sample(letters,size = 20,replace = TRUE)
w <- runif(20)
posterior(obj=obj,ss=x,w=w)
MAP(obj)
# }

Run the code above in your browser using DataLab