Expand description

The library can make very basic feedforward neural networks. Learning hasn’t been implemented yet. Library still needs a lot of work.

In brainy a layer struct represents a layer of the neural network (excluding the output layer) and a map to the next layer. For now the activation function is treated as a seperate map from something like matrix multiplication. That way, one can “mix and match” different maps.

A description of the underlying math and a deeper explanation of the code can be found here:

https://thefrogblog.xyz/neural-network-1/

https://thefrogblog.xyz/neural-network-2/

https://thefrogblog.xyz/neural-network-3/

Some example code:

extern crate brainy;
use brainy::matrix::Matrix;
use brainy::layer::Map;
use brainy::network::Network;

fn main()
{
    let mut network = Network::new();
    network.append_layer(Map::MatrixMultiply(4,3));
    network.append_layer(Map::Sigmoid(3));
    network.append_layer(Map::MatrixMultiply(3,2));

    let input = vec![0.0, 1.0, 1.0, 0.5];
    let x = Matrix { rows: input.len(),  cols: 1, elements: input };

    let y = network.feedforward(x);
    y.print();
}

Modules

Use to create a layer in a neural network.
Use to create matrices.
Use to make a network from layers.