pub struct StreamingKAN {
pub rolling_loss: f64,
/* private fields */
}Expand description
Streaming KAN model with online B-spline learning.
Processes one sample at a time. Each edge in the network learns a univariate B-spline activation function via per-sample SGD. Online Welford normalization ensures stable input distribution.
§Example
use irithyll::kan::{StreamingKAN, KANConfig};
use irithyll::StreamingLearner;
let config = KANConfig::builder()
.layer_sizes(vec![3, 10, 1])
.learning_rate(0.1)
.build()
.unwrap();
let mut model = StreamingKAN::new(config);
model.train(&[1.0, 2.0, 3.0], 4.0);
let pred = model.predict(&[1.0, 2.0, 3.0]);Fields§
§rolling_loss: f64EWMA of squared prediction error for uncertainty-modulated learning.
Implementations§
Source§impl StreamingKAN
impl StreamingKAN
Sourcepub fn layer_sizes(&self) -> &[usize]
pub fn layer_sizes(&self) -> &[usize]
The layer sizes from the config.
Sourcepub fn input_importances(&self) -> Vec<f64>
pub fn input_importances(&self) -> Vec<f64>
Per-input feature importance from layer 0 B-spline coefficient magnitudes.
For each input i, sums |coefficient| across all output edges and all
n_coeffs = grid_size + spline_order coefficients per edge. Inputs whose
edges accumulate larger spline weight after training rank higher.
Returns un-normalized scores (length = layer_sizes()[0]); the caller
should sum-normalize for display. Returns empty if the model has no
layers (impossible in normal use — new() requires layer_sizes.len() >= 2).
Trait Implementations§
Source§impl Debug for StreamingKAN
impl Debug for StreamingKAN
Source§impl DiagnosticSource for StreamingKAN
impl DiagnosticSource for StreamingKAN
Source§fn config_diagnostics(&self) -> Option<ConfigDiagnostics>
fn config_diagnostics(&self) -> Option<ConfigDiagnostics>
None if not supported.Source§impl StreamingLearner for StreamingKAN
impl StreamingLearner for StreamingKAN
Source§fn train_one(&mut self, features: &[f64], target: f64, weight: f64)
fn train_one(&mut self, features: &[f64], target: f64, weight: f64)
Source§fn predict(&self, features: &[f64]) -> f64
fn predict(&self, features: &[f64]) -> f64
Source§fn n_samples_seen(&self) -> u64
fn n_samples_seen(&self) -> u64
Source§fn train(&mut self, features: &[f64], target: f64)
fn train(&mut self, features: &[f64], target: f64)
Auto Trait Implementations§
impl Freeze for StreamingKAN
impl RefUnwindSafe for StreamingKAN
impl Send for StreamingKAN
impl Sync for StreamingKAN
impl Unpin for StreamingKAN
impl UnsafeUnpin for StreamingKAN
impl UnwindSafe for StreamingKAN
Blanket Implementations§
impl<T> Allocation for T
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