2021-03-02 08:32:40 +01:00
|
|
|
|
{
|
|
|
|
|
"cells": [
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"slideshow": {
|
|
|
|
|
"slide_type": "slide"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"source": [
|
2021-06-02 09:42:13 +02:00
|
|
|
|
"## Uczenie maszynowe – zastosowania\n",
|
|
|
|
|
"# 12. Rekurencyjne sieci neuronowe"
|
2021-03-02 08:32:40 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"slideshow": {
|
|
|
|
|
"slide_type": "slide"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"source": [
|
|
|
|
|
"## RNN – _Recurrent Neural Network_\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"## LSTM – _Long Short Term Memory_"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
2021-06-02 08:05:40 +02:00
|
|
|
|
"cell_type": "markdown",
|
2021-03-02 08:32:40 +01:00
|
|
|
|
"metadata": {
|
|
|
|
|
"slideshow": {
|
|
|
|
|
"slide_type": "subslide"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"source": [
|
2021-06-02 08:05:40 +02:00
|
|
|
|
"https://www.youtube.com/watch?v=WCUNPb-5EYI"
|
2021-03-02 08:32:40 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"slideshow": {
|
|
|
|
|
"slide_type": "subslide"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"source": [
|
|
|
|
|
"### Rekurencyjna sieć neuronowa – schemat\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"<img style=\"margin: auto\" width=\"20%\" src=\"http://colah.github.io/posts/2015-08-Understanding-LSTMs/img/RNN-rolled.png\"/>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"slideshow": {
|
|
|
|
|
"slide_type": "subslide"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"source": [
|
|
|
|
|
"### Rekurencyjna sieć neuronowa – schemat\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"<img style=\"margin: auto\" width=\"80%\" src=\"http://colah.github.io/posts/2015-08-Understanding-LSTMs/img/RNN-unrolled.png\"/>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"slideshow": {
|
|
|
|
|
"slide_type": "subslide"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"source": [
|
2021-06-02 08:05:40 +02:00
|
|
|
|
"### Zależności długodystansowe (*long-distance dependencies*) w sieciach rekurencyjnych\n",
|
2021-03-02 08:32:40 +01:00
|
|
|
|
"\n",
|
|
|
|
|
"<img style=\"margin: auto\" width=\"60%\" src=\"http://colah.github.io/posts/2015-08-Understanding-LSTMs/img/RNN-longtermdependencies.png\"/>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"slideshow": {
|
|
|
|
|
"slide_type": "subslide"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"source": [
|
|
|
|
|
"### RNN – typy sekwencji\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"<img style=\"margin: auto\" width=\"80%\" src=\"http://karpathy.github.io/assets/rnn/diags.jpeg\"/>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"slideshow": {
|
|
|
|
|
"slide_type": "subslide"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"source": [
|
|
|
|
|
"### Prosta sieć RNN – schemat\n",
|
|
|
|
|
"\n",
|
2021-06-02 08:05:40 +02:00
|
|
|
|
"<img src=\"rnn.png\" style=\"margin: auto;\" width=\"80%\" />"
|
2021-03-02 08:32:40 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"slideshow": {
|
|
|
|
|
"slide_type": "subslide"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"source": [
|
|
|
|
|
"### LSTM – schemat\n",
|
|
|
|
|
"\n",
|
2021-06-02 08:05:40 +02:00
|
|
|
|
"<img src=\"lstm.jpg\" style=\"margin: auto;\" width=\"80%\" />"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"slideshow": {
|
|
|
|
|
"slide_type": "subslide"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"source": [
|
2021-03-02 08:32:40 +01:00
|
|
|
|
"* Rekurencyjne sieci neuronowe znajduja zastosowanie w przetwarzaniu sekwencji, np. szeregów czasowych i tekstów.\n",
|
|
|
|
|
"* LSTM są rozwinięciem RNN, umożliwiają „zapamiętywanie” i „zapominanie”."
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"slideshow": {
|
|
|
|
|
"slide_type": "subslide"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"source": [
|
|
|
|
|
"### Co potrafią generować rekurencyjne sieci neuronowe?\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"http://karpathy.github.io/2015/05/21/rnn-effectiveness/"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"slideshow": {
|
|
|
|
|
"slide_type": "subslide"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"source": [
|
|
|
|
|
"### Przewidywanie ciągów czasowych za pomocą LSTM – przykład\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"https://machinelearningmastery.com/time-series-forecasting-long-short-term-memory-network-python/"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"slideshow": {
|
|
|
|
|
"slide_type": "slide"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"source": [
|
|
|
|
|
"## GRU – _Gated Recurrent Unit_\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"* Rodzaj rekurencyjnej sieci neuronowej wprwadzony w 2014 roku\n",
|
|
|
|
|
"* Ma prostszą budowę niż LSTM (2 bramki zamiast 3).\n"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"slideshow": {
|
|
|
|
|
"slide_type": "subslide"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"source": [
|
|
|
|
|
"### GRU – schemat\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"<img src=\"gru.png\" style=\"margin: auto;\" width=\"50%\" />\n"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"slideshow": {
|
|
|
|
|
"slide_type": "subslide"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"source": [
|
|
|
|
|
"### GRU vs LSTM\n",
|
2021-06-02 08:05:40 +02:00
|
|
|
|
"* LSTM – 3 bramki: wejścia (*input*), wyjścia (*output*) i zapomnienia (*forget*); GRU – 2 bramki: resetu (*reset*) i aktualizacji (*update*). Bramka resetu pełni podwójną funkcję: zastępuje bramki wyjścia i zapomnienia.\n",
|
2021-03-02 08:32:40 +01:00
|
|
|
|
"* GRU i LSTM mają podobną skuteczność, ale GRU dzięki prostszej budowie bywa bardziej wydajna.\n",
|
|
|
|
|
"* LSTM sprawdza się lepiej w przetwarzaniu tekstu, ponieważ lepiej zapamiętuje zależności długosystansowe."
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
|
|
|
|
"celltoolbar": "Slideshow",
|
|
|
|
|
"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.8.3"
|
|
|
|
|
},
|
|
|
|
|
"livereveal": {
|
|
|
|
|
"start_slideshow_at": "selected",
|
2021-04-14 08:03:54 +02:00
|
|
|
|
"theme": "white"
|
2021-03-02 08:32:40 +01:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"nbformat": 4,
|
|
|
|
|
"nbformat_minor": 4
|
|
|
|
|
}
|