[][src]Struct slow_nn::Network

pub struct Network { /* fields omitted */ }

Neural Network struct

Methods

impl Network[src]

pub fn from_conns(
    bias: f64,
    inputs: usize,
    outputs: usize,
    hidden: usize,
    conns: &[Connection]
) -> Self
[src]

Creates a network from a slice of Connections

pub fn dense(bias: f64, inputs: usize, outputs: usize, layers: &[usize]) -> Self[src]

Creates a fully connected network with random weights

pub fn predict(&self, input: &[f64], activation: fn(_: f64) -> f64) -> Vec<f64>[src]

Does a forward pass

pub fn train(
    &mut self,
    input: &[f64],
    expected: &[f64],
    activation: fn(_: f64) -> f64,
    deactivation: fn(_: f64) -> f64,
    loss: fn(_: f64, _: f64) -> f64,
    dloss: fn(_: f64, _: f64) -> f64,
    lr: f64
) -> f64
[src]

Does both forward and backward pass and updates the weights

pub fn load(path: &str) -> Result<Self, Error>[src]

loads the network from a file

pub fn save(&self, path: &str) -> Result<(), Error>[src]

Saves the network to a file

pub fn to_bytes(&self) -> Option<Vec<u8>>[src]

Returns the bytes of the object after serializing

Trait Implementations

impl<'de> Deserialize<'de> for Network[src]

impl Serialize for Network[src]

Auto Trait Implementations

impl RefUnwindSafe for Network

impl Send for Network

impl Sync for Network

impl Unpin for Network

impl UnwindSafe for Network

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,