InferenceDeciderCalibration class final

How an inference decider (InferenceModel.createDecider) turns its option scores into probabilities, and when it abstains.

The values are fitted OFFLINE, for one model, one question and one option list, and mean nothing for another. A model tuned by LiteTune carries them in its file: pass InferenceDeciderCalibration.fromModel to use them, so the app keeps working when the model is retrained and its values change. Values given explicitly pin the call to one build of the model: createDecider refuses them with ArgumentError unless they are the file's, as it refuses one out of range before anything else.

Annotations

Constructors

InferenceDeciderCalibration({double? temperature, double? abstainBelow, String? noneOption})
The values given here, which must be the ones the model file carries. A file threshold of 0 (only the none option abstains) is abstainBelow: null.
const
InferenceDeciderCalibration.fromModel()
The temperature, threshold and none option the model file carries. The call then needs only the question and the options; the none option may be left out of them, and the decider lists it last.
const

Properties

abstainBelow → double?
A probability in (0, 1): the decider abstains (AbstainReason.belowThreshold, with the signal AbstainSignalKind.topProbability) when the top probability is below it — unless noneOption ranked first, which is checked before it. Needs temperature.
final
fromModelFile → bool
Whether the values come from the model file (InferenceDeciderCalibration.fromModel); the three members below are then null.
final
hashCode → int
The hash code for this object.
no setterinherited
noneOption → String?
The id of the option the model was trained to give for "none of these"; it must be one of the options. When it ranks first the decider abstains with AbstainReason.noneOption, whatever abstainBelow says: the model answered "none of these", which is the more specific reason.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
temperature → double?
The softmax temperature T (positive, finite): the answer's probabilities are softmax(s / T) over the options, with a confidence.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited