Skip to main content

Occupancy

Struct Occupancy 

Source
pub struct Occupancy { /* private fields */ }
Expand description

How the reference’s probability is spread over the frames.

Implementations§

Source§

impl Occupancy

Source

pub fn num_frames(&self) -> usize

The number of frames.

Source

pub fn num_symbols(&self) -> usize

The number of columns the acoustic model scores.

Source

pub fn frame(&self, frame: usize) -> &[f32]

The posterior of each column in frame, which sums to one.

§Panics

If frame is past the last one.

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for Occupancy

Source§

fn clone(&self) -> Occupancy

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Occupancy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Occupancy

Source§

fn eq(&self, other: &Occupancy) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Occupancy

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.