{ "cells": [ { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Uczenie maszynowe\n", "# 4. Sieci neuronowe – wprowadzenie" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "# Przydatne importy\n", "\n", "import matplotlib\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "\n", "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## 4.1. Perceptron" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "https://www.youtube.com/watch?v=cNxadbrN_aI" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "\"Frank" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "\"Frank" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "\"perceptron\"/" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Pierwszy perceptron liniowy\n", "\n", "* Frank Rosenblatt, 1957\n", "* aparat fotograficzny podłączony do 400 fotokomórek (rozdzielczość obrazu: 20 x 20)\n", "* wagi – potencjometry aktualizowane za pomocą silniczków" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Uczenie perceptronu\n", "\n", "Cykl uczenia perceptronu Rosenblatta:\n", "\n", "1. Sfotografuj planszę z kolejnym obiektem.\n", "1. Zaobserwuj, która lampka zapaliła się na wyjściu.\n", "1. Sprawdź, czy to jest właściwa lampka.\n", "1. Wyślij sygnał „nagrody” lub „kary”." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Funkcja aktywacji\n", "\n", "Funkcja bipolarna:\n", "\n", "$$ g(z) = \\left\\{ \n", "\\begin{array}{rl}\n", "1 & \\textrm{gdy $z > \\theta_0$} \\\\\n", "-1 & \\textrm{wpp.}\n", "\\end{array}\n", "\\right. $$\n", "\n", "gdzie $z = \\theta_0x_0 + \\ldots + \\theta_nx_n$,
\n", "$\\theta_0$ to próg aktywacji,
\n", "$x_0 = 1$. " ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "def bipolar_plot():\n", " matplotlib.rcParams.update({'font.size': 16})\n", "\n", " plt.figure(figsize=(8,5))\n", " x = [-1,-.23,1] \n", " y = [-1, -1, 1]\n", " plt.ylim(-1.2,1.2)\n", " plt.xlim(-1.2,1.2)\n", " plt.plot([-2,2],[1,1], color='black', ls=\"dashed\")\n", " plt.plot([-2,2],[-1,-1], color='black', ls=\"dashed\")\n", " plt.step(x, y, lw=3)\n", " ax = plt.gca()\n", " ax.spines['right'].set_color('none')\n", " ax.spines['top'].set_color('none')\n", " ax.xaxis.set_ticks_position('bottom')\n", " ax.spines['bottom'].set_position(('data',0))\n", " ax.yaxis.set_ticks_position('left')\n", " ax.spines['left'].set_position(('data',0))\n", "\n", " plt.annotate(r'$\\theta_0$',\n", " xy=(-.23,0), xycoords='data',\n", " xytext=(-50, +50), textcoords='offset points', fontsize=26,\n", " arrowprops=dict(arrowstyle=\"->\"))\n", "\n", " plt.show()" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAcwAAAEeCAYAAAAHLSWiAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3de1yUZf7/8fcoZzEVT7mmwapYQsUqth5yKaxdUpHWFHTDxNrU1HbxlNpiWlp00KLdVkOtNA+PBH0Y5LElxbJsk3bZDAo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rl19+2dmlAGimCEy4BIvFohUrVmjJkiU6efKks8sB0AwRmHAZvXv31rRp0/SnP/3J2aUAaIYITLiU+fPn67PPPtPbb7/t7FIANDMEJlyKl5eXli9frunTp+unn35ydjkAmhECEy7nzjvv1JAhQ/TEE084uxQAzQiBCZe0bNkyrV27Vv/5z3+cXQqAZoLAhEvq3LmzlixZoilTpqisrMzZ5QBoBghMuKw//vGPatGihVauXOnsUgA0AwQmXFaLFi30yiuvaMGCBTp16pSzywHQxBGYcGk33XSTHnjgAc2cOdPZpQBo4ghMuLzHH39cBw4c0DvvvGPXt3r1amVkZDihKgBNDYEJl9eqVSu9/PLLmjp1qi5evGjTl5+fr48++shJlQFoSghMNAnDhw9XSEiInn76aZv2zp078/kmgHpBYKLJeOmll7RixQp9/vnn1rZrr71W3377rROrAtBUEJhoMrp27arHH39cDz/8sAzDkHQlMDnDBFAfCEy4rLNnz+rw4cM2bdOmTdNPP/2kN954QxJvyQKoPwQmXFZ+fr5uu+02zZo1Sz/++KMkqWXLlkpOTtbcuXN19uxZ3pIFUG8ITLis0NBQffbZZzp79qz69OmjLVu2yDAM9evXTzExMXr00Ud1zTXX6PLlyyosLHR2uQBcHIEJl9apUyetWbNG69ev14IFCzRixAjl5+dr8eLFeuedd7R//3517tyZs0wAdUZgokkICwtTdna2brvtNoWGhurll1/W888/r8mTJ9fpc8wTJ05o9OjRatOmja655hqNGjVKX331lamxRUVFmjNnjrp06SJvb28NHDhQ7733Xq3qAOB8BCaaDA8PD82fP19ZWVn64IMP9OSTT6pNmzb64YcfanWGWVhYqPDwcH3xxRdau3at1q1bpyNHjuiOO+7QhQsXqh3/4IMPatWqVXryySe1bds2denSRb/73e+UnZ1dm6cHwMncnF0AUN8CAgK0bds2bd26VY888oi++eYbHTp0SFLfGj3OqlWrdOzYMeXl5alnz56SpJtvvlm9evVScnJylevX/uc//9HGjRv12muvaeLEiZKunAUHBQXp8ccfV3p6eq2fHwDn4AwTTZLFYtGoUaOUl5en4cOHy8vLq8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31r0MD08fGx+3NHjtKjRw95enraLZ5dVFSkY8eOacyYMQ1Sh7PVdJ8HBQWpuLhYX375pc1nCeWfH1S36HhFqjrbb07qupj71q1bVVhYaPMLJYu5V60u+7wylZ0JoW4cceypb0120o+Hh4ciIiKUkpKikpISa/vmzZtVXFxc7eLZzVVERIQ8PDy0YcMGm/b169crODhYAQEBNX7MjRs3ymKxqH///vVVpktiMfeGV5d9XpEffvhB27dv169//ev6LBNyzLGn3lV2vYnRSK7DPHjwoJGammps2rTJkGSMGTPGSE1NNVJTU40LFy5Yt3vggQeMli1b2oz997//bXh5eRm///3vjYyMDGP16tVGu3btjNGjRzf003Apc+fONTw9PY1ly5YZe/fuNaZMmWJYLBYjPT3dZrvw8HCjR48e1vsFBQXGkCFDjL///e/G7t27jfT0dGPixImGxWIxpkyZ0tBPw46zr8P86aefjB49ehjBwcHGW2+9ZaSlpRk333yzERAQYPz444/W7QoKCgxJxhNPPGEzPiYmxmjbtq2xatUqIyMjw7j33nsNT09PrimuQk32ecuWLW32+fPPP2/88Y9/NDZs2GDs3bvXWLNmjREcHGy4u7sb7733njOejssoP0ZPmTLFkGQsX77cSE1NNTIzM63btGzZ0njggQdsxpk99jSACjOx0QfmhAkTDF1Z09bu9vOLYcu3u9q+ffuMAQMGGJ6enkanTp2MP//5zzZBC3slJSXG4sWLje7duxseHh7GTTfdZKSmptptFxYWZlx//fXW+2fPnjWioqKM7t27G56enoaXl5fxq1/9yvjb3/5mczGzszg7MA3DMI4fP26MGjXKaN26teHr62tERUXZXdSdn59f4SIdhYWFxowZM4zOnTsbnp6exq233mrs3bu3wWp3VbXd5+np6cagQYOM9u3bG25uboafn58RGRlp/POf/2zYJ+CCKjtmh4WF2WwzYcIEm3Fmjz0NoMJMZPF1NBssvg7AJNdcfB0AgMaAwAQAwAQCEwAAEwhMAABMIDABADCBwAQAwAQCEwAAEwhMAABMIDABADCBwAQAwAQCEwAAEwhMAABMIDABADCBwAQAwAQCEwAAEwhMAABMIDABADCBwAQ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Xo3PMNHslBUXat++fXbt+/btU1hYmPWHp7bKA7amfRs2bNDmzZt17tw5Xb58uU41AKh/lqp+gCVV2dnQ/Odtd3YJcHHebhbFhvjp3uC2Ffb7+Pioe/fuNm0lJSVyd3fXwoULTV1a8vnnn6tPnz7auHGjxo0bZ9PXp08fBQUFKTU1tcrHCA0NVVZWVrXfC4BDWCpqdKkzzIJnhju7BKBaPXr0kKenp3Jycmzai4qKdOzYMY0ZM8ZJlQGoCyb9APXMw8NDERERSklJUUlJibV98+bNKi4u1siRI51YHYDacqkzTKAhZWVlqaCgQGVlZZKk3Nxcbd68WZI0bNgw+fj4SJIefPBBrV271iYcFy1apIEDByo6OlrTpk1TQUGB5syZo9GjR6tfv34N/2QA1BmBCVTi5Zdf1tq1a633U1NTrZ895ufny9/fX5JUWlqq0tJSm7Hls2Xnzp2r4cOHq02bNrr//vv19NNPN1j9AOqXS036AZoLJv0ATlXhpB8+wwQAwAQCEwAAEwhMAABMIDABADCBwAQAwAQCEwAAEwhMAABMIDABADCBwAQAwAQCEwAAEwhMAABMIDABADCBwAQAwAQCEwAAEwhMAABMIDABADChuj8gDcAJLBbLLsMwIpxdB4D/j8AEAMAE3pIFAMAEAhMAABMITAAATCAwAQAwgcAEAMCE/weovYTBIgUU4wAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "bipolar_plot()" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Perceptron – schemat\n", "\n", "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "#### Perceptron – zasada działania\n", "\n", "1. Ustal wartości początkowe $\\theta$ (wektor 0 lub liczby losowe blisko 0).\n", "1. Dla każdego przykładu $(x^{(i)}, y^{(i)})$, dla $i=1,\\ldots,m$\n", " * Oblicz wartość wyjścia $o^{(i)} = g(\\theta^{T}x^{(i)}) = g(\\sum_{j=0}^{n} \\theta_jx_j^{(i)})$\n", " * Wykonaj aktualizację wag (tzw. *perceptron rule*):\n", " $$ \\theta := \\theta + \\Delta \\theta $$\n", " $$ \\Delta \\theta = \\alpha(y^{(i)}-o^{(i)})x^{(i)} $$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "$$\\theta_j := \\theta_j + \\Delta \\theta_j $$\n", "\n", "Jeżeli przykład został sklasyfikowany **poprawnie**:\n", "\n", "* $y^{(i)}=1$ oraz $o^{(i)}=1$ : $$\\Delta\\theta_j = \\alpha(1 - 1)x_j^{(i)} = 0$$\n", "* $y^{(i)}=-1$ oraz $o^{(i)}=-1$ : $$\\Delta\\theta_j = \\alpha(-1 - -1)x_j^{(i)} = 0$$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "Czyli: jeżeli trafiłeś, to nic nie zmieniaj." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "$$\\theta_j := \\theta_j + \\Delta \\theta_j $$\n", "\n", "Jeżeli przykład został sklasyfikowany **niepoprawnie**:\n", "\n", "* $y^{(i)}=1$ oraz $o^{(i)}=-1$ : $$\\Delta\\theta_j = \\alpha(1 - -1)x_j^{(i)} = 2 \\alpha x_j^{(i)}$$\n", "* $y^{(i)}=-1$ oraz $o^{(i)}=1$ : $$\\Delta\\theta_j = \\alpha(-1 - 1)x_j^{(i)} = -2 \\alpha x_j^{(i)}$$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "Czyli: przesuń wagi w odpowiednią stronę." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Perceptron – zalety\n", "\n", "* intuicyjny i prosty\n", "* łatwy w implementacji\n", "* jeżeli dane można liniowo oddzielić, algorytm jest zbieżny w skończonym czasie" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Perceptron – wady\n", "\n", "* jeżeli danych nie można oddzielić liniowo, algorytm nie jest zbieżny" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "def plot_perceptron():\n", " plt.figure(figsize=(12,3))\n", "\n", " plt.subplot(131)\n", " plt.ylim(-0.2,1.2)\n", " plt.xlim(-0.2,1.2)\n", "\n", " plt.title('AND')\n", " plt.plot([1,0,0], [0,1,0], 'ro', markersize=10)\n", " plt.plot([1], [1], 'go', markersize=10)\n", "\n", " ax = plt.gca()\n", " ax.spines['right'].set_color('none')\n", " ax.spines['top'].set_color('none')\n", " ax.xaxis.set_ticks_position('none')\n", " ax.spines['bottom'].set_position(('data',0))\n", " ax.yaxis.set_ticks_position('none')\n", " ax.spines['left'].set_position(('data',0))\n", "\n", " plt.xticks(np.arange(0, 2, 1.0))\n", " plt.yticks(np.arange(0, 2, 1.0))\n", "\n", "\n", " plt.subplot(132)\n", " plt.ylim(-0.2,1.2)\n", " plt.xlim(-0.2,1.2)\n", "\n", " plt.plot([1,0,1], [0,1,1], 'go', markersize=10)\n", " plt.plot([0], [0], 'ro', markersize=10)\n", "\n", " ax = plt.gca()\n", " ax.spines['right'].set_color('none')\n", " ax.spines['top'].set_color('none')\n", " ax.xaxis.set_ticks_position('none')\n", " ax.spines['bottom'].set_position(('data',0))\n", " ax.yaxis.set_ticks_position('none')\n", " ax.spines['left'].set_position(('data',0))\n", "\n", " plt.title('OR')\n", " plt.xticks(np.arange(0, 2, 1.0))\n", " plt.yticks(np.arange(0, 2, 1.0))\n", "\n", "\n", " plt.subplot(133)\n", " plt.ylim(-0.2,1.2)\n", " plt.xlim(-0.2,1.2)\n", "\n", " plt.title('XOR')\n", " plt.plot([1,0], [0,1], 'go', markersize=10)\n", " plt.plot([0,1], [0,1], 'ro', markersize=10)\n", "\n", " ax = plt.gca()\n", " ax.spines['right'].set_color('none')\n", " ax.spines['top'].set_color('none')\n", " ax.xaxis.set_ticks_position('none')\n", " ax.spines['bottom'].set_position(('data',0))\n", " ax.yaxis.set_ticks_position('none')\n", " ax.spines['left'].set_position(('data',0))\n", "\n", " plt.xticks(np.arange(0, 2, 1.0))\n", " plt.yticks(np.arange(0, 2, 1.0))\n", "\n", " plt.show()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAqwAAADGCAYAAAAXMtIlAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAWVUlEQVR4nO3df5DUd33H8dd7cRO5XJYcaUQn1YEh0Qop2IYqmBACiS1YQ1J6RB1Bo2PUOUwnV5z6MzVJUepUClYnJiZq6FG1sM4kqYBOmhFsMFQ5M57lgt4dXEhik4YcJnCXHyu8+8f3e7C3t7e3y+339nN3z8fMdzb3/X73u5/95vPm+9rvfr+fNXcXAAAAEKpUrRsAAAAAlEJgBQAAQNAIrAAAAAgagRUAAABBI7ACAAAgaARWAAAABI3ACgAAgKARWEeJmW03Mzez/ymxjsfTz4ZYfmW8fFPB/HvznutmljOzHjP7VbzsXWY2qdrvCZhozOwdZpY1s6fM7GUzO2JmPzazj5jZq4qs311QmyfM7Fkz22lmy2rxHoDxwMw+GdfU14ZY/iYz6zOzg2Z2TsGyt5lZi5k9bmYvmdlRM/upma01s8lDbO/hIrXcY2a7zOy9SbxHDGT8cEDyzOx1kp5Q9AHBJL3V3X9eZL38/xmN7v79guVXSvqxpK+4+8158++V9AFJd0l6On6djKQ3S1ooabKkn0l6t7t3V+t9ARNFHEbvkvQhSccl/UDSIUnnS1om6fWS9kl6l7s/k/e8bkmvlfSP8ayzFdXlNYrq9APu/q+j8y6A8SM+CbNH0lslLXH3XQXLHpb0tiLLvijp05JelrRT0q8l1Uv6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NHy5ctr2DIAxVCzwNhBvWI8qelPs/b29mru3LmaPHmy1q1bp7Vr1+qcc87RsWPH1NbWpvr6+iRfHmNYNpuVJD300EO68847dccdd+iCCy7QBRdcoEWLFiX50hP6px6pWZwJ6nVI1CuCU8N6lUrUbE0DqyQdPnxYzc3NevDBB9Xb26trrrlGmzZt0vTp05N+aYxhxW4kkKRFixZp165dib50khuvAmoWwaFeh0S9Ijg1rFcp5MCab968edq3b99oviRQqQl/AMxHzSJw1Gse6hVjwJA1W/NhrQAAAIBSCKwAAAAIGoEVAAAAQRvuGtZRZWY/dPeltW4HgPJQs8DYQb1iLAsqsAIAAACFuCQAAAAAQSOwAgAAIGgEVgAAAASNwAoAAICgEVgBAAAQtP8HLYi+hk3C0xEAAAAASUVORK5CYII=\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "plot_perceptron()" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Funkcje aktywacji\n", "\n", "Zamiast funkcji bipolarnej możemy zastosować funkcję sigmoidalną jako funkcję aktywacji." ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "def plot_activation_functions():\n", " plt.figure(figsize=(16,7))\n", " plt.subplot(121)\n", " x = [-2,-.23,2] \n", " y = [-1, -1, 1]\n", " plt.ylim(-1.2,1.2)\n", " plt.xlim(-2.2,2.2)\n", " plt.plot([-2,2],[1,1], color='black', ls=\"dashed\")\n", " plt.plot([-2,2],[-1,-1], color='black', ls=\"dashed\")\n", " plt.step(x, y, lw=3)\n", " ax = plt.gca()\n", " ax.spines['right'].set_color('none')\n", " ax.spines['top'].set_color('none')\n", " ax.xaxis.set_ticks_position('bottom')\n", " ax.spines['bottom'].set_position(('data',0))\n", " ax.yaxis.set_ticks_position('left')\n", " ax.spines['left'].set_position(('data',0))\n", "\n", " plt.annotate(r'$\\theta_0$',\n", " xy=(-.23,0), xycoords='data',\n", " xytext=(-50, +50), textcoords='offset points', fontsize=26,\n", " arrowprops=dict(arrowstyle=\"->\"))\n", "\n", " plt.subplot(122)\n", " x2 = np.linspace(-2,2,100)\n", " y2 = np.tanh(x2+ 0.23)\n", " plt.ylim(-1.2,1.2)\n", " plt.xlim(-2.2,2.2)\n", " plt.plot([-2,2],[1,1], color='black', ls=\"dashed\")\n", " plt.plot([-2,2],[-1,-1], color='black', ls=\"dashed\")\n", " plt.plot(x2, y2, lw=3)\n", " ax = plt.gca()\n", " ax.spines['right'].set_color('none')\n", " ax.spines['top'].set_color('none')\n", " ax.xaxis.set_ticks_position('bottom')\n", " ax.spines['bottom'].set_position(('data',0))\n", " ax.yaxis.set_ticks_position('left')\n", " ax.spines['left'].set_position(('data',0))\n", "\n", " plt.annotate(r'$\\theta_0$',\n", " xy=(-.23,0), xycoords='data',\n", " xytext=(-50, +50), textcoords='offset points', fontsize=26,\n", " arrowprops=dict(arrowstyle=\"->\"))\n", "\n", " plt.show()" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAA4sAAAGKCAYAAACl0NTvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nOzdd3hUZfrG8XvSOxAIEHrokEgNCCKigIIi4KJiWVxAWXApKygqKEVWFHVRwZ+A4NqWoiAugqAioOCKsvSW0CGhk0ACCenJnN8fWQazQwlkMicz8/1cVy7zvmfOzJM45Mmdc857LIZhCAAAAACA3/MyuwAAAAAAQNlDWAQAAAAA2CEsAgAAAADsEBYBAAAAAHYIiwAAAAAAOz7X2c5SqUAxdO/eXd9//73ZZQCuwGJ2AW6A3gwUA70ZKLar9maOLAIOcPbsWbNLAAAAv0NvBkqOsAgAAAAAsENYBAAAAADYISwCAAAAAOwQFgEAAAAAdgiLAAAAAAA7hEUAAAAAgB3CIgAAAADADmERAAAAAGCHsAgAAAAAsENYBAAAAADYISwCAAAAAOwQFgEAAAAAdgiLAAAAAAA7hEUAAAAAgB3CIgAAAADADmERAAAAAGCHsAgAAAAAsENYBAAAAADYISwCAAAAAOwQFgEAAAAAdgiLAAAAAAA7hEUAAAAAgB3CIgAAAADADmERAAAAAGCHsAgAAAAAsENYhNs4fvy4RowYofbt2ysoKEgWi0UJCQnF2tdqtWrKlCmqU6eOAgIC1Lx5c3311VelWzAAAG6O3gy4NsIi3MbBgwe1aNEiVahQQR07dryhfcePH69XXnlFw4cP13fffad27drp4Ycf1rfffltK1QIA4P7ozYBrsxiGca3t19wIlCVWq1VeXoV///jHP/6hP//5zzpy5Ijq1Klzzf2SkpJUs2ZNjRkzRpMmTbLNd+nSRcnJydq5c+d1Xzs2NlabN28uUf2Ah7CYXYAboDfDZdCbAZdw1d7MkUW4jUvN6EatXLlSubm56tevX5H5fv36adeuXTpy5IgjygMAwOPQmwHX5rQji3feeafdXN++fTV06FBlZmbqvvvus9s+YMAADRgwQGfPntVDDz1kt/0vf/mLHnnkER07dkxPPPGE3fbnnntOPXv21L59+zRkyBC77ePGjVPXrl21fft2jRw50m7766+/rttuu02//vqrXnrpJbvt06ZNU4sWLbR69WpNnjzZbvvs2bPVqFEjffPNN3r77bftts+dO1c1a9bUwoULNWvWLLvtixcvVqVKlfTpp5/q008/tdv+7bffKigoSDNnztSiRYvstq9du1aSNHXqVC1fvrzItsDAQH333XeSpFdffVVr1qwpsr1ixYq26wLGjh2r3377rcj2GjVqaN68eZKkkSNHavv27UW2N2zYUHPmzJEkDR48WPv37y+yvUWLFpo2bZqkwh/8x48fL7K9ffv2mjJliiTpwQcf1Llz54ps79Kli8aPHy9Juvfee5WVlVVke0REhBYvXqwjR45owIABtvkLkbE6X6ODDG8/OdKpz0Yqsv80hz4nUBYlvNGj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AADk91ud3YPgMszmUwFdrt9vLP7AAAAP2BuBu4fYREAAAAAYMBtqAAAAAAAA8IiAAAAAMCAsAgAAAAAMCAsAgAAAAAMCIsAAAAAAIP/Ao9YXFZFum1OAAAAAElFTkSuQmCC\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "plot_activation_functions()" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Perceptron a regresja liniowa" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Uczenie regresji liniowej:\n", "* Model: $$h_{\\theta}(x) = \\sum_{i=0}^n \\theta_ix_i$$\n", "* Funkcja kosztu (błąd średniokwadratowy): $$J(\\theta) = \\frac{1}{m} \\sum_{i=1}^{m} (h_{\\theta}(x^{(i)}) - y^{(i)})^2$$\n", "* Po obliczeniu $\\nabla J(\\theta)$ - zwykły SGD." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Perceptron a dwuklasowa regresja logistyczna" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Uczenie dwuklasowej regresji logistycznej:\n", "* Model: $h_{\\theta}(x) = \\sigma(\\sum_{i=0}^n \\theta_ix_i) = P(1|x,\\theta)$\n", "* Funkcja kosztu (entropia krzyżowa): $$\\begin{eqnarray} J(\\theta) &=& -\\frac{1}{m} \\sum_{i=1}^{m} \\big( y^{(i)}\\log P(1|x^{(i)},\\theta) \\\\ && + (1-y^{(i)})\\log(1-P(1|x^{(i)},\\theta)) \\big) \\end{eqnarray}$$\n", "* Po obliczeniu $\\nabla J(\\theta)$ - zwykły SGD." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Perceptron a wieloklasowa regresja logistyczna" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Wieloklasowa regresja logistyczna\n", "* Model (dla $c$ klasyfikatorów binarnych): \n", "$$\\begin{eqnarray}\n", "h_{(\\theta^{(1)},\\dots,\\theta^{(c)})}(x) &=& \\mathrm{softmax}(\\sum_{i=0}^n \\theta_{i}^{(1)}x_i, \\ldots, \\sum_{i=0}^n \\theta_i^{(c)}x_i) \\\\ \n", "&=& \\left[ P(k|x,\\theta^{(1)},\\dots,\\theta^{(c)}) \\right]_{k=1,\\dots,c} \n", "\\end{eqnarray}$$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "* Funkcja kosztu (**przymując model regresji binarnej**): $$\\begin{eqnarray} J(\\theta^{(k)}) &=& -\\frac{1}{m} \\sum_{i=1}^{m} \\big( y^{(i)}\\log P(k|x^{(i)},\\theta^{(k)}) \\\\ && + (1-y^{(i)})\\log P(\\neg k|x^{(i)},\\theta^{(k)}) \\big) \\end{eqnarray}$$\n", "* Po obliczeniu $\\nabla J(\\theta)$, **c-krotne** uruchomienie SGD, zastosowanie $\\mathrm{softmax}(X)$ do niezależnie uzyskanych klasyfikatorów binarnych." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "* Przyjmijmy: \n", "$$ \\Theta = (\\theta^{(1)},\\dots,\\theta^{(c)}) $$\n", "\n", "$$h_{\\Theta}(x) = \\left[ P(k|x,\\Theta) \\right]_{k=1,\\dots,c}$$\n", "\n", "$$\\delta(x,y) = \\left\\{\\begin{array}{cl} 1 & \\textrm{gdy } x=y \\\\ 0 & \\textrm{wpp.}\\end{array}\\right.$$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "* Wieloklasowa funkcja kosztu $J(\\Theta)$ (kategorialna entropia krzyżowa):\n", "$$ J(\\Theta) = -\\frac{1}{m}\\sum_{i=1}^{m}\\sum_{k=1}^{c} \\delta({y^{(i)},k}) \\log P(k|x^{(i)},\\Theta) $$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "* Gradient $\\nabla J(\\Theta)$:\n", "$$ \\dfrac{\\partial J(\\Theta)}{\\partial \\Theta_{j,k}} = -\\frac{1}{m}\\sum_{i = 1}^{m} (\\delta({y^{(i)},k}) - P(k|x^{(i)}, \\Theta)) x^{(i)}_j \n", "$$\n", "\n", "* Liczymy wszystkie wagi jednym uruchomieniem SGD" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "## Podsumowanie\n", "\n", "* W przypadku jednowarstowej sieci neuronowej wystarczy znać gradient funkcji kosztu.\n", "* Wtedy liczymy tak samo jak w przypadku regresji liniowej, logistycznej, wieloklasowej logistycznej itp. (wymienione modele to szczególne przypadki jednowarstwowych sieci neuronowych).\n", "* Regresja liniowa i binarna regresja logistyczna to jeden neuron.\n", "* Wieloklasowa regresja logistyczna to tyle neuronów, ile klas." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "Funkcja aktywacji i funkcja kosztu są **dobierane do problemu**." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## 4.2. Funkcje aktywacji" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "* Każda funkcja aktywacji ma swoje zalety i wady.\n", "* Różne rodzaje funkcji aktywacji nadają się do różnych zastosowań." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/pawel/.local/lib/python2.7/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n", " from ._conv import register_converters as _register_converters\n", "Using TensorFlow backend.\n" ] } ], "source": [ "%matplotlib inline\n", "\n", "import math\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import random\n", "\n", "import keras\n", "from keras.datasets import mnist\n", "from keras.models import Sequential\n", "from keras.layers import Dense, Dropout, SimpleRNN, LSTM\n", "from keras.optimizers import Adagrad, Adam, RMSprop, SGD\n", "\n", "from IPython.display import YouTubeVideo" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "def plot(fun):\n", " x = np.arange(-3.0, 3.0, 0.01)\n", " y = [fun(x_i) for x_i in x]\n", " fig = plt.figure(figsize=(14, 7))\n", " ax = fig.add_subplot(111)\n", " fig.subplots_adjust(left=0.1, right=0.9, bottom=0.1, top=0.9)\n", " ax.set_xlim(-3.0, 3.0)\n", " ax.set_ylim(-1.5, 1.5)\n", " ax.grid()\n", " ax.plot(x, y)\n", " plt.show()" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Funkcja logistyczna" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "$$ g(x) = \\frac{1}{1 + e^{-x}} $$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "* Przyjmuje wartości z przedziału $(0, 1)$." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "#### Funkcja logistyczna – wykres" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "slideshow": { "slide_type": "fragment" } }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAA1cAAAG2CAYAAACTRXz+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBo\ndHRwOi8vbWF0cGxv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Sf5D\nkufT+Hdnkvx3VVV9ZeNGxWZQSvlIkl9P4++SLUl+q6qqv7nm/ps5rgAAAG4Um/qyQAAAgBuFuAIA\nAKiBuAIAAKiBuAIAAKiBuAIAAKiBuAIAAKiBuAIAAKiBuAIAAKjB/w8cV2m05IFPywAAAABJRU5E\nrkJggg==\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "plot(lambda x: 1 / (1 + math.exp(-x)))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Tangens hiperboliczny" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "$$ g(x) = \\tanh x = \\frac{e^{x} - e^{-x}}{e^{x} + e^{-x}} $$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "* Przyjmuje wartości z przedziału $(-1, 1)$.\n", "* Powstaje z funkcji logistycznej przez przeskalowanie i przesunięcie." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "#### Tangens hiperboliczny – wykres" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "slideshow": { "slide_type": "fragment" } }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAA1cAAAG2CAYAAACTRXz+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzs3Xd0HOW9h/Hvu7vq1bKKZVtyt9xx\nw6ZjUw0pQCgBQjc4cOEGktz0nnADaeSShCQQejVOaCZ0AqLjinuVu+Si3tuW9/6htRFGsmVrpFlJ\nz+ecPTuzO9r5kTNH8pPZnTXWWgEAAAAAOsfj9gAAAAAA0BsQVwAAAADgAOIKAAAAABxAXAEAAACA\nA4grAAA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BTan+SkVuK/+g7V12oqsOr\nnDoLzAOX/2Ic9chKayPJaeAYcKj6/PKgOvULvxla294B40vG24fnJGlZw/dp5oDZqrrTOo/6p6oW\nkzwEJoBlm+I0f3L1M0l2LRlOAq9aZVG/JJkALgDHq+pz6zySeucpsCvJziQbgJPA3caZJPXUsGnB\nDPCyqq62zqP+SLL1e1fqJJsYNEoaWZP0vVvgHLCbQfevN8DZqvLOo0jyGtgIfByeemwnSSU5AVwH\ntgKLwLOqOtI2lVpJchS4BowBN6pqunEk9UCSW8BBYAvwHrhcVTNNQ6m5JAeAR8BzBtedABerar5d\nKvVBkj3ATQb/JeuA21V1ZeT8PhdXkiRJkvS/6PW2QEmSJEn6X1hcSZIkSVIHLK4kSZIkqQMWV5Ik\nSZLUAYsrSZIkSeqAxZUkSZIkdcDiSpIkSZI6YHElSZIkSR34Bikt02UAw3ESAAAAAElFTkSuQmCC\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "plot(lambda x: math.tanh(x))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### ReLU (*Rectifier Linear Unit*)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "$$ g(x) = \\max(0, x) $$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "#### ReLU – zalety\n", "* Mniej podatna na problem zanikającego gradientu (*vanishing gradient*) niż funkcje sigmoidalne, dzięki czemu SGD jest szybciej zbieżna.\n", "* Prostsze obliczanie gradientu.\n", "* Dzięki zerowaniu ujemnych wartości, wygasza neurony, „rozrzedzając” sieć (*sparsity*), co przyspiesza obliczenia." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "#### ReLU – wady\n", "* Dla dużych wartości gradient może „eksplodować”.\n", "* „Wygaszanie” neuronów." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "#### ReLU – wykres" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "slideshow": { "slide_type": "fragment" } }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAA1cAAAG2CAYAAACTRXz+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAGJhJREFUeJzt3X+sZOd91/HPN/6RRQk0AS+NYzvE\npdalpkBLLNcRVbkmTnFMFTelkWwhkQDVtgirBQmBi0UCgUitkABBItpVY9VJo6QWqZul2eIkda7d\nCNzaiZzWXmfdxQR2t4lN7CT0KmnM1g9/7Gx7vZ659+7Oc2fOzLxe0tXOj7PzPH98vfbb58zZaq0F\nAACA6bxk3hsAAABYBuIKAACgA3EFAADQgbgCAADoQFwBAAB0IK4AAAA66BJXVXVnVT1dVY9OeH+9\nqr5WVY+Mft7RY10AAIChuLDT5/x8kvckef82x/x6a+0HOq0HAAAwKF3OXLXWHkjybI/PAgAAWESz\n/M7V66vqc1X1q1X152e4LgAAwJ7rdVngTj6b5M+01jar6qYkv5zkqnEHVtWBJAeSZN++fa97zWte\nM6Mtsiief/75vOQl7sXCC5kLJjEbjGMukme+0fJ7/6/lWy6uvHJfzXs7g2E2GOeJJ574cmtt/07H\nVWuty4JV9dokv9Ja+85dHPuFJNe01r683XFra2vt6NGjXfbH8tjY2Mj6+vq8t8HAmAsmMRuMs8pz\n0VrLP//oo/mFB/93fvSvfltuv/HPpUpcnbHKs8FkVfWZ1to1Ox03kyyvqlfV6J/aqrp2tO4zs1gb\nAIDThBXsrS6XBVbVh5KsJ7mkqk4keWeSi5KktfYzSX44yd+vqlNJvpHkltbrlBkAADsSVrD3usRV\na+3WHd5/T07fqh0AgBkTVjAbvq0HALDEhBXMjrgCAFhSwgpmS1wBACwhYQWzJ64AAJaM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TfDXJI621vz7fXTEvVXVTkn+f5IIkd7bW3j3nLTEAVfWhJOtJLkny\nVJJ3ttbeN9dNMXdV9b1Jfj3Jb+f0f3cmyT9rrR2e364Ygqr6i0nuyul/l7wkyd2ttXdNPH7IcQUA\nALAoBn1ZIAAAwKIQVwAAAB2IKwAAgA7EFQAAQAfiCgAAoANxBQAA0IG4AgAA6EBcAQAAdPD/AVNA\ngTNkBNHAAAAAAElFTkSuQmCC\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "plot(lambda x: max(0, x))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Softplus" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "$$ g(x) = \\log(1 + e^{x}) $$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "* Wygładzona wersja ReLU." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "#### Softplus – wykres" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "slideshow": { "slide_type": "fragment" } }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAA1cAAAG2CAYAAACTRXz+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzt3Xd0XOWd//HPV733YlmWuyz3go0J\nJWCHXoIDgQCppKxDyi7pIWEDu+THhkAKKbtJ2IQEshAgEEIzmBaFboONuy13W5Zly+oa9dE8vz80\nNsZItrCudUfS+3WOjmdGF93vnvOs7HfunWfMOScAAAAAQP9E+T0AAAAAAAwFxBUAAAAAeIC4AgAA\nAAAPEFcAAAAA4AHiCgAAAAA8QFwBAAAAgAc8iSszu9vMqsxsXS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WD46RuSRvk5DyKDc26jc67M7zkQEeZL2uqc2+6c65D0gKRFPs+ECOCc\ne0lSrd9zILI45yqdcyvDj5skbZRU6O9UiASuWyD8NDb81WuTRHRcSZKZ3Wpm5ZI+Iekmv+dBRPqc\npKf9HgJARCmUVH7Y8z3iH0oA+sDMxkqaI2mZv5MgUphZtJmtklQl6TnnXK9rw/e4MrPnzWxdD1+L\nJMk5d6NzrkjSfZK+6u+0GEjHWhvhY26UFFT3+sAw0Jd1AQDA8TCzFEmPSPraEXdQYRhzznU552ar\n+06p+WbW6y3F/fqcKy84587p46H3SVoi6eYTOA4iyLHWhpldK+kSSWe7SH7zIDz1Pn5nYHirkFR0\n2PNR4dcAoEfh99M8Iuk+59zf/J4Hkcc5V29m/5B0gaQeN8Xx/crV0ZhZ8WFPF0na5NcsiCxmdoGk\n70i61DnX4vc8ACLOm5KKzWycmcVJulrS4z7PBCBChTct+IOkjc65n/k9DyKHmeUe3JXazBLVvVFS\nr00S6bsFPiKpRN27f+2SdJ1zjv/lETKzrZLiJdWEX3qDnSRhZpdJ+pWkXEn1klY55873dyr4xcwu\nknSnpGhJdzvnbvV5JEQAM/uLpAWSciTtl3Szc+4Pvg4F35nZGZJelrRW3f/ulKTvO+eW+DcVIoGZ\nzZR0j7r/LomS9JBz7pZej4/kuAIAAACAwSKibwsEAAAAgMGCuAIAAAAADxBXAAAAAOAB4goAAAAA\nPEBcAQAAAIAHiCsAAAAA8ABxBQAAAAAeIK4AAAAAwAP/H1Jy90TyLtqpAAAAAElFTkSuQmCC\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "plot(lambda x: math.log(1 + math.exp(x)))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Problem zanikającego gradientu (*vanishing gradient problem*)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "* Sigmoidalne funkcje aktywacji ograniczają wartości na wyjściach neuronów do niewielkich przedziałów ($(-1, 1)$, $(0, 1)$ itp.).\n", "* Jeżeli sieć ma wiele warstw, to podczas propagacji wstecznej mnożymy przez siebie wiele małych wartości → obliczony gradient jest mały.\n", "* Im więcej warstw, tym silniejszy efekt zanikania." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "#### Sposoby na zanikający gradient\n", "\n", "* Modyfikacja algorytmu optymalizacji (*RProp*, *RMSProp*)\n", "* Użycie innej funckji aktywacji (ReLU, softplus)\n", "* Dodanie warstw *dropout*\n", "* Nowe architektury (LSTM itp.)\n", "* Więcej danych, zwiększenie mocy obliczeniowej" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## 4.3. Wielowarstwowe sieci neuronowe\n", "\n", "czyli _Artificial Neural Networks_ (ANN) lub _Multi-Layer Perceptrons_ (MLP)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Architektura sieci\n", "\n", "* Sieć neuronowa jako graf neuronów. \n", "* Organizacja sieci przez warstwy.\n", "* Najczęściej stosowane są sieci jednokierunkowe i gęste." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "* $n$-warstwowa sieć neuronowa ma $n+1$ warstw (nie liczymy wejścia).\n", "* Rozmiary sieci określane poprzez liczbę neuronów lub parametrów." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Sieć neuronowa jednokierunkowa (*feedforward*)\n", "\n", "* Mając daną $n$-warstwową sieć neuronową oraz jej parametry $\\Theta^{(1)}, \\ldots, \\Theta^{(L)} $ oraz $\\beta^{(1)}, \\ldots, \\beta^{(L)} $ liczymy:

\n", "$$a^{(l)} = g^{(l)}\\left( a^{(l-1)} \\Theta^{(l)} + \\beta^{(l)} \\right). $$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "* Funkcje $g^{(l)}$ to tzw. **funkcje aktywacji**.
\n", "Dla $i = 0$ przyjmujemy $a^{(0)} = \\mathrm{x}$ (wektor wierszowy cech) oraz $g^{(0)}(x) = x$ (identyczność)." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "* Parametry $\\Theta$ to wagi na połączeniach miedzy neuronami dwóch warstw.
\n", "Rozmiar macierzy $\\Theta^{(l)}$, czyli macierzy wag na połączeniach warstw $a^{(l-1)}$ i $a^{(l)}$, to $\\dim(a^{(l-1)}) \\times \\dim(a^{(l)})$." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "* Parametry $\\beta$ zastępują tutaj dodawanie kolumny z jedynkami do macierzy cech.
Macierz $\\beta^{(l)}$ ma rozmiar równy liczbie neuronów w odpowiedniej warstwie, czyli $1 \\times \\dim(a^{(l)})$." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "* **Klasyfikacja**: dla ostatniej warstwy $L$ (o rozmiarze równym liczbie klas) przyjmuje się $g^{(L)}(x) = \\mathop{\\mathrm{softmax}}(x)$.\n", "* **Regresja**: pojedynczy neuron wyjściowy jak na obrazku. Funkcją aktywacji może wtedy być np. funkcja identycznościowa." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "* Pozostałe funkcje aktywacji najcześciej mają postać sigmoidy, np. sigmoidalna, tangens hiperboliczny.\n", "* Mogą mieć też inny kształt, np. ReLU, leaky ReLU, maxout." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Jak uczyć sieci neuronowe?" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "* W poznanych do tej pory algorytmach (regresja liniowa, regresja logistyczna) do uczenia używaliśmy funkcji kosztu, jej gradientu oraz algorytmu gradientu prostego (GD/SGD)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "* Dla sieci neuronowych potrzebowalibyśmy również znaleźć gradient funkcji kosztu." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "* Sprowadza się to do bardziej ogólnego problemu:
jak obliczyć gradient $\\nabla f(x)$ dla danej funkcji $f$ i wektora wejściowego $x$?" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## 4.4. Metoda propagacji wstecznej – wprowadzenie" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Pochodna funkcji\n", "\n", "* **Pochodna** mierzy, jak szybko zmienia się wartość funkcji względem zmiany jej argumentów:\n", "\n", "$$ \\frac{d f(x)}{d x} = \\lim_{h \\to 0} \\frac{ f(x + h) - f(x) }{ h } $$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Pochodna cząstkowa i gradient\n", "\n", "* **Pochodna cząstkowa** mierzy, jak szybko zmienia się wartość funkcji względem zmiany jej *pojedynczego argumentu*." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "* **Gradient** to wektor pochodnych cząstkowych:\n", "\n", "$$ \\nabla f = \\left( \\frac{\\partial f}{\\partial x_1}, \\ldots, \\frac{\\partial f}{\\partial x_n} \\right) $$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "#### Gradient – przykłady" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "$$ f(x_1, x_2) = x_1 + x_2 \\qquad \\to \\qquad \\frac{\\partial f}{\\partial x_1} = 1, \\quad \\frac{\\partial f}{\\partial x_2} = 1, \\quad \\nabla f = (1, 1) $$ " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "$$ f(x_1, x_2) = x_1 \\cdot x_2 \\qquad \\to \\qquad \\frac{\\partial f}{\\partial x_1} = x_2, \\quad \\frac{\\partial f}{\\partial x_2} = x_1, \\quad \\nabla f = (x_2, x_1) $$ " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "$$ f(x_1, x_2) = \\max(x_1 + x_2) \\hskip{12em} \\\\\n", "\\to \\qquad \\frac{\\partial f}{\\partial x_1} = \\mathbb{1}_{x \\geq y}, \\quad \\frac{\\partial f}{\\partial x_2} = \\mathbb{1}_{y \\geq x}, \\quad \\nabla f = (\\mathbb{1}_{x \\geq y}, \\mathbb{1}_{y \\geq x}) $$ " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Własności pochodnych cząstkowych\n", "\n", "Jezeli $f(x, y, z) = (x + y) \\, z$ oraz $x + y = q$, to:\n", "$$f = q z,\n", "\\quad \\frac{\\partial f}{\\partial q} = z,\n", "\\quad \\frac{\\partial f}{\\partial z} = q,\n", "\\quad \\frac{\\partial q}{\\partial x} = 1,\n", "\\quad \\frac{\\partial q}{\\partial y} = 1 $$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Reguła łańcuchowa\n", "\n", "$$ \\frac{\\partial f}{\\partial x} = \\frac{\\partial f}{\\partial q} \\, \\frac{\\partial q}{\\partial x},\n", "\\quad \\frac{\\partial f}{\\partial y} = \\frac{\\partial f}{\\partial q} \\, \\frac{\\partial q}{\\partial y} $$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Propagacja wsteczna – prosty przykład" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "# Dla ustalonego wejścia\n", "x = -2; y = 5; z = -4" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "slideshow": { "slide_type": "fragment" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(3, -12)\n" ] } ], "source": [ "# Krok w przód\n", "q = x + y\n", "f = q * z\n", "print(q, f)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "slideshow": { "slide_type": "fragment" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[-4, -4, 3]\n" ] } ], "source": [ "# Propagacja wsteczna dla f = q * z\n", "dz = q\n", "dq = z\n", "# Propagacja wsteczna dla q = x + y\n", "dx = 1 * dq # z reguły łańcuchowej\n", "dy = 1 * dq # z reguły łańcuchowej\n", "print([dx, dy, dz])" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "* Właśnie tak wygląda obliczanie pochodnych metodą propagacji wstecznej!" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "* Spróbujmy czegoś bardziej skomplikowanego:
metodą propagacji wstecznej obliczmy pochodną funkcji sigmoidalnej." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Propagacja wsteczna – funkcja sigmoidalna" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "Funkcja sigmoidalna:\n", "\n", "$$f(\\theta,x) = \\frac{1}{1+e^{-(\\theta_0 x_0 + \\theta_1 x_1 + \\theta_2)}}$$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "$$\n", "\\begin{array}{lcl}\n", "f(x) = \\frac{1}{x} \\quad & \\rightarrow & \\quad \\frac{df}{dx} = -\\frac{1}{x^2} \\\\\n", "f_c(x) = c + x \\quad & \\rightarrow & \\quad \\frac{df}{dx} = 1 \\\\\n", "f(x) = e^x \\quad & \\rightarrow & \\quad \\frac{df}{dx} = e^x \\\\\n", "f_a(x) = ax \\quad & \\rightarrow & \\quad \\frac{df}{dx} = a \\\\\n", "\\end{array}\n", "$$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[0.3932238664829637, -0.5898357997244456]\n", "[-0.19661193324148185, -0.3932238664829637, 0.19661193324148185]\n" ] } ], "source": [ "# Losowe wagi i dane\n", "w = [2,-3,-3]\n", "x = [-1, -2]\n", "\n", "# Krok w przód\n", "dot = w[0]*x[0] + w[1]*x[1] + w[2]\n", "f = 1.0 / (1 + math.exp(-dot)) # funkcja sigmoidalna\n", "\n", "# Krok w tył\n", "ddot = (1 - f) * f # pochodna funkcji sigmoidalnej\n", "dx = [w[0] * ddot, w[1] * ddot]\n", "dw = [x[0] * ddot, x[1] * ddot, 1.0 * ddot]\n", "\n", "print(dx)\n", "print(dw)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Obliczanie gradientów – podsumowanie" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "* Gradient $f$ dla $x$ mówi, jak zmieni się całe wyrażenie przy zmianie wartości $x$." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "* Gradienty łączymy, korzystając z **reguły łańcuchowej**." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "* W kroku \"wstecz\" gradienty informują, które części grafu powinny być zwiększone lub zmniejszone (i z jaką siłą), aby zwiększyć wartość na wyjściu." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "* W kontekście implementacji chcemy dzielić funkcję $f$ na części, dla których można łatwo obliczyć gradienty." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## 4.5. Uczenie wielowarstwowych sieci neuronowych metodą propagacji wstecznej" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "Mając algorytm SGD oraz gradienty wszystkich wag, moglibyśmy trenować każdą sieć." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "* Niech $\\Theta = (\\Theta^{(1)},\\Theta^{(2)},\\Theta^{(3)},\\beta^{(1)},\\beta^{(2)},\\beta^{(3)})$\n", "* Funkcja sieci neuronowej z grafiki:\n", "$$\\small h_\\Theta(x) = \\tanh(\\tanh(\\tanh(x\\Theta^{(1)}+\\beta^{(1)})\\Theta^{(2)} + \\beta^{(2)})\\Theta^{(3)} + \\beta^{(3)})$$\n", "* Funkcja kosztu dla regresji:\n", "$$J(\\Theta) = \\dfrac{1}{2m} \\sum_{i=1}^{m} (h_\\Theta(x^{(i)})- y^{(i)})^2 $$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "* Jak obliczymy gradienty?\n", "\n", "$$\\nabla_{\\Theta^{(l)}} J(\\Theta) = ? \\quad \\nabla_{\\beta^{(l)}} J(\\Theta) = ?$$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### W kierunku propagacji wstecznej\n", "\n", "* Pewna (niewielka) zmiana wagi $\\Delta z^l_j$ dla $j$-ego neuronu w warstwie $l$ pociąga za sobą (niewielką) zmianę kosztu: \n", "\n", "$$\\frac{\\partial J(\\Theta)}{\\partial z^{l}_j} \\Delta z^{l}_j$$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "* Jeżeli $\\frac{\\partial J(\\Theta)}{\\partial z^{l}_j}$ jest duża, $\\Delta z^l_j$ ze znakiem przeciwnym zredukuje koszt.\n", "* Jeżeli $\\frac{\\partial J(\\Theta)}{\\partial z^l_j}$ jest bliska zeru, koszt nie będzie mocno poprawiony." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "* Definiujemy błąd $\\delta^l_j$ neuronu $j$ w warstwie $l$: \n", "\n", "$$\\delta^l_j := \\dfrac{\\partial J(\\Theta)}{\\partial z^l_j}$$ \n", "$$\\delta^l := \\nabla_{z^l} J(\\Theta) \\quad \\textrm{ (zapis wektorowy)} $$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Podstawowe równania propagacji wstecznej\n", "\n", "$$\n", "\\begin{array}{rcll}\n", "\\delta^L & = & \\nabla_{a^L}J(\\Theta) \\odot { \\left( g^{L} \\right) }^{\\prime} \\left( z^L \\right) & (BP1) \\\\[2mm]\n", "\\delta^{l} & = & \\left( \\left( \\Theta^{l+1} \\right) \\! ^\\top \\, \\delta^{l+1} \\right) \\odot {{ \\left( g^{l} \\right) }^{\\prime}} \\left( z^{l} \\right) & (BP2)\\\\[2mm]\n", "\\nabla_{\\beta^l} J(\\Theta) & = & \\delta^l & (BP3)\\\\[2mm]\n", "\\nabla_{\\Theta^l} J(\\Theta) & = & a^{l-1} \\odot \\delta^l & (BP4)\\\\\n", "\\end{array}\n", "$$\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "#### (BP1)\n", "$$ \\delta^L_j \\; = \\; \\frac{ \\partial J }{ \\partial a^L_j } \\, g' \\!\\! \\left( z^L_j \\right) $$\n", "$$ \\delta^L \\; = \\; \\nabla_{a^L}J(\\Theta) \\odot { \\left( g^{L} \\right) }^{\\prime} \\left( z^L \\right) $$\n", "Błąd w ostatniej warstwie jest iloczynem szybkości zmiany kosztu względem $j$-tego wyjścia i szybkości zmiany funkcji aktywacji w punkcie $z^L_j$." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "#### (BP2)\n", "$$ \\delta^{l} \\; = \\; \\left( \\left( \\Theta^{l+1} \\right) \\! ^\\top \\, \\delta^{l+1} \\right) \\odot {{ \\left( g^{l} \\right) }^{\\prime}} \\left( z^{l} \\right) $$\n", "Aby obliczyć błąd w $l$-tej warstwie, należy przemnożyć błąd z następnej ($(l+1)$-szej) warstwy przez transponowany wektor wag, a uzyskaną macierz pomnożyć po współrzędnych przez szybkość zmiany funkcji aktywacji w punkcie $z^l$." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "#### (BP3)\n", "$$ \\nabla_{\\beta^l} J(\\Theta) \\; = \\; \\delta^l $$\n", "Błąd w $l$-tej warstwie jest równy wartości gradientu funkcji kosztu." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "#### (BP4)\n", "$$ \\nabla_{\\Theta^l} J(\\Theta) \\; = \\; a^{l-1} \\odot \\delta^l $$\n", "Gradient funkcji kosztu względem wag $l$-tej warstwy można obliczyć jako iloczyn po współrzędnych $a^{l-1}$ przez $\\delta^l$." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Algorytm propagacji wstecznej" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "Dla pojedynczego przykładu $(x,y)$:\n", "1. **Wejście**: Ustaw aktywacje w warstwie cech $a^{(0)}=x$ \n", "2. **Feedforward:** dla $l=1,\\dots,L$ oblicz \n", "$z^{(l)} = a^{(l-1)} \\Theta^{(l)} + \\beta^{(l)}$ oraz $a^{(l)}=g^{(l)} \\!\\! \\left( z^{(l)} \\right)$\n", "3. **Błąd wyjścia $\\delta^{(L)}$:** oblicz wektor $$\\delta^{(L)}= \\nabla_{a^{(L)}}J(\\Theta) \\odot {g^{\\prime}}^{(L)} \\!\\! \\left( z^{(L)} \\right) $$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "4. **Propagacja wsteczna błędu:** dla $l = L-1,L-2,\\dots,1$ oblicz $$\\delta^{(l)} = \\delta^{(l+1)}(\\Theta^{(l+1)})^T \\odot {g^{\\prime}}^{(l)} \\!\\! \\left( z^{(l)} \\right) $$\n", "5. **Gradienty:** \n", " * $\\dfrac{\\partial}{\\partial \\Theta_{ij}^{(l)}} J(\\Theta) = a_i^{(l-1)}\\delta_j^{(l)} \\textrm{ oraz } \\dfrac{\\partial}{\\partial \\beta_{j}^{(l)}} J(\\Theta) = \\delta_j^{(l)}$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "W naszym przykładzie:\n", "\n", "$$\\small J(\\Theta) = \\frac{1}{2} \\left( a^{(L)} - y \\right) ^2 $$\n", "$$\\small \\dfrac{\\partial}{\\partial a^{(L)}} J(\\Theta) = a^{(L)} - y$$\n", "\n", "$$\\small \\tanh^{\\prime}(x) = 1 - \\tanh^2(x)$$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Algorytm SGD z propagacją wsteczną\n", "\n", "Pojedyncza iteracja:\n", "1. Dla parametrów $\\Theta = (\\Theta^{(1)},\\ldots,\\Theta^{(L)})$ utwórz pomocnicze macierze zerowe $\\Delta = (\\Delta^{(1)},\\ldots,\\Delta^{(L)})$ o takich samych wymiarach (dla uproszczenia opuszczono wagi $\\beta$)." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "2. Dla $m$ przykładów we wsadzie (*batch*), $i = 1,\\ldots,m$:\n", " * Wykonaj algortym propagacji wstecznej dla przykładu $(x^{(i)}, y^{(i)})$ i przechowaj gradienty $\\nabla_{\\Theta}J^{(i)}(\\Theta)$ dla tego przykładu;\n", " * $\\Delta := \\Delta + \\dfrac{1}{m}\\nabla_{\\Theta}J^{(i)}(\\Theta)$\n", "3. Wykonaj aktualizację wag: $\\Theta := \\Theta - \\alpha \\Delta$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Propagacja wsteczna – podsumowanie\n", "\n", "* Algorytm pierwszy raz wprowadzony w latach 70. XX w.\n", "* W 1986 David Rumelhart, Geoffrey Hinton i Ronald Williams pokazali, że jest znacznie szybszy od wcześniejszych metod.\n", "* Obecnie najpopularniejszy algorytm uczenia sieci neuronowych." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## 4.6. Przykłady implementacji wielowarstwowych sieci neuronowych" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "notes" } }, "source": [ "### Uwaga!\n", "\n", "Poniższe przykłady wykorzystują interfejs [Keras](https://keras.io), który jest częścią biblioteki [TensorFlow](https://www.tensorflow.org).\n", "\n", "Aby uruchomić TensorFlow w środowisku Jupyter, należy wykonać następujące czynności:\n", "\n", "#### Przed pierwszym uruchomieniem (wystarczy wykonać tylko raz)\n", "\n", "Instalacja biblioteki TensorFlow w środowisku Anaconda:\n", "\n", "1. Uruchom *Anaconda Navigator*\n", "1. Wybierz kafelek *CMD.exe Prompt*\n", "1. Kliknij przycisk *Launch*\n", "1. Pojawi się konsola. Wpisz następujące polecenia, każde zatwierdzając wciśnięciem klawisza Enter:\n", "```\n", "conda create -n tf tensorflow\n", "conda activate tf\n", "conda install pandas matplotlib\n", "jupyter notebook\n", "```\n", "\n", "#### Przed każdym uruchomieniem\n", "\n", "Jeżeli chcemy korzystać z biblioteki TensorFlow, to środowisko Jupyter Notebook należy uruchomić w następujący sposób:\n", "\n", "1. Uruchom *Anaconda Navigator*\n", "1. Wybierz kafelek *CMD.exe Prompt*\n", "1. Kliknij przycisk *Launch*\n", "1. Pojawi się konsola. Wpisz następujące polecenia, każde zatwierdzając wciśnięciem klawisza Enter:\n", "```\n", "conda activate tf\n", "jupyter notebook\n", "```" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Przykład: MNIST\n", "\n", "_Modified National Institute of Standards and Technology database_" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "* Zbiór cyfr zapisanych pismem odręcznym\n", "* 60 000 przykładów uczących, 10 000 przykładów testowych\n", "* Rozdzielczość każdego przykładu: 28 × 28 = 784 piksele" ] }, { "cell_type": "code", "execution_count": 52, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "# źródło: https://github.com/keras-team/keras/examples/minst_mlp.py\n", "\n", "from tensorflow import keras\n", "from tensorflow.keras.datasets import mnist\n", "from tensorflow.keras.layers import Dense, Dropout\n", "\n", "# załaduj dane i podziel je na zbiory uczący i testowy\n", "(x_train, y_train), (x_test, y_test) = mnist.load_data()" ] }, { "cell_type": "code", "execution_count": 53, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "from matplotlib import pyplot as plt\n", "\n", "def draw_examples(examples, captions=None):\n", " plt.figure(figsize=(16, 4))\n", " m = len(examples)\n", " for i, example in enumerate(examples):\n", " plt.subplot(100 + m * 10 + i + 1)\n", " plt.imshow(example, cmap=plt.get_cmap('gray'))\n", " plt.show()\n", " if captions is not None:\n", " print(6 * ' ' + (10 * ' ').join(str(captions[i]) for i in range(m)))" ] }, { "cell_type": "code", "execution_count": 54, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAA54AAACOCAYAAABZsdfhAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAcc0lEQVR4nO3deZBU5bnH8ecVAVFERJAQEYYIQYhsAgpeC0gAV2SRgBL2GKHEBVJCgUoMxiCIStUAEkUujCAlWGHVSJCwSFRCgQTvBVkGjMDgBAYF2Qxc9Nw/6O15menpnjnn9Onu76eKmvOb093nnebh9Lycfvo1juMIAAAAAABeuSTVAwAAAAAAZDY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LuOiOwOwBiXi0jXII4tU2ohHeqAWqAWqAPqgFqgFqgFaoE6oA7StRb8fKvtdSJyMCYXhL4XNLUdxykUEQl9vTaVgzHG5IhIKxHZJAEbWzmkQy0E7rmmFlImUM81dZAygXuuqYWUCdxzTS2kTKCea+ogZQL3XAe1FvyceJpivsdH6sZhjKkqIotFZJTjOCdSPR4XUQtJohYgQh0gilpAGLUAEeoAUUGuBT8nngUicn1MrisiX/l4/EQdNsbUEREJfT2SikEYYyrKhaJZ4DjOkiCNzQXpUAuBea6phZQLxHNNHaRcYJ5raiHlAvNcUwspF4jnmjpIucA810GvBT8nnptFpJExpoExppKIPCgiK3w8fqJWiMjg0PZgufD+aF8ZY4yI/LeI7HQcZ2qQxuaSdKiFQDzX1EIgpPy5pg4CIRDPNbUQCIF4rqmFQEj5c00dBEIgnuu0qAWfm1zvEZE9IrJPRJ5JVWNrzHjeFpFCEfk/ufA/Kg+JyDVy4ROf8kNfa6RgXLfLhbcR/I+IbAv9uScIY8vEWghqHVAL1AJ1QB1QC9QCtUAtUAfUQabUggkNFAAAAAAAT/j5VlsAAAAAQBZi4gkAAAAA8BQTTwAAAACAp5h4AgAAAAA8xcQTAAAAAOApJp4AAAAAAE8x8QQAAAAAeIqJJwAAAADAU/8PSXdIbxrRR2wAAAAASUVORK5CYII=\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ " 5 0 4 1 9 2 1\n" ] } ], "source": [ "draw_examples(x_train[:7], captions=y_train)" ] }, { "cell_type": "code", "execution_count": 55, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "60000 przykładów uczących\n", "10000 przykładów testowych\n" ] } ], "source": [ "num_classes = 10\n", "\n", "x_train = x_train.reshape(60000, 784) # 784 = 28 * 28\n", "x_test = x_test.reshape(10000, 784)\n", "x_train = x_train.astype('float32')\n", "x_test = x_test.astype('float32')\n", "x_train /= 255\n", "x_test /= 255\n", "print('{} przykładów uczących'.format(x_train.shape[0]))\n", "print('{} przykładów testowych'.format(x_test.shape[0]))\n", "\n", "# przekonwertuj wektory klas na binarne macierze klas\n", "y_train = keras.utils.to_categorical(y_train, num_classes)\n", "y_test = keras.utils.to_categorical(y_test, num_classes)" ] }, { "cell_type": "code", "execution_count": 56, "metadata": { "scrolled": true, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Model: \"sequential_21\"\n", "_________________________________________________________________\n", "Layer (type) Output Shape Param # \n", "=================================================================\n", "dense_59 (Dense) (None, 512) 401920 \n", "_________________________________________________________________\n", "dropout_2 (Dropout) (None, 512) 0 \n", "_________________________________________________________________\n", "dense_60 (Dense) (None, 512) 262656 \n", "_________________________________________________________________\n", "dropout_3 (Dropout) (None, 512) 0 \n", "_________________________________________________________________\n", "dense_61 (Dense) (None, 10) 5130 \n", "=================================================================\n", "Total params: 669,706\n", "Trainable params: 669,706\n", "Non-trainable params: 0\n", "_________________________________________________________________\n" ] } ], "source": [ "model = keras.Sequential()\n", "model.add(Dense(512, activation='relu', input_shape=(784,)))\n", "model.add(Dropout(0.2))\n", "model.add(Dense(512, activation='relu'))\n", "model.add(Dropout(0.2))\n", "model.add(Dense(num_classes, activation='softmax'))\n", "model.summary()" ] }, { "cell_type": "code", "execution_count": 57, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(60000, 784) (60000, 10)\n" ] } ], "source": [ "print(x_train.shape, y_train.shape)" ] }, { "cell_type": "code", "execution_count": 58, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Epoch 1/5\n", "469/469 [==============================] - 11s 23ms/step - loss: 0.2463 - accuracy: 0.9238 - val_loss: 0.1009 - val_accuracy: 0.9690\n", "Epoch 2/5\n", "469/469 [==============================] - 10s 22ms/step - loss: 0.1042 - accuracy: 0.9681 - val_loss: 0.0910 - val_accuracy: 0.9739\n", "Epoch 3/5\n", "469/469 [==============================] - 11s 23ms/step - loss: 0.0774 - accuracy: 0.9762 - val_loss: 0.0843 - val_accuracy: 0.9755\n", "Epoch 4/5\n", "469/469 [==============================] - 11s 24ms/step - loss: 0.0606 - accuracy: 0.9815 - val_loss: 0.0691 - val_accuracy: 0.9818\n", "Epoch 5/5\n", "469/469 [==============================] - 10s 22ms/step - loss: 0.0504 - accuracy: 0.9848 - val_loss: 0.0886 - val_accuracy: 0.9772\n" ] }, { "data": { "text/plain": [ "" ] }, "execution_count": 58, "metadata": {}, "output_type": "execute_result" } ], "source": [ "model.compile(loss='categorical_crossentropy', optimizer=keras.optimizers.RMSprop(), metrics=['accuracy'])\n", "\n", "model.fit(x_train, y_train, batch_size=128, epochs=5, verbose=1,\n", " validation_data=(x_test, y_test))" ] }, { "cell_type": "code", "execution_count": 60, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Test loss: 0.08859136700630188\n", "Test accuracy: 0.9771999716758728\n" ] } ], "source": [ "score = model.evaluate(x_test, y_test, verbose=0)\n", "\n", "print('Test loss: {}'.format(score[0]))\n", "print('Test accuracy: {}'.format(score[1]))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "Warstwa _dropout_ to metoda regularyzacji, służy zapobieganiu nadmiernemu dopasowaniu sieci. Polega na tym, że część węzłów sieci jest usuwana w sposób losowy." ] }, { "cell_type": "code", "execution_count": 61, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Model: \"sequential_22\"\n", "_________________________________________________________________\n", "Layer (type) Output Shape Param # \n", "=================================================================\n", "dense_62 (Dense) (None, 512) 401920 \n", "_________________________________________________________________\n", "dense_63 (Dense) (None, 512) 262656 \n", "_________________________________________________________________\n", "dense_64 (Dense) (None, 10) 5130 \n", "=================================================================\n", "Total params: 669,706\n", "Trainable params: 669,706\n", "Non-trainable params: 0\n", "_________________________________________________________________\n", "Epoch 1/5\n", "469/469 [==============================] - 10s 20ms/step - loss: 0.2203 - accuracy: 0.9317 - val_loss: 0.0936 - val_accuracy: 0.9697\n", "Epoch 2/5\n", "469/469 [==============================] - 10s 21ms/step - loss: 0.0816 - accuracy: 0.9746 - val_loss: 0.0747 - val_accuracy: 0.9779\n", "Epoch 3/5\n", "469/469 [==============================] - 10s 20ms/step - loss: 0.0544 - accuracy: 0.9827 - val_loss: 0.0674 - val_accuracy: 0.9798\n", "Epoch 4/5\n", "469/469 [==============================] - 10s 22ms/step - loss: 0.0384 - accuracy: 0.9879 - val_loss: 0.0746 - val_accuracy: 0.9806\n", "Epoch 5/5\n", "469/469 [==============================] - 10s 22ms/step - loss: 0.0298 - accuracy: 0.9901 - val_loss: 0.0736 - val_accuracy: 0.9801\n" ] }, { "data": { "text/plain": [ "" ] }, "execution_count": 61, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Bez warstw Dropout\n", "\n", "num_classes = 10\n", "\n", "(x_train, y_train), (x_test, y_test) = mnist.load_data()\n", "\n", "x_train = x_train.reshape(60000, 784) # 784 = 28 * 28\n", "x_test = x_test.reshape(10000, 784)\n", "x_train = x_train.astype('float32')\n", "x_test = x_test.astype('float32')\n", "x_train /= 255\n", "x_test /= 255\n", "\n", "y_train = keras.utils.to_categorical(y_train, num_classes)\n", "y_test = keras.utils.to_categorical(y_test, num_classes)\n", "\n", "model_no_dropout = keras.Sequential()\n", "model_no_dropout.add(Dense(512, activation='relu', input_shape=(784,)))\n", "model_no_dropout.add(Dense(512, activation='relu'))\n", "model_no_dropout.add(Dense(num_classes, activation='softmax'))\n", "model_no_dropout.summary()\n", "\n", "model_no_dropout.compile(loss='categorical_crossentropy',\n", " optimizer=keras.optimizers.RMSprop(),\n", " metrics=['accuracy'])\n", "\n", "model_no_dropout.fit(x_train, y_train,\n", " batch_size=128,\n", " epochs=5,\n", " verbose=1,\n", " validation_data=(x_test, y_test))" ] }, { "cell_type": "code", "execution_count": 62, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Test loss (no dropout): 0.07358124107122421\n", "Test accuracy (no dropout): 0.9800999760627747\n" ] } ], "source": [ "# Bez warstw Dropout\n", "\n", "score = model_no_dropout.evaluate(x_test, y_test, verbose=0)\n", "\n", "print('Test loss (no dropout): {}'.format(score[0]))\n", "print('Test accuracy (no dropout): {}'.format(score[1]))" ] }, { "cell_type": "code", "execution_count": 63, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Model: \"sequential_23\"\n", "_________________________________________________________________\n", "Layer (type) Output Shape Param # \n", "=================================================================\n", "dense_65 (Dense) (None, 2500) 1962500 \n", "_________________________________________________________________\n", "dense_66 (Dense) (None, 2000) 5002000 \n", "_________________________________________________________________\n", "dense_67 (Dense) (None, 1500) 3001500 \n", "_________________________________________________________________\n", "dense_68 (Dense) (None, 1000) 1501000 \n", "_________________________________________________________________\n", "dense_69 (Dense) (None, 500) 500500 \n", "_________________________________________________________________\n", "dense_70 (Dense) (None, 10) 5010 \n", "=================================================================\n", "Total params: 11,972,510\n", "Trainable params: 11,972,510\n", "Non-trainable params: 0\n", "_________________________________________________________________\n", "Epoch 1/10\n", "469/469 [==============================] - 129s 275ms/step - loss: 0.9587 - accuracy: 0.7005 - val_loss: 0.5066 - val_accuracy: 0.8566\n", "Epoch 2/10\n", "469/469 [==============================] - 130s 276ms/step - loss: 0.2666 - accuracy: 0.9234 - val_loss: 0.3376 - val_accuracy: 0.9024\n", "Epoch 3/10\n", "469/469 [==============================] - 130s 277ms/step - loss: 0.1811 - accuracy: 0.9477 - val_loss: 0.1678 - val_accuracy: 0.9520\n", "Epoch 4/10\n", "469/469 [==============================] - 134s 287ms/step - loss: 0.1402 - accuracy: 0.9588 - val_loss: 0.1553 - val_accuracy: 0.9576\n", "Epoch 5/10\n", "469/469 [==============================] - 130s 278ms/step - loss: 0.1153 - accuracy: 0.9662 - val_loss: 0.1399 - val_accuracy: 0.9599\n", "Epoch 6/10\n", "469/469 [==============================] - 130s 277ms/step - loss: 0.0956 - accuracy: 0.9711 - val_loss: 0.1389 - val_accuracy: 0.9612\n", "Epoch 7/10\n", "469/469 [==============================] - 131s 280ms/step - loss: 0.0803 - accuracy: 0.9761 - val_loss: 0.1008 - val_accuracy: 0.9724\n", "Epoch 8/10\n", "469/469 [==============================] - 134s 286ms/step - loss: 0.0685 - accuracy: 0.9797 - val_loss: 0.1137 - val_accuracy: 0.9679\n", "Epoch 9/10\n", "469/469 [==============================] - 130s 278ms/step - loss: 0.0602 - accuracy: 0.9819 - val_loss: 0.1064 - val_accuracy: 0.9700\n", "Epoch 10/10\n", "469/469 [==============================] - 129s 274ms/step - loss: 0.0520 - accuracy: 0.9843 - val_loss: 0.1095 - val_accuracy: 0.9698\n" ] }, { "data": { "text/plain": [ "" ] }, "execution_count": 63, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Więcej warstw, inna funkcja aktywacji\n", "\n", "num_classes = 10\n", "\n", "(x_train, y_train), (x_test, y_test) = mnist.load_data()\n", "\n", "x_train = x_train.reshape(60000, 784) # 784 = 28 * 28\n", "x_test = x_test.reshape(10000, 784)\n", "x_train = x_train.astype('float32')\n", "x_test = x_test.astype('float32')\n", "x_train /= 255\n", "x_test /= 255\n", "\n", "y_train = keras.utils.to_categorical(y_train, num_classes)\n", "y_test = keras.utils.to_categorical(y_test, num_classes)\n", "\n", "model3 = keras.Sequential()\n", "model3.add(Dense(2500, activation='tanh', input_shape=(784,)))\n", "model3.add(Dense(2000, activation='tanh'))\n", "model3.add(Dense(1500, activation='tanh'))\n", "model3.add(Dense(1000, activation='tanh'))\n", "model3.add(Dense(500, activation='tanh'))\n", "model3.add(Dense(num_classes, activation='softmax'))\n", "model3.summary()\n", "\n", "model3.compile(loss='categorical_crossentropy',\n", " optimizer=keras.optimizers.RMSprop(),\n", " metrics=['accuracy'])\n", "\n", "model3.fit(x_train, y_train,\n", " batch_size=128,\n", " epochs=10,\n", " verbose=1,\n", " validation_data=(x_test, y_test))" ] }, { "cell_type": "code", "execution_count": 64, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Test loss: 0.10945799201726913\n", "Test accuracy: 0.9697999954223633\n" ] } ], "source": [ "# Więcej warstw, inna funkcja aktywacji\n", "\n", "score = model3.evaluate(x_test, y_test, verbose=0)\n", "\n", "print('Test loss: {}'.format(score[0]))\n", "print('Test accuracy: {}'.format(score[1]))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Przykład: 4-pikselowy aparat fotograficzny\n", "\n", "https://www.youtube.com/watch?v=ILsA4nyG7I0" ] }, { "cell_type": "code", "execution_count": 65, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "def generate_example(description):\n", " variant = random.choice([1, -1])\n", " if description == 's': # solid\n", " return (np.array([[ 1.0, 1.0], [ 1.0, 1.0]]) if variant == 1 else\n", " np.array([[-1.0, -1.0], [-1.0, -1.0]]))\n", " elif description == 'v': # vertical\n", " return (np.array([[ 1.0, -1.0], [ 1.0, -1.0]]) if variant == 1 else\n", " np.array([[-1.0, 1.0], [-1.0, 1.0]]))\n", " elif description == 'd': # diagonal\n", " return (np.array([[ 1.0, -1.0], [-1.0, 1.0]]) if variant == 1 else\n", " np.array([[-1.0, 1.0], [ 1.0, -1.0]]))\n", " elif description == 'h': # horizontal\n", " return (np.array([[ 1.0, 1.0], [-1.0, -1.0]]) if variant == 1 else\n", " np.array([[-1.0, -1.0], [ 1.0, 1.0]]))\n", " else:\n", " return np.array([[random.uniform(-1, 1), random.uniform(-1, 1)],\n", " [random.uniform(-1, 1), random.uniform(-1, 1)]])" ] }, { "cell_type": "code", "execution_count": 67, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "import random\n", "\n", "num_classes = 4\n", "\n", "trainset_size = 4000\n", "testset_size = 1000\n", "\n", "y4_train = np.array([random.choice(['s', 'v', 'd', 'h']) for i in range(trainset_size)])\n", "x4_train = np.array([generate_example(desc) for desc in y4_train])\n", "\n", "y4_test = np.array([random.choice(['s', 'v', 'd', 'h']) for i in range(testset_size)])\n", "x4_test = np.array([generate_example(desc) for desc in y4_test])" ] }, { "cell_type": "code", "execution_count": 68, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAA6oAAACQCAYAAAABdZZIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAPGUlEQVR4nO3dX4ild33H8c+3uwYhVKTN+ie7WZOLZSUVWswkVXqTXliSYJNeaIm9UKSwKOSyFwsF7WUveiUVQy5C4o22eGGXNq1NhRALymZXVJK2SRdRs0nARkvaVTFm+fVizrMzpLOzc/Y858xvnvN6wZA5c56c5zkn7/09893zzKRaawEAAIBe/Np+HwAAAABsZ1AFAACgKwZVAAAAumJQBQAAoCsGVQAAALpiUAUAAKArhxf5l6vqN5L8TZJbk/wgyR+31v57h+1+kOR/k1xO8kZrbWOR/dIfLTDQAokO2KIFBlog0QF7t+g7qqeTfL21diLJ12e3r+b3W2u/I7LJ0gIDLZDogC1aYKAFEh2wR4sOqg8keXz2+eNJ/mjBx+Pg0gIDLZDogC1aYKAFEh2wR4sOqu9srb2SJLN/vuMq27Uk/1xV56vq1IL7pE9aYKAFEh2wRQsMtECiA/bomj+jWlX/kuRdO9z153Ps5/daay9X1TuSPFlV/9Fae/oq+zuVZIjxjjn2wT6rqtZaq2tstqcW1qGDO+44uE/rhRdeyK9+9av/9/WjR4/m0KFDqar/aq0ducbDzN3CjTfeeMd73/veMZ4CI7hWBxsbG+38+fOvXqMF54c1sKzzw1TXhPPnz+/3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BtbX2RpKHknwtyb8n+dvW2nP7e1TjqKovJflmkpNVdbGq/nS/j6lnWmAw1RZ0MJ+pdpBoYV5aYDDVFnQwn6l2kPTXQrXmkmoAAAD6sdbvqAIAANAfgyoAAABdMagCAADQFYMqAAAAXTGoAgAA0BWDKgAAAF0xqAIAANAVgyoAAABd+T89XtOTyy31ugAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ " s d h s d v v\n" ] } ], "source": [ "draw_examples(x4_train[:7], captions=y4_train)" ] }, { "cell_type": "code", "execution_count": 69, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "x4_train = x4_train.reshape(trainset_size, 4)\n", "x4_test = x4_test.reshape(testset_size, 4)\n", "x4_train = x4_train.astype('float32')\n", "x4_test = x4_test.astype('float32')\n", "\n", "y4_train = np.array([{'s': 0, 'v': 1, 'd': 2, 'h': 3}[desc] for desc in y4_train])\n", "y4_test = np.array([{'s': 0, 'v': 1, 'd': 2, 'h': 3}[desc] for desc in y4_test])\n", "\n", "y4_train = keras.utils.to_categorical(y4_train, num_classes)\n", "y4_test = keras.utils.to_categorical(y4_test, num_classes)" ] }, { "cell_type": "code", "execution_count": 70, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Model: \"sequential_24\"\n", "_________________________________________________________________\n", "Layer (type) Output Shape Param # \n", "=================================================================\n", "dense_71 (Dense) (None, 4) 20 \n", "_________________________________________________________________\n", "dense_72 (Dense) (None, 4) 20 \n", "_________________________________________________________________\n", "dense_73 (Dense) (None, 8) 40 \n", "_________________________________________________________________\n", "dense_74 (Dense) (None, 4) 36 \n", "=================================================================\n", "Total params: 116\n", "Trainable params: 116\n", "Non-trainable params: 0\n", "_________________________________________________________________\n" ] } ], "source": [ "model4 = keras.Sequential()\n", "model4.add(Dense(4, activation='tanh', input_shape=(4,)))\n", "model4.add(Dense(4, activation='tanh'))\n", "model4.add(Dense(8, activation='relu'))\n", "model4.add(Dense(num_classes, activation='softmax'))\n", "model4.summary()" ] }, { "cell_type": "code", "execution_count": 71, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "model4.layers[0].set_weights(\n", " [np.array([[ 1.0, 0.0, 1.0, 0.0],\n", " [ 0.0, 1.0, 0.0, 1.0],\n", " [ 1.0, 0.0, -1.0, 0.0],\n", " [ 0.0, 1.0, 0.0, -1.0]],\n", " dtype=np.float32), np.array([0., 0., 0., 0.], dtype=np.float32)])\n", "model4.layers[1].set_weights(\n", " [np.array([[ 1.0, -1.0, 0.0, 0.0],\n", " [ 1.0, 1.0, 0.0, 0.0],\n", " [ 0.0, 0.0, 1.0, -1.0],\n", " [ 0.0, 0.0, -1.0, -1.0]],\n", " dtype=np.float32), np.array([0., 0., 0., 0.], dtype=np.float32)])\n", "model4.layers[2].set_weights(\n", " [np.array([[ 1.0, -1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],\n", " [ 0.0, 0.0, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0],\n", " [ 0.0, 0.0, 0.0, 0.0, 1.0, -1.0, 0.0, 0.0],\n", " [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, -1.0]],\n", " dtype=np.float32), np.array([0., 0., 0., 0., 0., 0., 0., 0.], dtype=np.float32)])" ] }, { "cell_type": "code", "execution_count": 73, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "model4.layers[3].set_weights(\n", " [np.array([[ 1.0, 0.0, 0.0, 0.0],\n", " [ 1.0, 0.0, 0.0, 0.0],\n", " [ 0.0, 1.0, 0.0, 0.0],\n", " [ 0.0, 1.0, 0.0, 0.0],\n", " [ 0.0, 0.0, 1.0, 0.0],\n", " [ 0.0, 0.0, 1.0, 0.0],\n", " [ 0.0, 0.0, 0.0, 1.0],\n", " [ 0.0, 0.0, 0.0, 1.0]],\n", " dtype=np.float32), np.array([0., 0., 0., 0.], dtype=np.float32)])\n", "\n", "model4.compile(loss='categorical_crossentropy',\n", " optimizer=keras.optimizers.Adagrad(),\n", " metrics=['accuracy'])" ] }, { "cell_type": "code", "execution_count": 74, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[array([[ 1., 0., 1., 0.],\n", " [ 0., 1., 0., 1.],\n", " [ 1., 0., -1., 0.],\n", " [ 0., 1., 0., -1.]], dtype=float32), array([0., 0., 0., 0.], dtype=float32)]\n", "[array([[ 1., -1., 0., 0.],\n", " [ 1., 1., 0., 0.],\n", " [ 0., 0., 1., -1.],\n", " [ 0., 0., -1., -1.]], dtype=float32), array([0., 0., 0., 0.], dtype=float32)]\n", "[array([[ 1., -1., 0., 0., 0., 0., 0., 0.],\n", " [ 0., 0., 1., -1., 0., 0., 0., 0.],\n", " [ 0., 0., 0., 0., 1., -1., 0., 0.],\n", " [ 0., 0., 0., 0., 0., 0., 1., -1.]], dtype=float32), array([0., 0., 0., 0., 0., 0., 0., 0.], dtype=float32)]\n", "[array([[1., 0., 0., 0.],\n", " [1., 0., 0., 0.],\n", " [0., 1., 0., 0.],\n", " [0., 1., 0., 0.],\n", " [0., 0., 1., 0.],\n", " [0., 0., 1., 0.],\n", " [0., 0., 0., 1.],\n", " [0., 0., 0., 1.]], dtype=float32), array([0., 0., 0., 0.], dtype=float32)]\n" ] } ], "source": [ "for layer in model4.layers:\n", " print(layer.get_weights())" ] }, { "cell_type": "code", "execution_count": 75, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "text/plain": [ "array([[0.17831734, 0.17831734, 0.17831734, 0.465048 ]], dtype=float32)" ] }, "execution_count": 75, "metadata": {}, "output_type": "execute_result" } ], "source": [ "model4.predict([np.array([[1.0, 1.0], [-1.0, -1.0]]).reshape(1, 4)])" ] }, { "cell_type": "code", "execution_count": 76, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Test loss: 0.7656148672103882\n", "Test accuracy: 1.0\n" ] } ], "source": [ "score = model4.evaluate(x4_test, y4_test, verbose=0)\n", "\n", "print('Test loss: {}'.format(score[0]))\n", "print('Test accuracy: {}'.format(score[1]))" ] }, { "cell_type": "code", "execution_count": 77, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Model: \"sequential_25\"\n", "_________________________________________________________________\n", "Layer (type) Output Shape Param # \n", "=================================================================\n", "dense_75 (Dense) (None, 4) 20 \n", "_________________________________________________________________\n", "dense_76 (Dense) (None, 4) 20 \n", "_________________________________________________________________\n", "dense_77 (Dense) (None, 8) 40 \n", "_________________________________________________________________\n", "dense_78 (Dense) (None, 4) 36 \n", "=================================================================\n", "Total params: 116\n", "Trainable params: 116\n", "Non-trainable params: 0\n", "_________________________________________________________________\n" ] } ], "source": [ "model5 = keras.Sequential()\n", "model5.add(Dense(4, activation='tanh', input_shape=(4,)))\n", "model5.add(Dense(4, activation='tanh'))\n", "model5.add(Dense(8, activation='relu'))\n", "model5.add(Dense(num_classes, activation='softmax'))\n", "model5.compile(loss='categorical_crossentropy',\n", " optimizer=keras.optimizers.RMSprop(),\n", " metrics=['accuracy'])\n", "model5.summary()" ] }, { "cell_type": "code", "execution_count": 78, "metadata": { "scrolled": true, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Epoch 1/8\n", "125/125 [==============================] - 0s 3ms/step - loss: 1.3126 - accuracy: 0.3840 - val_loss: 1.1926 - val_accuracy: 0.6110\n", "Epoch 2/8\n", "125/125 [==============================] - 0s 2ms/step - loss: 1.0978 - accuracy: 0.5980 - val_loss: 1.0085 - val_accuracy: 0.6150\n", "Epoch 3/8\n", "125/125 [==============================] - 0s 2ms/step - loss: 0.9243 - accuracy: 0.7035 - val_loss: 0.8416 - val_accuracy: 0.7380\n", "Epoch 4/8\n", "125/125 [==============================] - 0s 2ms/step - loss: 0.7522 - accuracy: 0.8740 - val_loss: 0.6738 - val_accuracy: 1.0000\n", "Epoch 5/8\n", "125/125 [==============================] - 0s 2ms/step - loss: 0.5811 - accuracy: 1.0000 - val_loss: 0.5030 - val_accuracy: 1.0000\n", "Epoch 6/8\n", "125/125 [==============================] - 0s 2ms/step - loss: 0.4134 - accuracy: 1.0000 - val_loss: 0.3428 - val_accuracy: 1.0000\n", "Epoch 7/8\n", "125/125 [==============================] - 0s 2ms/step - loss: 0.2713 - accuracy: 1.0000 - val_loss: 0.2161 - val_accuracy: 1.0000\n", "Epoch 8/8\n", "125/125 [==============================] - 0s 1ms/step - loss: 0.1621 - accuracy: 1.0000 - val_loss: 0.1225 - val_accuracy: 1.0000\n" ] }, { "data": { "text/plain": [ "" ] }, "execution_count": 78, "metadata": {}, "output_type": "execute_result" } ], "source": [ "model5.fit(x4_train, y4_train, epochs=8, validation_data=(x4_test, y4_test))" ] }, { "cell_type": "code", "execution_count": 79, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "text/plain": [ "array([[3.2040708e-02, 1.0065207e-03, 4.9596769e-04, 9.6645677e-01]],\n", " dtype=float32)" ] }, "execution_count": 79, "metadata": {}, "output_type": "execute_result" } ], "source": [ "model5.predict([np.array([[1.0, 1.0], [-1.0, -1.0]]).reshape(1, 4)])" ] }, { "cell_type": "code", "execution_count": 80, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Test loss: 0.1224619448184967\n", "Test accuracy: 1.0\n" ] } ], "source": [ "score = model5.evaluate(x4_test, y4_test, verbose=0)\n", "\n", "print('Test loss: {}'.format(score[0]))\n", "print('Test accuracy: {}'.format(score[1]))" ] }, { "cell_type": "code", "execution_count": 81, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "import contextlib\n", "\n", "@contextlib.contextmanager\n", "def printoptions(*args, **kwargs):\n", " original = np.get_printoptions()\n", " np.set_printoptions(*args, **kwargs)\n", " try:\n", " yield\n", " finally: \n", " np.set_printoptions(**original)" ] }, { "cell_type": "code", "execution_count": 82, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[array([[ 0.7, 0.2, -0.7, 0.7],\n", " [-0.5, 0.9, 0.6, 0.6],\n", " [ 1.1, 0.2, 0.1, 0.2],\n", " [ 0.7, 0.1, 0.3, -0.7]], dtype=float32), array([ 0. , 0.1, -0.1, -0.2], dtype=float32)]\n", "[array([[ 0.7, 0.5, -1.1, -1.2],\n", " [ 0.7, 0.9, -0.6, 0.3],\n", " [ 0.1, 1.4, -0.6, 0.8],\n", " [ 1.5, 0.1, -0.1, 0.9]], dtype=float32), array([-0.4, 0.2, -0. , 0.2], dtype=float32)]\n", "[array([[-1. , 1. , -0.7, -0.3, 0.2, 1.3, -0.7, 0.9],\n", " [-0.9, 0.5, 0.8, -1.3, -1.2, 1.3, 0.4, -1. ],\n", " [ 0.9, 0.2, 0.3, 0.4, 1.3, -0.9, -0.1, -0.2],\n", " [-0.4, 0.5, 1.1, -0.6, 1.1, 0.1, -1.5, -1. ]], dtype=float32), array([-0.1, 0.1, 0.1, 0.1, 0.2, -0. , 0.1, 0.2], dtype=float32)]\n", "[array([[ 0.7, -0.5, 0.8, -0.5],\n", " [-0.3, -1.6, -0.2, 0.1],\n", " [-1.5, 0.9, 0.1, -0.5],\n", " [ 0.6, 0.7, 1. , -1.4],\n", " [ 0.7, -1.2, -1.6, 1.2],\n", " [ 1. , -1.2, 0.3, -1.5],\n", " [-0.2, 0. , 0.6, 1.3],\n", " [-0.8, 0.2, -0.6, -1. ]], dtype=float32), array([-0.6, 0.5, -0.3, 0.4], dtype=float32)]\n" ] } ], "source": [ "with printoptions(precision=1, suppress=True):\n", " for layer in model5.layers:\n", " print(layer.get_weights())" ] } ], "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", "theme": "white" } }, "nbformat": 4, "nbformat_minor": 4 }