logLik.BTM | R Documentation |

Get the likelihood how good biterms are fit by the BTM model

## S3 method for class 'BTM' logLik(object, data = terms.BTM(object, type = "biterms")$biterms, ...)

`object` |
an object of class BTM as returned by |

`data` |
a data.frame with 2 columns term1 and term2 containing biterms. Defaults to the biterms used to construct the model. |

`...` |
other arguments not used |

a list with elements

likelihood: a vector with the same number of rows as

`data`

containing the likelihood of the biterms alongside the BTM model. Calculated as`sum(phi[term1, ] * phi[term2, ] * theta)`

.-
`ll`

the sum of the log of the biterm likelihoods

`BTM`

, `predict.BTM`

, `terms.BTM`

library(udpipe) data("brussels_reviews_anno", package = "udpipe") x <- subset(brussels_reviews_anno, language == "nl") x <- subset(x, xpos %in% c("NN", "NNP", "NNS")) x <- x[, c("doc_id", "lemma")] model <- BTM(x, k = 5, iter = 5, trace = TRUE, detailed = TRUE) fit <- logLik(model) fit$ll

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.