Hopfield Neural Network (HNN) (非監督式學習-- 霍普菲爾神經網路
Download
Report
Transcript Hopfield Neural Network (HNN) (非監督式學習-- 霍普菲爾神經網路
Hopfield Neural Network
(HNN)
霍普菲爾神經網路(非監督式學習-【聯想式學習】)
聯想式學習
自聯想(auto-associative)
Input與對應的Target相同
由一個樣式聯想同一個樣式
異聯想(hetero-associative)
Input與對應的Target不同
由一個樣式聯想另一個樣式
聯想式學習(續)
架構
Feedforward
Recurrent
聯想式學習(續)
How many patterns can be stored before
the net starts to forget patterns it has
learned previously ?
Binary : N patterns 2N 0.15N
N
Bipolar :
M
2 log 2 N
A measure of associative net. Performance
Capacity
聯想式學習(續)
Learning
Hebb rule
x ( x1 , x2 ,..., xn )
y ( y1 , y2 ,..., ym )
L
W xT yi
i 1
1
1
W 1 1 1
1
1
0 2
2
0 2 0
0
2 0
2 0 2
1
0
2
2
0
i
X1=(1,-1,1,1,1,-1) y1=(1,1,-1,-1)
X2=(1,1,1,-1,-1,-1) y2=(1,-1,1,-1)
1
1
1 1 1 1 1 1 1 1
1
1
0 - 2
2
0
2 0
0
2
聯想式學習(續)
• If the input vectors are orthonormal perfect recall
( 1 , 1, -1 , -1)
× × × × -1+1-1+1=0
(-1, 1 , 1 , -1)
• If the input vectors are not orthonormal cross talk
• Testing
L
x k W x yi x k x y k x k x yi
i 1
T
T
T
i
k
i
ik
聯想式學習(續)
• Normalization
– By the Hebb rule by a factor of 1/n
– n : the number of units in the system
0
2
0 2
0
2
2 0
2
0
0
2
1
0
0 - 2 1 6
6 1
2
2
0 1 6 1 6 1
2 2 0 1 6 6 6 1
0
0
2 1 6
6 1
1
Hetero-associative Net.
Example
1
0
W 1
0
0
0
0
2
1
0
0
1
0
2
(1,0,0,0) (1,0)
(1,1,0,0) (1,0)
(0,0,0,1) (0,1)
(0,0,1,1) (0,1)
1
1
1
0
0
0
0
0 0
0
1
0
0
1 0
1
1
1
Hetero-associative Net.(續)
Testing
2
1
(1,0,0,0)
0
0
2
1
(0,1,0,0)
0
0
2
1
(0,1,1,0)
0
0
1 if x 0
f(x)
0 if x 0
0
0
( 2,0) (1,0)
1
2
0
0
(1,0) (1,0)
1
2
0
0
(1,1) (1,1)
1
2
Auto-associative Net.
Example
(1,1,-1,-1), (-1,1,1,-1)
1
1
1
1
W 1 1 1 1 1 1 1 1
1
1
1
1
0 2 0
0 2 0
2
0
0
2
0 2 對角線設為0 0
0
0 2
2 0
2
0 避免值過大 2 0
0
0
2
0
0 2 0
0 2 0
Auto-associative Net.(續)
Testing
0 2 0
0
0
0
0 2
2 2 2 2
1 1 1 1
2 0
0
0
0
2
0
0
1
2 2 2 2 1 1 1 1
2
Hopfield Network
基本架構
Single layer
每個處理單元皆有一個狀態值
每個狀態值會一直變化到最後呈現穩態(穩
定到一個固定值)
每個處理單元間彼此互相連結(完全連結)
Hopfield Network(續)
學習過程
{+1,-1,+1,-1,+1,-1}
{-1,+1,-1,+1,-1,-1}
{+1,+1,+1,+1,+1,+1}
{-1,-1,-1,-1,-1,-1}
設定網路權重值即完成學習
L
W x xi
i 1
1
- 1
1
W 1
- 1
1
- 1
0
4
0
4
4
0
4
0
4
0
4
0
1
4
0
4
0
4
0
1
0
4
0
4
0
4
- 1
- 1
- 1
1 1 1 ... 1
- 1
- 1
- 1
4
0
0
4
0
4
0
0
4
0
0
0
4
0
4
4
0
0
0
0
4
0
4
4
0
0
0
0
4
4
0
0
4
0
0
0
4
4
0
4
0
0
1
0
4
0
4
0
0
1
1
T
i
1
1
Hopfield Network(續)
回想過程
讀入權重值矩陣
輸入初始變數向量X
計算新的狀態變數向量X
neti wij x old
j
1
xinew xiold
1
if neti Thresholds
if neti Thresholds
if neti Thresholds
反覆上一步,直到收斂為止
Thresholds=0
Hopfield Network(續)
0
0
4
0
4
0
0
0
0
4
0
0
0
4
0
4
0
4
4
0
4
0
4
0
0
0
4
0
0
0
0
0
4
0
4
0
0
0
0
4
0
0
0
4
0
4
0
4
4
0
4
0
4
0
0
0
4
0
0
0
0 1
8
1
8
1
4 1
8
1
0 1
4 1
0
1
8
1
0 1
0 1
0
1
0 1
8
1
8
1
4 1
8
1
0 1
4 1
8
1
8
1
0 1
0 1
8
1
Epoch 1
維持原
來的值
Epoch 2
Hopfield Network(續)
網路輸出值的修正
同步修正(synchronous update)
• 網路輸出值即為下一epoch的輸入值
0 1 1 1
1 0 1 1
0 1 1 1
1 0 1 1
非同步修正(asynchronous update)
• 網路輸出值每次只挑選一個與原來輸入值不同的
處理單元進行修正(index最小者),修正後的
輸出值即為下一epoch的輸入值 0 1 1 1
0 1
1
1
• 收斂的機會較大
1 1
0
1
1
0
1
1 1
0
1 1
1
0 1
1
Hopfield Network(續)
0 1 1 1
1 0 1 1
0 1 1 1
1 0 1 1
0 1 1 1
1 0 1 1
:
:
Hopfield Network(續)
能量函數(Lyapunov function)
用以判斷是否會收斂
能量函數趨近於0,表示會收斂
H x wij xi x j 2 Ti xi T : Threshold
n
n
i 1 j 1
xWx 2x T T
n
i 1
Hopfield Network(續)
因Hopfield並無訓練目標值,因此無法以MSE、
RMSE或誤判率來衡量網路誤差大小
因此,以能量函數進行誤差的衡量
• 簡化能量函數
1
E xi wij x j .or. E xi wij x j
2 i 1 j 1
i 1 j 1
• 當各處理單元的狀態變數值所構成向量與訓練範例
特徵向量之一相似或相同時,能量函數傾向較低的
值
Hopfield Network(續)
應用
雜訊過濾
資料擷取
最佳化
• Travel Salesman Problem, TSP
• Linear programming
• Job shop scheduling
Hopfield Network(續)
圖樣辨識