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 34 35 36 37 38 39 40
//! Network module.
use crate::prelude::*;
/// The network structure.
#[derive(Debug, Serialize, Deserialize)]
pub struct Network {
/// The dimension of the network.
pub dimension: usize,
/// The alpha value of the network.
pub alpha: f32
}
impl Default for Network {
fn default() -> Self {
Network {
dimension: 8,
alpha: 1.0
}
}
}
impl Network {
/// Create a new network structure.
pub fn new() -> Self {
Default::default()
}
/// Set the dimension of the network.
pub fn with_dimension(mut self, dimension: usize) -> Self {
self.dimension = dimension;
self
}
/// Set the alpha value of the network.
pub fn with_alpha(mut self, alpha: f32) -> Self {
self.alpha = alpha;
self
}
}