pub struct Occupancy { /* private fields */ }Expand description
How the reference’s probability is spread over the frames.
Implementations§
Source§impl Occupancy
impl Occupancy
Sourcepub fn num_frames(&self) -> usize
pub fn num_frames(&self) -> usize
The number of frames.
Sourcepub fn num_symbols(&self) -> usize
pub fn num_symbols(&self) -> usize
The number of columns the acoustic model scores.
Sourcepub fn cost(&self) -> f32
pub fn cost(&self) -> f32
-log P(reference | frames): the cost of the whole chain, over every
alignment of it at once.
Always at most Alignment::cost, which
is the cost of the single best alignment. The gap measures probability
mass carried by alternative alignments.
Sourcepub fn label_prior(&self) -> Vec<f32>
pub fn label_prior(&self) -> Vec<f32>
How often each column is the right answer, averaged over the frames.
Sums to one. This is the estimate a CTC model trained with label priors wants: the count is taken over the whole alignment posterior rather than over a hard decision, so a frame the model is unsure about contributes to both readings in proportion.
Sourcepub fn expected_durations(&self) -> &[f32]
pub fn expected_durations(&self) -> &[f32]
The expected number of frames sounding each position.
The soft counterpart of Alignment::spans,
and it answers a question spans cannot: a phone whose span is one frame
but whose expected duration is four is a boundary the acoustics did not
decide, not a short phone.
Sourcepub fn skip_posteriors(&self) -> &[f32]
pub fn skip_posteriors(&self) -> &[f32]
Per position, how much of the probability took the skip transition into it.
Zero everywhere unless the chain allows skipping.
Alignment::skipped reports the
best-path decision; this value reports its posterior confidence.
It is an upper bound on the posterior that a phone got no frames at all,
and not quite the same thing. Skipping into s_i and then holding
phone i is a path the chain allows, and it sounds a phone the skip gave
up. It never wins in the tropical semiring, because waiting at s_{i-1}
and committing a frame later reaches the same cell having sounded the
same phone and costs exactly skip(i) less, so an Alignment never
contains one. In the log semiring nothing is discarded, so those paths
keep their share, which at a skip cost of several nats is a small one.