Ken recommends you use textmodel_affinity instead.

affinity(p, x, smooth = 0.5, verbose = FALSE)

Arguments

p

word likelihoods within classes, estimated from training data

x

term-document matrix for document(s) to be scaled

smooth

a misnamed smoothing parameter, either a scalar or a vector equal in length to the number of documents

Value

a list with stuff

Examples

p <- matrix(c(c(5/6, 0, 1/6), c(0, 4/5, 1/5)), nrow = 3, dimnames = list(c("A", "B", "C"), NULL)) theta <- c(.2, .8) q <- drop(p %*% theta) x <- 2 * q (fit <- affinity(p, x))
#> $coefficients #> [1] 0.3132801 #> #> $se #> [1] 0.2853958 #> #> $cov #> , , 1 #> #> [,1] [,2] #> [1,] 0.08145075 -0.08145075 #> [2,] -0.08145075 0.08145075 #> #> #> $smooth #> [1] 0.5 0.5 #> #> $support #> A B C #> TRUE TRUE TRUE #>