pub struct HebbianState {
pub activations: Vec<ActivationRecord>,
pub coactivations: HashMap<(u32, u32), CoactivationPair>,
pub fingerprints: Vec<ActivationFingerprint>,
}Expand description
In-memory Hebbian state, loaded from binary files.
Fields§
§activations: Vec<ActivationRecord>§coactivations: HashMap<(u32, u32), CoactivationPair>§fingerprints: Vec<ActivationFingerprint>Implementations§
Source§impl HebbianState
impl HebbianState
Sourcepub fn load_or_init(output_dir: &Path, block_count: usize) -> Self
pub fn load_or_init(output_dir: &Path, block_count: usize) -> Self
Load or initialize Hebbian state for a given block count.
Sourcepub fn record_activation(&mut self, results: &[(u32, f32)], query_hash: u64)
pub fn record_activation(&mut self, results: &[(u32, f32)], query_hash: u64)
Record that a set of blocks were activated together by a query. This is the core Hebbian learning signal.
Sourcepub fn apply_drift(&mut self, headers: &[(f32, f32, f32)])
pub fn apply_drift(&mut self, headers: &[(f32, f32, f32)])
Apply Hebbian drift: co-activated blocks pull each other’s coordinates closer. Call this during rebuild or periodically.
Sourcepub fn effective_coords(
&self,
block_idx: usize,
original: (f32, f32, f32),
) -> (f32, f32, f32)
pub fn effective_coords( &self, block_idx: usize, original: (f32, f32, f32), ) -> (f32, f32, f32)
Get effective coordinates for a block (original + Hebbian drift).
Sourcepub fn energy(&self, block_idx: usize) -> f32
pub fn energy(&self, block_idx: usize) -> f32
Get the energy (heat) of a block. 1.0 = just activated, decays toward 0.
Sourcepub fn save(&self, output_dir: &Path) -> Result<(), String>
pub fn save(&self, output_dir: &Path) -> Result<(), String>
Save all Hebbian state to binary files.
Sourcepub fn stats(&self) -> HebbianStats
pub fn stats(&self) -> HebbianStats
Get statistics about the Hebbian state.
Sourcepub fn latest_fingerprint(&self) -> Option<&ActivationFingerprint>
pub fn latest_fingerprint(&self) -> Option<&ActivationFingerprint>
Get the latest activation fingerprint (for mirror neuron sharing).
Sourcepub fn strongest_pairs(&self, n: usize) -> Vec<&CoactivationPair>
pub fn strongest_pairs(&self, n: usize) -> Vec<&CoactivationPair>
Get top-N strongest co-activation pairs.
Auto Trait Implementations§
impl Freeze for HebbianState
impl RefUnwindSafe for HebbianState
impl Send for HebbianState
impl Sync for HebbianState
impl Unpin for HebbianState
impl UnsafeUnpin for HebbianState
impl UnwindSafe for HebbianState
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> 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