pub struct Som {
pub grid_w: usize,
pub grid_h: usize,
pub dim: usize,
/* private fields */
}Expand description
A trained self-organizing map: a grid_w × grid_h lattice of dim-vectors.
Fields§
§grid_w: usize§grid_h: usize§dim: usizeImplementations§
Source§impl Som
impl Som
Sourcepub fn bmu(&self, input: &[f64]) -> (usize, usize)
pub fn bmu(&self, input: &[f64]) -> (usize, usize)
Best-matching unit (grid coords) for an input vector — the nearest neuron.
Sourcepub fn train(
data: &[f64],
n: usize,
dim: usize,
grid_w: usize,
grid_h: usize,
epochs: usize,
lr0: f64,
sigma0: f64,
seed: u64,
) -> Result<Self, LearningError>
pub fn train( data: &[f64], n: usize, dim: usize, grid_w: usize, grid_h: usize, epochs: usize, lr0: f64, sigma0: f64, seed: u64, ) -> Result<Self, LearningError>
Train a grid_w × grid_h SOM on a row-major n × dim data matrix for
epochs, with initial learning rate lr0 and neighbourhood radius sigma0
(both decaying exponentially). Fails closed on shape mismatch.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Som
impl RefUnwindSafe for Som
impl Send for Som
impl Sync for Som
impl Unpin for Som
impl UnsafeUnpin for Som
impl UnwindSafe for Som
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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