
Pseudo-log-likelihood and CrowS-Pairs (Kamath Eq 6.10-6.11)
Source:R/kamath_llm2_native.R
morie_kamath_ch6_pll.RdPseudo-log-likelihood and CrowS-Pairs (Kamath Eq 6.10-6.11)
Details
One core serves both Python modules exactly as km087 calls
km086: km086 -> morie_kamath_ch6_pll (sum of log P(token | rest)),
km087 -> morie_kamath_ch6_cps_metric (the same sum over the unmodified
tokens, conditioned on the modified ones). theta receives 0-BASED
positions.
Examples
morie_kamath_ch6_pll(c(0.5, 0.25, 0.5))
#> $estimate
#> [1] -2.772589
#>
#> $per_token
#> [1] -0.6931472 -1.3862944 -0.6931472
#>
#> $n
#> [1] 3
#>
#> $method
#> [1] "pseudo-log-likelihood (Kamath Eq 6.10)"
#>