Skip to contents

exp(mean negative log-likelihood per token).

Usage

morie_kamath_ch8_perplexity(X, N = NULL, p_theta = NULL)

Arguments

X

Tokens.

N

Optional token count.

p_theta

Probability vector or function (token, prefix).

Value

List with estimate, mean_nll, log_probs.

Examples

morie_kamath_ch8_perplexity(c("a", "b"), p_theta = c(0.5, 0.25))
#> $estimate
#> [1] 2.828427
#> 
#> $mean_nll
#> [1] 1.039721
#> 
#> $log_probs
#> [1] -0.6931472 -1.3862944
#> 
#> $n
#> [1] 2
#> 
#> $method
#> [1] "perplexity (Kamath Eq 8.1)"
#>