pub struct SynapticPlasticity {
pub synapses: HashMap<(u32, u32), Synapse>,
pub ltp_threshold_ms: i64,
pub ltd_threshold_ms: i64,
pub learning_rate: f32,
pub total_updates: u32,
}Fields§
§synapses: HashMap<(u32, u32), Synapse>§ltp_threshold_ms: i64§ltd_threshold_ms: i64§learning_rate: f32§total_updates: u32Implementations§
Source§impl SynapticPlasticity
impl SynapticPlasticity
pub fn new() -> Self
Sourcepub fn ltp(&mut self, pre_block: u32, post_block: u32) -> f32
pub fn ltp(&mut self, pre_block: u32, post_block: u32) -> f32
Long-Term Potentiation: strengthen synapse
Sourcepub fn ltd(&mut self, pre_block: u32, post_block: u32) -> f32
pub fn ltd(&mut self, pre_block: u32, post_block: u32) -> f32
Long-Term Depression: weaken synapse
Sourcepub fn stdp(
&mut self,
pre_block: u32,
post_block: u32,
pre_time_ms: i64,
post_time_ms: i64,
) -> f32
pub fn stdp( &mut self, pre_block: u32, post_block: u32, pre_time_ms: i64, post_time_ms: i64, ) -> f32
Spike-Timing-Dependent Plasticity (STDP) Pre spike then post spike (causal): LTP Post spike then pre spike (acausal): LTD
Sourcepub fn get_weight(&self, pre_block: u32, post_block: u32) -> f32
pub fn get_weight(&self, pre_block: u32, post_block: u32) -> f32
Get synapse weight
Sourcepub fn strongest_synapses(&self, k: usize) -> Vec<(&(u32, u32), &Synapse)>
pub fn strongest_synapses(&self, k: usize) -> Vec<(&(u32, u32), &Synapse)>
Get strongest synapses
Sourcepub fn ltp_dominant(&self) -> Vec<&Synapse>
pub fn ltp_dominant(&self) -> Vec<&Synapse>
Get synapses by plasticity type
pub fn ltd_dominant(&self) -> Vec<&Synapse>
Sourcepub fn stdp_curve(&self, timing_diff_ms: i64) -> f32
pub fn stdp_curve(&self, timing_diff_ms: i64) -> f32
Calculate STDP curve value
pub fn save(&self, dir: &Path) -> Result<(), String>
pub fn load(dir: &Path) -> Result<Self, String>
pub fn load_or_init(dir: &Path) -> Self
Sourcepub fn heterosynaptic_depression(
&mut self,
active_synapse: (u32, u32),
neighborhood_radius: u32,
)
pub fn heterosynaptic_depression( &mut self, active_synapse: (u32, u32), neighborhood_radius: u32, )
Heterosynaptic Depression — weaken other synapses when one is active
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SynapticPlasticity
impl RefUnwindSafe for SynapticPlasticity
impl Send for SynapticPlasticity
impl Sync for SynapticPlasticity
impl Unpin for SynapticPlasticity
impl UnsafeUnpin for SynapticPlasticity
impl UnwindSafe for SynapticPlasticity
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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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