迴歸、自迴歸、循環神經網絡(RNN)、LSTM

1 RNN的統計學基礎

1.1 迴歸:

Investpedia:
Regression refers to the relation between selected values of x and observed values of y (from which the most probable value of y can be predicted for any value of x). The general form of each type of regression is:

  • Simple linear regression: Y=a+bX+uY = a + bX + u
  • Multiple linear regression: Y=a+b1X1+b2X2+b3X3+...+btXt+uY = a + b_1X_1 + b_2X_2 + b_3X_3 + ... + b_tX_t + u
    Where:
    YY = the variable that you are trying to predict (dependent variable,因變量).
    XX = the variable that you are using to predict Y (independent variable,自變量).
    aa = the intercept(截距).
    bb = the slope(斜率).
    uu = the regression residual(迴歸殘差).

1.2 自迴歸(Auto-Regression, AR模型)

自迴歸,即AR模型,屬於時間序列分析的範疇,即用一個變量yty_t的歷史信息來預測自己,tutorialspoint給出的定義:

  • For a stationary time series, an auto regression models sees the value of a variable at time ‘t’ as a linear function of values ‘p’ time steps preceding it. Mathematically it can be written as:
    yt=C+ϕ1yt1+ϕ2yt2+...+ϕpytp+ϵty_t=C+ϕ_1y_{t−1}+ϕ_2y_{t−2}+...+ϕ_py_{t−p}+ϵ_t
    Where,‘p’ is the auto-regressive trend parameter
    ϵtϵ_t is white noise, and yt1,yt2...ytpy_{t−1},y_{t−2}...y_{t−p} denote the value of variable at previous time periods.

1.3 有外部輸入的非線性自迴歸模型(Nonlinear AutoRegressive with Exogenous Inputs Model,NARX)

NARX是自迴歸模型的擴展,在每個時刻tt都有一個外部輸入xtx_t,產生一個輸出yty_t,NARX通過一個延時器記錄最近KxK_x次的外部輸入和最近KyK_y次的輸出,第tt個時刻的輸出yty_t爲:
yt=f(xt,xt1,...,xtKx,yt1,yt2,...,ytKy)y_t=f(x_t,x_{t-1},...,x_{t-K_x},y_{t-1},y_{t-2},...,y_{t-K_y})
其中f()f()表示非線性函數,可以是一個前饋網絡,KxK_xKyK_y爲超參數。

2 簡單循環神經網絡

2.1 循環神經網絡的通用近似定理

如果一個完全連接的循環神經網絡有足夠數量的 sigmoid 型隱藏神經元,它可以以任意的準確率去近似任何一個非線性動力系統:


st=g(st1,xt)s_t = g(s_{t-1}, x_{t})
yt=o(st)y_t = o(s_t)

2.2 學習模式

2.3 參數學習

2.4 梯度爆炸、梯度消失與長程依賴問題

2.5 門控機制、LSTM及其變體

2.6 深層循環神經網絡

2.6.1 堆疊循環神經網絡

在這裏插入圖片描述
圖 按時間展開的堆疊循環神經網絡

2.6.2 雙向循環神經網絡

在有些任務中,一個時刻的輸出不但和過去時刻的信息有關,也和後續時刻
的信息有關.比如給定一個句子,其中一個詞的詞性由它的上下文決定,即包含左右兩邊的信息.因此,在這些任務中,我們可以增加一個按照時間的逆序來傳遞信息的網絡層,來增強網絡的能力.
雙向循環神經網絡(Bidirectional Recurrent Neural Network,Bi-RNN)由
兩層循環神經網絡組成,它們的輸入相同,只是信息傳遞的方向不同.按時間展開的雙向循環神經網絡
圖 按時間展開的雙向循環神經網絡

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章