Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify rnn chapter #748

Merged
merged 2 commits into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion open-machine-learning-jupyter-book/deep-learning/lstm.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,50 @@
"The vanilla LSTM is proposed in 2005, the paper is [Bidirectional LSTM Networks for Improved Phoneme Classification and Recognition](https://link.springer.com/chapter/10.1007/11550907_126), and after that, a lot of paper based on it appeared.\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"hide-input"
]
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"<p style=\"text-align: center;\">\n",
"<iframe src=\"https://static-1300131294.cos.ap-shanghai.myqcloud.com/html/rnn-vis/index.html\" width=\"100%\" height=\"250px;\"\n",
"style=\"border:none;\" scrolling=\"auto\"></iframe>\n",
"A demo of advanced RNNs. <a\n",
"href=\"https://distill.pub/2019/memorization-in-rnns/\"> [source]</a>\n",
"</p>\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from IPython.display import HTML\n",
"display(HTML(\"\"\"\n",
"<p style=\"text-align: center;\">\n",
"<iframe src=\"https://static-1300131294.cos.ap-shanghai.myqcloud.com/html/rnn-vis/index.html\" width=\"100%\" height=\"250px;\"\n",
"style=\"border:none;\" scrolling=\"auto\"></iframe>\n",
"A demo of advanced RNNs. <a\n",
"href=\"https://distill.pub/2019/memorization-in-rnns/\"> [source]</a>\n",
"</p>\n",
"\"\"\"))"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -4798,5 +4842,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
21 changes: 4 additions & 17 deletions open-machine-learning-jupyter-book/deep-learning/rnn.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"id": "4f92eda8",
"metadata": {
"tags": [
"hide-input"
"hide-cell"
]
},
"outputs": [
Expand Down Expand Up @@ -79,23 +79,10 @@
"id": "298a6e8c",
"metadata": {},
"source": [
":::{figure} https://static-1300131294.cos.ap-shanghai.myqcloud.com/images/deep-learning/RNN/rnn1.png\n",
"---\n",
"name: 'RNN1'\n",
"width: 90%\n",
"---\n",
"RNN1\n",
":::\n",
"\n",
"If unroll over a sequence $(x_0,x_1,x_2)$.\n",
"| ![RNN1](https://static-1300131294.cos.ap-shanghai.myqcloud.com/images/deep-learning/RNN/rnn1.png) | ![RNN2](https://static-1300131294.cos.ap-shanghai.myqcloud.com/images/deep-learning/RNN/rnn2.png) |\n",
"|:--:|:--:|\n",
"| RNN1 (recurrent) | RNN2 (unfolded RNN1) |\n",
"\n",
":::{figure} https://static-1300131294.cos.ap-shanghai.myqcloud.com/images/deep-learning/RNN/rnn2.png\n",
"---\n",
"name: 'RNN2'\n",
"width: 90%\n",
"---\n",
"RNN2\n",
":::\n",
"\n",
"Then, the input (w0,w1,...,wt) sequence of words ( 1-hot encoded ) and the output (w1,w2,...,wt+1) shifted sequence of words ( 1-hot encoded ) have the following relation.\n",
"\n",
Expand Down
Loading