1. 程式人生 > >機器學習筆記 ---- Neural Networks

機器學習筆記 ---- Neural Networks

Neural Network

1. Model Summary

At a very simple level, neurons are basically computational units that take inputs (dendrites) as electrical inputs (called “spikes”) that are channeled to outputs (axons). In our model, our dendrites are like the input features

x 1 x n and the output is the result of our hypothesis function. In this model our
x 0 = 1
input node is sometimes called the “bias unit.” It is always equal to 1. In neural networks, we use the same logistic function as in classification,
−θTx" role="presentation" style="position: relative;"> 1 1 + e θ T x , yet we sometimes call it a sigmoid (logistic) activation function. In this situation, our “theta” parameters are sometimes called “weights”.
Visually, a simplistic representation looks like:

[ x 0 x 1 x 2 ] [ ] h θ ( x )

three layers: input layer / hidden layer / output layer
a i ( j ) : activation unit i in layer j
Θ ( j ) : Matrix that controls function mapping from j-th layer to (j+1)-th layer
If layer j has s j units, layer j+1 has s j + 1 units, then size of Θ ( j ) is s j + 1 ( s j + 1 )
L : Number of Layers
s l : Number of units in l-th layer
Number of Inputs: the dimension of features in x ( i )
Binary Classification: 1 output unit
K-classes Classification: K output unit

2. Forward Propagation

1) Add a x ( 0 ) = 1 first
2) z x + 1 = Θ ( x ) a x
3) a x + 1 = g ( z x + 1 ) — g(x) : Sigmoid

3. Cost Function

Cost Function
Excluding Bias Term

4. Backpropagation Algorithm

δ j ( l ) error of node j in layer l, then

δ ( L ) = a ( L ) y δ ( i ) = ( Θ ( i ) ) T δ ( i + 1 ) . g ( z ( i ) ) ( i ! = L , i ! = 1 )
where g ( z ( i ) ) = a ( i ) . ( 1 a ( i ) )
這裡寫圖片描述
One thing to note: use one training set to train the model at one time!

5. Unrolling Parameters

Enroll them to vectors/Get back:
這裡寫圖片描述
這裡寫圖片描述

6.Gradient Checking

這裡寫圖片描述

When learning, turn off gradient checking!!!

7. Random Initialization

這裡寫圖片描述

8.Network Architecture

one hidden layer/
more than one hidden layer with same number of units