Skip to contents

sum over D_train of log P_T5(T | T(x_in, y)). A probability of 0 is refused rather than returned as -Inf.

Usage

morie_kamath_ch3_t5_template_obj(D_train, T, T5)

Arguments

D_train

List of list(x_in, y) pairs.

T

Template (function of (x_in, y) or a sprintf-free string with {x}/{y}).

T5

Function (T, filled) -> probability in (0, 1].

Value

List with estimate, per_example, filled_inputs.

Examples

morie_kamath_ch3_t5_template_obj(list(list("g m", "pos"), list("a m",
    "neg")), "{x} It was {y}", function(T, s) 0.5)
#> $estimate
#> [1] -1.386294
#> 
#> $per_example
#> [1] -0.6931472 -0.6931472
#> 
#> $filled_inputs
#> [1] "g m It was pos" "a m It was neg"
#> 
#> $n
#> [1] 2
#> 
#> $method
#> [1] "T5 template generation objective (Kamath Eq 3.11)"
#>