Expand description
How far a layer trusts one of its estimates.
A Confidence holds a Level, the Reasons behind it and an
optional spread, or states that the layer made no estimate. The level is
stored, not derived: each estimator sets it from its own signals. A
confidence is never one float, because the agent that reads the report
needs the level and the reasons to decide what to override.
The spread is typed: Confidence<Octaves> describes a cutoff whose
spread is in octaves, Confidence<Cents> a unison offset whose spread is
in cents. An estimate that has no spread, such as a menu choice, uses
Confidence<NoSpread>.
In a report a confidence is one JSON object:
{"level": "medium", "reasons": [{"code": "active_frames", "value": 412}], "spread": 0.3, "estimate": true}spread is left out when there is none. A “no estimate” state writes
"estimate": false, no level, no spread and at least one reason.
Deserialization applies the same rules as the constructors.
Structs§
- Confidence
- The confidence of one estimate: a level with an optional spread, or no
estimate. Either state carries at least one
Reason. - Confidence
Error - A
Confidenceor aReasonwhose parts do not fit together. - Estimate
- A value with its confidence. The value is present exactly when the confidence is an estimate.
- Reason
- A reason code with the value of its signal.
Enums§
- Level
- How far an estimator trusts its value. The order is
Low < Medium < High, so a per-layer cap islevel.min(cap). - NoSpread
- The spread type of an estimate that has no spread, such as a menu
choice. It has no values, so a
Confidence<NoSpread>never holds a spread. - Reason
Code - Why an estimator chose its level, or why it made no estimate.
- Signal
- The value of the signal behind a
ReasonCode.