pub struct StateTrajectory { /* private fields */ }Expand description
Records and analyses the trajectory of hidden states over time.
Implementations§
Source§impl StateTrajectory
impl StateTrajectory
Sourcepub fn push(&mut self, state: Array1<f32>) -> ModelResult<()>
pub fn push(&mut self, state: Array1<f32>) -> ModelResult<()>
Append a state vector; returns an error on dimension mismatch.
Sourcepub fn velocities(&self) -> ModelResult<Vec<f32>>
pub fn velocities(&self) -> ModelResult<Vec<f32>>
Compute per-step velocities: ||s_{t+1} - s_t||_2 for t in 0..len-1.
Returns an error if fewer than 2 states have been recorded.
Sourcepub fn participation_ratio(&self) -> ModelResult<f32>
pub fn participation_ratio(&self) -> ModelResult<f32>
Effective dimensionality via participation ratio.
PR = (Σ λ_i)² / Σ λ_i² where λ_i are per-dimension variances. A high value means the state uses many dimensions; a low value means information is concentrated in a few dimensions.
Sourcepub fn most_variable_dims(&self, k: usize) -> ModelResult<Vec<usize>>
pub fn most_variable_dims(&self, k: usize) -> ModelResult<Vec<usize>>
Return indices of the k dimensions with highest variance, sorted descending.
Sourcepub fn autocorrelation(&self, lag: usize) -> ModelResult<f32>
pub fn autocorrelation(&self, lag: usize) -> ModelResult<f32>
Compute state autocorrelation at lag lag.
Returns the mean Pearson correlation of s_t and s_{t+lag} across all
valid pairs. A lag-0 autocorrelation is always 1.0.
Sourcepub fn to_matrix(&self) -> ModelResult<Array2<f32>>
pub fn to_matrix(&self) -> ModelResult<Array2<f32>>
Flatten all states into an (num_steps, dim) matrix.
Auto Trait Implementations§
impl Freeze for StateTrajectory
impl RefUnwindSafe for StateTrajectory
impl Send for StateTrajectory
impl Sync for StateTrajectory
impl Unpin for StateTrajectory
impl UnsafeUnpin for StateTrajectory
impl UnwindSafe for StateTrajectory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more