
Prompt-based classification through a label word map (Kamath Eq 3.1)
Source:R/kamath_llm2_native.R
morie_kamath_ch3_prompt_label_mapping.Rdp(y|x) = p(z = M(y) | x'). x is a named numeric vector of answer-word
probabilities (validated to sum to 1); M a named character vector
label -> answer word.
Examples
morie_kamath_ch3_prompt_label_mapping(c(great = 0.7, terrible = 0.3),
"positive", list(positive = "great", negative = "terrible"))
#> $estimate
#> [1] 0.7
#>
#> $label
#> [1] "positive"
#>
#> $answer_word
#> [1] "great"
#>
#> $label_probs
#> positive negative
#> 0.7 0.3
#>
#> $label_mass
#> [1] 1
#>
#> $n
#> [1] 2
#>
#> $method
#> [1] "prompt label word mapping (Kamath Eq 3.1)"
#>