pub struct StreamingMamba { /* private fields */ }Expand description
Streaming Mamba model implementing StreamingLearner.
Combines a selective SSM for temporal feature extraction with an RLS readout layer. The SSM processes each input as a timestep, evolving hidden state to capture temporal dependencies. The RLS layer learns a linear mapping from SSM outputs to the regression target.
§Example
use irithyll::ssm::{StreamingMamba, MambaConfig};
use irithyll::learner::StreamingLearner;
let config = MambaConfig::builder()
.d_in(3)
.n_state(8)
.build()
.unwrap();
let mut model = StreamingMamba::new(config);
// Train on a stream of 3-dimensional features
for i in 0..100 {
let x = [i as f64 * 0.1, (i as f64).sin(), 1.0];
let y = x[0] + 0.5 * x[1];
model.train(&x, y);
}
let pred = model.predict(&[10.0, 0.0, 1.0]);
assert!(pred.is_finite());Implementations§
Source§impl StreamingMamba
impl StreamingMamba
Sourcepub fn new(config: MambaConfig) -> Self
pub fn new(config: MambaConfig) -> Self
Create a new streaming Mamba model from the given configuration.
Initializes the SSM with random weights (seeded by config.seed) and
an RLS readout with the specified forgetting factor and P matrix scale.
Sourcepub fn config(&self) -> &MambaConfig
pub fn config(&self) -> &MambaConfig
Get a reference to the model configuration.
Sourcepub fn last_features(&self) -> &[f64]
pub fn last_features(&self) -> &[f64]
Get the cached SSM output features from the last training step.
Trait Implementations§
Source§impl StreamingLearner for StreamingMamba
impl StreamingLearner for StreamingMamba
Source§fn train_one(&mut self, features: &[f64], target: f64, weight: f64)
fn train_one(&mut self, features: &[f64], target: f64, weight: f64)
Train on a single observation with explicit sample weight. Read more
Source§fn predict(&self, features: &[f64]) -> f64
fn predict(&self, features: &[f64]) -> f64
Predict the target for the given feature vector. Read more
Source§fn n_samples_seen(&self) -> u64
fn n_samples_seen(&self) -> u64
Total number of observations trained on since creation or last reset.
Auto Trait Implementations§
impl Freeze for StreamingMamba
impl RefUnwindSafe for StreamingMamba
impl Send for StreamingMamba
impl Sync for StreamingMamba
impl Unpin for StreamingMamba
impl UnsafeUnpin for StreamingMamba
impl UnwindSafe for StreamingMamba
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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