Building a neural network

Finally, let's build a neural network! We'll be building a simple three-layer neural network with one hidden layer. A three-layer neural network has two weight matrices, so we can define the neural network as such:

type NN struct {  hidden, final *tensor.Dense  b0, b1 float64}

hidden represents the weight matrix between the input layer and hidden layer, while final represents the weight matrix between the hidden layer and the final layer.

This is a graphical representation of our *NN data structure:

The input layer is the slice of 784 float64 which is then fed forward (that is, a matrix multiplication followed by an ...

Get Go Machine Learning Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.