ChoiceAnswer

data class ChoiceAnswer<K : Any>(val choice: K, val probabilities: Map<K, Double>, val confidence: Double) : Answer(source)

The answer to a Choice: the highest-probability option, the probability of every option, and a confidence from 0 to 1. Confidence is not the winner's probability, but it depends on nothing else: it rescales that probability so that an even split across the options is 0 and certainty is 1. A close runner-up therefore shows only in probabilities; compare the top two entries of ranked to catch a near-tie.

Constructors

Link copied to clipboard
constructor(choice: K, probabilities: Map<K, Double>, confidence: Double)

Properties

Link copied to clipboard
val choice: K
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The largest probability of any option.

Functions

Link copied to clipboard
fun probability(option: K): Double
Link copied to clipboard
fun ranked(): List<Pair<K, Double>>

Options from most to least likely.