Skip to contents

Pseudo-log-likelihood and CrowS-Pairs (Kamath Eq 6.10-6.11)

Usage

morie_kamath_ch6_pll(S, theta = NULL)

morie_kamath_ch6_cps_metric(U, M, theta = NULL)

Arguments

S

Token probabilities, or tokens when theta is given.

theta

Optional function of a 0-based index.

U

Unmodified tokens.

M

Modified tokens.

Value

List with estimate, per_token.

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)"
#>