pub struct Config {
pub n_clauses: usize,
pub n_features: usize,
pub n_states: i16,
pub s: f32,
}Expand description
§Overview
Configuration parameters for a Tsetlin Machine.
Fields§
§n_clauses: usize§n_features: usize§n_states: i16§s: f32Implementations§
Source§impl Config
impl Config
Sourcepub fn builder() -> ConfigBuilder
pub fn builder() -> ConfigBuilder
§Overview
Creates a new ConfigBuilder.
Sourcepub fn prob_strengthen(&self) -> f32
pub fn prob_strengthen(&self) -> f32
§Overview
Pre-computed probability for strengthening: (s-1)/s.
Sourcepub fn prob_weaken(&self) -> f32
pub fn prob_weaken(&self) -> f32
§Overview
Pre-computed probability for weakening: 1/s.
Sourcepub fn threshold_strengthen(&self) -> u32
pub fn threshold_strengthen(&self) -> u32
§Overview
Pre-computed integer threshold for strengthening.
Converts float probability to u32 for faster comparison:
rng.random::<u32>() < threshold is ~2x faster than float comparison.
Sourcepub fn threshold_weaken(&self) -> u32
pub fn threshold_weaken(&self) -> u32
§Overview
Pre-computed integer threshold for weakening.
Trait Implementations§
impl Copy for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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