[][src]Struct radiate_matrix_tree::matrix_tree::network::NeuralNetwork

pub struct NeuralNetwork {
    pub weights: Vec<Matrix<f32>>,
    pub biases: Vec<Matrix<f32>>,
    // some fields omitted

The neural network struct is meant to represent a simple feed forward neural network with the ability to maniupate it's weights and biases, and feed forward a 1D vector of a predetermined size (input_size).


weights: Vec<Matrix<f32>>biases: Vec<Matrix<f32>>


impl NeuralNetwork[src]

implement the nerual network

pub fn new(input_size: i32) -> Self[src]

Create a new neural network

This returns a completely empty neural network, to create a random network chain the 'fill_random()' method ontop of this method call.

pub fn fill_random(self) -> Self[src]

Randomly fill the weights and biases of the neural network This method consumes the network, generates random vecs representing the weights and biases, assigns them, and returns the consumed NeuralNetwork back to the caller.

pub fn edit_weights(
    &mut self,
    weight_mutate: f32,
    weight_transform: f32,
    layer_mutate: f32

Edit the weights randomly of the matrix objects within the network pub fn edit_weights(&mut self, layer_rate: f32, weight_mutate: f32, weight_transform: f32) {

pub fn generate_random_network(
    &mut self
) -> (Vec<Matrix<f32>>, Vec<Matrix<f32>>)

Generate a random neural network with at least one hidden layer and each layer with a size of at least one. Return a tuble containin the vec of weights represented by a simple matrix and a vec of biases represeted by a simple matrix as well.

pub fn feed_forward(&self, input: Matrix<f32>) -> Matrix<f32>[src]

feed forward a matrix through the neural network and output a matrix if the input shape does not fit matrix multiplication rules, method will Panic! Note: the input matrix must already by transmuted to where the input rows should equal the first layer's column -> dot product

pub fn weight_sum(&self) -> f32[src]

Compute the sum of the weights of the neural network pretty simple.

Trait Implementations

impl Clone for NeuralNetwork[src]

impl Debug for NeuralNetwork[src]

impl Drop for NeuralNetwork[src]

impl PartialEq<NeuralNetwork> for NeuralNetwork[src]

Override the partialeq trait for the neural network. This is needed because there is no impmenetation for partialeq for a ThreadRng which the nerual net ownes. Because that doesn't matter for a partialeq, this override only checks what is actually needed. Without this the program will not compile.

Auto Trait Implementations

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

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

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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>,