Skip to content

Instantly share code, notes, and snippets.

@gihyunkim
Created October 11, 2019 05:16
Show Gist options
  • Save gihyunkim/0f6b693cf2e08a02d68b0407e6588655 to your computer and use it in GitHub Desktop.
Save gihyunkim/0f6b693cf2e08a02d68b0407e6588655 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# GRU(Gated Recurrent Unit)\n",
"- LSTM의 장점은 유지하면서 계산 복잡성을 확 낮춘 방식이다.\n",
"\n",
"\n",
"- Vanising Gradient문제를 극복했다는 점은 동일하지만 게이트 일부를 생략.\n",
"\n",
"\n",
"- update gate와 reset gate로 나뉜다.\n",
"\n",
"$$update \\ gate: \\ z_t=\\sigma(\\omega^z x_t + U^z h_{t-1})$$\n",
"$$rest \\ gate: \\ r_t = \\sigma(\\omega^r x_t + U^r h_{t-1})$$\n",
"\n",
"### 현 시점에서 기억해둘 만한 정보 정의\n",
"\n",
"$$ \\tilde{h}_t = tanh(\\omega_{xt} + r_t \\odot U h_{t-1})$$\n",
"\n",
"=> 현 시점 정보($\\omega_{xt}$)와 과거 정보($U h_{t-1}$)을 반영하되, \n",
"과거 정보를 얼마나 반영할 지를 reset gate 값에 의존.\n",
"\n",
"**$r_t$는 0 ~ 1 사이 값을 가진다. 1은 모두 기억, 0은 모두 잊음**\n",
"\n",
"\n",
"### 상태 업데이트 식\n",
"$$h_t = z_t \\odot h_{t-1} + (1-z_t) \\odot \\tilde{h_t}$$\n",
"\n",
"\n",
"$h_{t-1}$은 과거 정보, $\\tilde{h_t}$는 현재 정보.\n",
"\n",
"이를 어떻게 조합할 지 결정하는 것이 $z_t$(update gate)이다."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment