pub struct ParallelSpikingNeuron {
pub weights: Vec<f64>,
pub history: Vec<f64>,
pub v_threshold: f64,
pub hidden: f64,
}Expand description
k-order sliding PSN — Fang et al. (2023), NeurIPS.
Streaming form of the PSN family (paper Eqs. 14–15):
H[t] = sum_{i=0}^{k-1} W_i * X[t-k+1+i], X[j] = 0 for j < 0
S[t] = Theta(H[t] - v_threshold)weights[k-1] multiplies the newest input; the sum accumulates
sequentially from i = 0 so every backend reproduces the same
binary64 result bit-for-bit. Theta(0) = 1 per the paper. No PSN
variant has a reset: firing never clears the input history. The
paper trains W and v_threshold; the uniform 1/k defaults are
repository defaults.
Fields§
§weights: Vec<f64>§history: Vec<f64>§v_threshold: f64Implementations§
Source§impl ParallelSpikingNeuron
impl ParallelSpikingNeuron
Sourcepub fn new(kernel_size: usize, v_threshold: f64) -> Self
pub fn new(kernel_size: usize, v_threshold: f64) -> Self
Construct with the uniform repository default weights 1/k.
fn valid(&self) -> bool
Sourcepub fn try_step(&mut self, current: f64) -> Result<i32, &'static str>
pub fn try_step(&mut self, current: f64) -> Result<i32, &'static str>
Advance one step after validating the input and configuration.
Computes the hidden state on a candidate window and commits only
on success: a non-finite input, an invalid configuration, or a
non-finite hidden state returns Err with the pre-step state
preserved exactly.
Trait Implementations§
Source§impl Clone for ParallelSpikingNeuron
impl Clone for ParallelSpikingNeuron
Auto Trait Implementations§
impl Freeze for ParallelSpikingNeuron
impl RefUnwindSafe for ParallelSpikingNeuron
impl Send for ParallelSpikingNeuron
impl Sync for ParallelSpikingNeuron
impl Unpin for ParallelSpikingNeuron
impl UnsafeUnpin for ParallelSpikingNeuron
impl UnwindSafe for ParallelSpikingNeuron
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.