1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
//! Provides customized implementation of Growing Self Organizing Map. use std::fmt::Display; mod network; pub use self::network::Network; mod node; pub use self::node::*; mod state; pub use self::state::*; /// Represents an input for network. pub trait Input: Send + Sync { /// Returns weights. fn weights(&self) -> &[f64]; } /// Represents input data storage. pub trait Storage: Display + Send + Sync { /// An input type. type Item: Input; /// Adds an input to the storage. fn add(&mut self, input: Self::Item); /// Removes and returns all data from the storage. fn drain(&mut self) -> Vec<Self::Item>; /// Returns a distance between two input weights. fn distance(&self, a: &[f64], b: &[f64]) -> f64; }