pub struct DerivativeEncoder { /* private fields */ }Expand description
Encodes based on the rate of change (derivative) of the input.
Fires an excitatory spike when the positive change exceeds a threshold, and an inhibitory spike when the negative change exceeds the threshold.
§Examples
use axon_encoder::prelude::*;
let mut enc = DerivativeEncoder::try_new(vec![0.2])?;
let _ = enc.encode_step(&[0.0]); // seed previous sample
let out = enc.encode_step(&[0.5]); // +0.5 change exceeds threshold
assert_eq!(out.spikes.len(), 1);
assert!(out.spikes[0].polarity);Implementations§
Source§impl DerivativeEncoder
impl DerivativeEncoder
Trait Implementations§
Source§impl Clone for DerivativeEncoder
impl Clone for DerivativeEncoder
Source§fn clone(&self) -> DerivativeEncoder
fn clone(&self) -> DerivativeEncoder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DerivativeEncoder
impl Debug for DerivativeEncoder
Source§impl Encoder for DerivativeEncoder
impl Encoder for DerivativeEncoder
Source§fn encode(&mut self, input: &[f32]) -> EncodedOutput
fn encode(&mut self, input: &[f32]) -> EncodedOutput
Encodes a slice of analog values into spike events (batch mode).
Source§fn encode_step(&mut self, current_values: &[f32]) -> EncodedOutput
fn encode_step(&mut self, current_values: &[f32]) -> EncodedOutput
Encodes a single step incrementally (streaming mode). Read more
Source§impl PartialEq for DerivativeEncoder
impl PartialEq for DerivativeEncoder
impl StructuralPartialEq for DerivativeEncoder
Auto Trait Implementations§
impl Freeze for DerivativeEncoder
impl RefUnwindSafe for DerivativeEncoder
impl Send for DerivativeEncoder
impl Sync for DerivativeEncoder
impl Unpin for DerivativeEncoder
impl UnsafeUnpin for DerivativeEncoder
impl UnwindSafe for DerivativeEncoder
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