Simple Example
Digit Classification
Let's talk about an example. We have pixel greyscale input image and we want to predict which digit of 0-9 it is.
Each of our pixels are represented by a value from 0 to 255 representing the intensity of the greyscale pixel, with 0 being black and 255 being white.
At the most basic level, we want to make a function
i.e. takes in a matrix of integers between and and outputs an integer between and the predicted digit represented by the image.
As A Neural Network
Let's start by defining a neuron.
In a neural network, a neuron is a computation unit that takes input values, applies an @affine-transformation, then a typically non-linear activation function, and returns a single value.
That is, it is a function of the form
where
- is the number of inputs to the neuron
- is a vector of weights,
- is a bias value, and
- is an activation function.
Referenced by (1 direct)
Direct references:
A layer in a neural network is a collections of neurons that operate in parallel on the same input vector.
A layer with inputs and neurons defines a function
of the form
where:
- is the weight matrix (with the th row representing the weights for the inputs to the th neuron in the layer),
- is the bias vector (with the th entry representing the bias on the th neuron in the layer,
- is an activation function, applied @componentwise,
- each coordinate of is the output of a single neuron in that layer.
A layer takes an input vector, applies the same @affine-transformation to all neurons (via a shared weight @matrix and bias vector), and then applies an @activation-function to each neuron's output.
Its output is the vector of all neuron outputs in that layer, and in this way, we can view a layer as a vector of neurons.
Finally we'll define neural network itself!
A neural network is a function obtained by @composing @finitely-many neurons arranged in layers:
where each
- is an @affine-transformation,
- is an @activation-function applied @componentwise,
- and are learnable parameters.
Referenced by (3 direct)
Direct references:
Our pixels are represented by a value from 0 to 1 that represents intensity, with 0 being