Skip to contents

[experimental] Compute variance ratios with different hyper-parameters

Usage

optimize_lss(x, ...)

Arguments

x

a fitted textmodel_lss object.

...

additional arguments passed to bootstrap_lss.

Details

optimize_lss() computes variance ratios with different values of hyper-parameters using bootstrap_lss. The variance ration \(v\) is defined as $$v = \sigma^2_{documents} / \sigma^2_{words}.$$ It maximizes when the model best distinguishes between the documents on the latent scale.

Examples

if (FALSE) {
# the unit of analysis is not sentences
dfmt_grp <- dfm_group(dfmt)

# choose best k
v1 <- optimize_lss(lss, what = "k", from = 50,
                   newdata = dfmt_grp, verbose = TRUE)
plot(names(v1), v1)

# find bad seed words
v2 <- optimize_lss(lss, what = "seeds", remove = TRUE,
                   newdata = dfmt_grp, verbose = TRUE)
barplot(v2, las = 2)
}