pub struct Network<const X: usize, const H: usize, const Y: usize> { /* private fields */ }
Expand description
Holds a neural network.
Implementations§
Source§impl<const X: usize, const H: usize, const Y: usize> Network<X, H, Y>
impl<const X: usize, const H: usize, const Y: usize> Network<X, H, Y>
Sourcepub fn new(
input_activation: Box<dyn Activation<H>>,
output_activation: Box<dyn Activation<Y>>,
learning_rate: f64,
) -> Self
pub fn new( input_activation: Box<dyn Activation<H>>, output_activation: Box<dyn Activation<Y>>, learning_rate: f64, ) -> Self
Constructs a new neural network.
Add a hidden layer.
Sourcepub fn train_once(&mut self, input: Vector<X>, expected: Vector<Y>) -> f64
pub fn train_once(&mut self, input: Vector<X>, expected: Vector<Y>) -> f64
Train this network based on an input and an expected output.
Sourcepub fn train_all(&mut self, dataset: &TrainingDataset<X, Y>) -> f64
pub fn train_all(&mut self, dataset: &TrainingDataset<X, Y>) -> f64
Train this network based on a list of inputs and expected outputs.
Sourcepub fn train(&mut self, dataset: &TrainingDataset<X, Y>, generations: usize)
pub fn train(&mut self, dataset: &TrainingDataset<X, Y>, generations: usize)
Train this network based on a dataset for a given number of generations.
Auto Trait Implementations§
impl<const X: usize, const H: usize, const Y: usize> Freeze for Network<X, H, Y>
impl<const X: usize, const H: usize, const Y: usize> !RefUnwindSafe for Network<X, H, Y>
impl<const X: usize, const H: usize, const Y: usize> !Send for Network<X, H, Y>
impl<const X: usize, const H: usize, const Y: usize> !Sync for Network<X, H, Y>
impl<const X: usize, const H: usize, const Y: usize> Unpin for Network<X, H, Y>
impl<const X: usize, const H: usize, const Y: usize> !UnwindSafe for Network<X, H, Y>
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