Week 4 Lecture 2
Neural networks
Different ways to categorize neural networks:
- feed-forward NN recurrent networks
- supervised unsupervised
The function represents the output of neuron .
x is often omitted for simplicity
Modeling real world neurons, the idea is that neurons integrate their inputs, and fire over some threshold.
Pre-activation:
Then we apply some transfer function (activation function) to it:
One of the βdefaultβ choices for is the logistic function (or any non-polynomial function)
A single neuron by itself is not very useful (canβt even compute XOR).
A neural network is a DAG network of neurons
Activation function of neuron is denoted
Neuron can only get input from neuron , making sure the graph stays acyclic.
Pre-activation of neuron (non-input neuron):
means βweight from to β.
- is always 1 since z_0 is associated with the bias parameter
- (The results on the input neurons is exactly the input)
Gradient descent will return in Machine Learning A
We are going to use sum-of-squares error for regression
Classification
one-hot encoding
Class from can be encoded as:
Binary Classification
If we assume the sum of are 1, and are all non-negative (i.e. our models probabilities):
i.e. the element of thatβs indexed by
Giving the negative log-likelihood (called cross-entropy):
Multi-class Classification
We could use soft-max (still making sure of the sum to be 1)
Thus, we can have a neural network, with soft-max as its last activation, and then a cross-entropy layer for training.
In reality, the model would output the values BEFORE soft-max. During training we could use a loss combining soft-max and log-likelihood, and during inference just add a soft-max.
Layers
A layer is a collection of neurons, where each neuron has the same inputs, and does the same calculation (has the same activation)
Layers can be numbered , and each layer only gets inputs from
is the activation of layer
Inputs of layer is gathered into a vector
We can denote the weights of the th neuron in layer by , and the bias by . This way the result is:
Or, in matrix form (assuming implicit bias):
(where acts component-wise)
Epoch: one pass through the training data