{ "cells": [ { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Uczenie maszynowe UMZ 2018/2019\n", "### 31 marca 2020\n", "# 4. Metody ewaluacji" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## 4.1. Metodologia testowania" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "notes" } }, "source": [ "W uczeniu maszynowym bardzo ważna jest ewaluacja budowanego modelu. Dlatego dobrze jest podzielić posiadane dane na odrębne zbiory – osobny zbiór danych do uczenia i osobny do testowania. W niektórych przypadkach potrzeba będzie dodatkowo wyodrębnić tzw. zbiór walidacyjny." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Zbiór uczący a zbiór testowy" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "* Na zbiorze uczącym (treningowym) uczymy algorytmy, a na zbiorze testowym sprawdzamy ich poprawność.\n", "* Zbiór uczący powinien być kilkukrotnie większy od testowego (np. 4:1, 9:1 itp.).\n", "* Zbiór testowy często jest nieznany.\n", "* Należy unikać mieszania danych testowych i treningowych – nie wolno „zanieczyszczać” danych treningowych danymi testowymi!" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "Czasami potrzebujemy dobrać parametry modelu, np. $\\alpha$ – który zbiór wykorzystać do tego celu?" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Zbiór walidacyjny" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "Do doboru parametrów najlepiej użyć jeszcze innego zbioru – jest to tzw. **zbiór walidacyjny**" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ " * Zbiór walidacyjny powinien mieć wielkość zbliżoną do wielkości zbioru testowego, czyli np. dane można podzielić na te trzy zbiory w proporcjach 3:1:1, 8:1:1 itp." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Walidacja krzyżowa" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "Którą część danych wydzielić jako zbiór walidacyjny tak, żeby było „najlepiej”?" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ " * Niech każda partia danych pełni tę rolę naprzemiennie!" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "\n", "Żródło: https://chrisjmccormick.wordpress.com/2013/07/31/k-fold-cross-validation-with-matlab-code/" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Walidacja krzyżowa\n", "\n", "* Podziel dane $D = \\left\\{ (x^{(1)}, y^{(1)}), \\ldots, (x^{(m)}, y^{(m)})\\right\\} $ na $N$ rozłącznych zbiorów $T_1,\\ldots,T_N$\n", "* Dla $i=1,\\ldots,N$, wykonaj:\n", " * Użyj $T_i$ do walidacji i zbiór $S_i$ do trenowania, gdzie $S_i = D \\smallsetminus T_i$. \n", " * Zapisz model $\\theta_i$.\n", "* Akumuluj wyniki dla modeli $\\theta_i$ dla zbiorów $T_i$.\n", "* Ustalaj parametry uczenia na akumulowanych wynikach." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Walidacja krzyżowa – wskazówki\n", "\n", "* Zazwyczaj ustala się $N$ w przedziale od $4$ do $10$, tzw. $N$-krotna walidacja krzyżowa (_$N$-fold cross validation_). \n", "* Zbiór $D$ warto zrandomizować przed podziałem.\n", "* W jaki sposób akumulować wyniki dla wszystkich zbiórow $T_i$?\n", "* Po ustaleniu parametrów dla każdego $T_i$, trenujemy model na całych danych treningowych z ustalonymi parametrami.\n", "* Testujemy na zbiorze testowym (jeśli nim dysponujemy)." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### _Leave-one-out_\n", "\n", "Jest to szczególny przypadek walidacji krzyżowej, w której $N = m$." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "* Jaki jest rozmiar pojedynczego zbioru $T_i$?\n", "* Jakie są zalety i wady tej metody?\n", "* Kiedy może być przydatna?" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Zbiór walidujący a algorytmy optymalizacji\n", "\n", "* Gdy błąd rośnie na zbiorze uczącym, mamy źle dobrany parametr $\\alpha$. Należy go wtedy zmniejszyć.\n", "* Gdy błąd zmniejsza się na zbiorze trenującym, ale rośnie na zbiorze walidującym, mamy do czynienia ze zjawiskiem **nadmiernego dopasowania** (_overfitting_).\n", "* Należy wtedy przerwać optymalizację. Automatyzacja tego procesu to _early stopping_." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## 4.2. Miary jakości" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "notes" } }, "source": [ "Aby przeprowadzić ewaluację modelu, musimy wybrać **miarę** (**metrykę**), jakiej będziemy używać.\n", "\n", "Jakiej miary użyc najlepiej?\n", " * To zależy od rodzaju zadania.\n", " * Innych metryk używa się do regresji, a innych do klasyfikacji" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Metryki dla zadań regresji\n", "\n", "Dla zadań regresji możemy zastosować np.:\n", " * błąd średniokwadratowy (*root-mean-square error*, RMSE):\n", " $$ \\mathrm{RMSE} \\, = \\, \\sqrt{ \\frac{1}{m} \\sum_{i=1}^{m} \\left( \\hat{y}^{(i)} - y^{(i)} \\right)^2 } $$\n", " * średni błąd bezwzględny (*mean absolute error*, MAE):\n", " $$ \\mathrm{MAE} \\, = \\, \\frac{1}{m} \\sum_{i=1}^{m} \\left| \\hat{y}^{(i)} - y^{(i)} \\right| $$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "notes" } }, "source": [ "W powyższych wzorach $y^{(i)}$ oznacza **oczekiwaną** wartości zmiennej $y$ w $i$-tym przykładzie, a $\\hat{y}^{(i)}$ oznacza wartość zmiennej $y$ w $i$-tym przykładzie wyliczoną (**przewidzianą**) przez nasz model." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Metryki dla zadań klasyfikacji\n", "\n", "Aby przedstawić kilka najpopularniejszych metryk stosowanych dla zadań klasyfikacyjnych, posłużmy się następującym przykładem:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "# Przydatne importy\n", "\n", "import ipywidgets as widgets\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas\n", "import random\n", "import seaborn\n", "\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "def powerme(x1,x2,n):\n", " \"\"\"Funkcja, która generuje n potęg dla zmiennych x1 i x2 oraz ich iloczynów\"\"\"\n", " X = []\n", " for m in range(n+1):\n", " for i in range(m+1):\n", " X.append(np.multiply(np.power(x1,i),np.power(x2,(m-i))))\n", " return np.hstack(X)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "def plot_data_for_classification(X, Y, xlabel=None, ylabel=None, Y_predicted=[], highlight=None):\n", " \"\"\"Wykres danych dla zadania klasyfikacji\"\"\"\n", " fig = plt.figure(figsize=(16*.6, 9*.6))\n", " ax = fig.add_subplot(111)\n", " fig.subplots_adjust(left=0.1, right=0.9, bottom=0.1, top=0.9)\n", " X = X.tolist()\n", " Y = Y.tolist()\n", " X1n = [x[1] for x, y in zip(X, Y) if y[0] == 0]\n", " X1p = [x[1] for x, y in zip(X, Y) if y[0] == 1]\n", " X2n = [x[2] for x, y in zip(X, Y) if y[0] == 0]\n", " X2p = [x[2] for x, y in zip(X, Y) if y[0] == 1]\n", " \n", " if len(Y_predicted) > 0:\n", " Y_predicted = Y_predicted.tolist()\n", " X1tn = [x[1] for x, y, yp in zip(X, Y, Y_predicted) if y[0] == 0 and yp[0] == 0]\n", " X1fn = [x[1] for x, y, yp in zip(X, Y, Y_predicted) if y[0] == 1 and yp[0] == 0]\n", " X1tp = [x[1] for x, y, yp in zip(X, Y, Y_predicted) if y[0] == 1 and yp[0] == 1]\n", " X1fp = [x[1] for x, y, yp in zip(X, Y, Y_predicted) if y[0] == 0 and yp[0] == 1]\n", " X2tn = [x[2] for x, y, yp in zip(X, Y, Y_predicted) if y[0] == 0 and yp[0] == 0]\n", " X2fn = [x[2] for x, y, yp in zip(X, Y, Y_predicted) if y[0] == 1 and yp[0] == 0]\n", " X2tp = [x[2] for x, y, yp in zip(X, Y, Y_predicted) if y[0] == 1 and yp[0] == 1]\n", " X2fp = [x[2] for x, y, yp in zip(X, Y, Y_predicted) if y[0] == 0 and yp[0] == 1]\n", " \n", " if highlight == 'tn':\n", " ax.scatter(X1tn, X2tn, c='r', marker='x', s=100, label='Dane')\n", " ax.scatter(X1fn, X2fn, c='k', marker='o', s=50, label='Dane')\n", " ax.scatter(X1tp, X2tp, c='k', marker='o', s=50, label='Dane')\n", " ax.scatter(X1fp, X2fp, c='k', marker='x', s=50, label='Dane')\n", " elif highlight == 'fn':\n", " ax.scatter(X1tn, X2tn, c='k', marker='x', s=50, label='Dane')\n", " ax.scatter(X1fn, X2fn, c='g', marker='o', s=100, label='Dane')\n", " ax.scatter(X1tp, X2tp, c='k', marker='o', s=50, label='Dane')\n", " ax.scatter(X1fp, X2fp, c='k', marker='x', s=50, label='Dane')\n", " elif highlight == 'tp':\n", " ax.scatter(X1tn, X2tn, c='k', marker='x', s=50, label='Dane')\n", " ax.scatter(X1fn, X2fn, c='k', marker='o', s=50, label='Dane')\n", " ax.scatter(X1tp, X2tp, c='g', marker='o', s=100, label='Dane')\n", " ax.scatter(X1fp, X2fp, c='k', marker='x', s=50, label='Dane')\n", " elif highlight == 'fp':\n", " ax.scatter(X1tn, X2tn, c='k', marker='x', s=50, label='Dane')\n", " ax.scatter(X1fn, X2fn, c='k', marker='o', s=50, label='Dane')\n", " ax.scatter(X1tp, X2tp, c='k', marker='o', s=50, label='Dane')\n", " ax.scatter(X1fp, X2fp, c='r', marker='x', s=100, label='Dane')\n", " else:\n", " ax.scatter(X1tn, X2tn, c='r', marker='x', s=50, label='Dane')\n", " ax.scatter(X1fn, X2fn, c='g', marker='o', s=50, label='Dane')\n", " ax.scatter(X1tp, X2tp, c='g', marker='o', s=50, label='Dane')\n", " ax.scatter(X1fp, X2fp, c='r', marker='x', s=50, label='Dane')\n", "\n", " else:\n", " ax.scatter(X1n, X2n, c='r', marker='x', s=50, label='Dane')\n", " ax.scatter(X1p, X2p, c='g', marker='o', s=50, label='Dane')\n", " \n", " if xlabel:\n", " ax.set_xlabel(xlabel)\n", " if ylabel:\n", " ax.set_ylabel(ylabel)\n", " \n", " ax.margins(.05, .05)\n", " return fig" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "# Wczytanie danych\n", "import pandas\n", "import numpy as np\n", "\n", "alldata = pandas.read_csv('data-metrics.tsv', sep='\\t')\n", "data = np.matrix(alldata)\n", "\n", "m, n_plus_1 = data.shape\n", "n = n_plus_1 - 1\n", "\n", "X2 = powerme(data[:, 1], data[:, 2], n)\n", "Y2 = np.matrix(data[:, 0]).reshape(m, 1)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAm0AAAFmCAYAAAA/JK3gAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElE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/LOlA+FofkfSLscf+Vnh8TEj6zbRfS7P2Qbj8WUm3VjyulY6DuxX0jJ9VkA+2SbpO0nXhepN0e7iPnlVs5IkTOQ6YEQEAACAHuDwKAACQA4Q2AACAHCC0AQAA5AChDQAAIAcIbQAAADlAaAMAAMgBQhsAAEAOENoAYAnM7BEzuyS8/0dm9pW06wSgPTD3KAAszWck3WJmb1IwX+LlKdcHQJtgRgQAWCIz+3tJKyRd5O4lM3ubgimqftbdr1z40QBwYrg8CgBLYGbvlLRW0rS7lyTJ3V90923p1gxAqyO0AUCdzGytpF2SNkuaMrP3pVwlAG2E0AYAdTCzN0oalnSTuz8v6XOSPptqpQC0Fdq0AcBJMrPVkj4v6RJJO939j1OuEoAWRGgDAADIAS6PAgAA5AChDQAAIAcIbQAAADlAaAMAAMgBQhsAAEAOENoAAABygNAGAACQA4Q2AACAHCC0AQAA5MD/B4P4jzzet+KNAAAAAElFTkSuQmCC\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "fig = plot_data_for_classification(X2, Y2, xlabel=r'$x_1$', ylabel=r'$x_2$')" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "def safeSigmoid(x, eps=0):\n", " \"\"\"Funkcja sigmoidalna zmodyfikowana w taki sposób, \n", " żeby wartości zawsz były odległe od asymptot o co najmniej eps\n", " \"\"\"\n", " y = 1.0/(1.0 + np.exp(-x))\n", " if eps > 0:\n", " y[y < eps] = eps\n", " y[y > 1 - eps] = 1 - eps\n", " return y\n", "\n", "def h(theta, X, eps=0.0):\n", " \"\"\"Funkcja hipotezy (regresja logistyczna)\"\"\"\n", " return safeSigmoid(X*theta, eps)\n", "\n", "def J(h,theta,X,y, lamb=0):\n", " \"\"\"Funkcja kosztu dla regresji logistycznej\"\"\"\n", " m = len(y)\n", " f = h(theta, X, eps=10**-7)\n", " j = -np.sum(np.multiply(y, np.log(f)) + \n", " np.multiply(1 - y, np.log(1 - f)), axis=0)/m\n", " if lamb > 0:\n", " j += lamb/(2*m) * np.sum(np.power(theta[1:],2))\n", " return j\n", "\n", "def dJ(h,theta,X,y,lamb=0):\n", " \"\"\"Gradient funkcji kosztu\"\"\"\n", " g = 1.0/y.shape[0]*(X.T*(h(theta,X)-y))\n", " if lamb > 0:\n", " g[1:] += lamb/float(y.shape[0]) * theta[1:] \n", " return g\n", "\n", "def classifyBi(theta, X):\n", " \"\"\"Funkcja predykcji - klasyfikacja dwuklasowa\"\"\"\n", " prob = h(theta, X)\n", " return prob" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "def GD(h, fJ, fdJ, theta, X, y, alpha=0.01, eps=10**-3, maxSteps=10000):\n", " \"\"\"Metoda gradientu prostego dla regresji logistycznej\"\"\"\n", " errorCurr = fJ(h, theta, X, y)\n", " errors = [[errorCurr, theta]]\n", " while True:\n", " # oblicz nowe theta\n", " theta = theta - alpha * fdJ(h, theta, X, y)\n", " # raportuj poziom błędu\n", " errorCurr, errorPrev = fJ(h, theta, X, y), errorCurr\n", " # kryteria stopu\n", " if abs(errorPrev - errorCurr) <= eps:\n", " break\n", " if len(errors) > maxSteps:\n", " break\n", " errors.append([errorCurr, theta]) \n", " return theta, errors" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "theta = [[ 1.37136167]\n", " [ 0.90128948]\n", " [ 0.54708112]\n", " [-5.9929264 ]\n", " [ 2.64435168]\n", " [-4.27978238]]\n" ] } ], "source": [ "# Uruchomienie metody gradientu prostego dla regresji logistycznej\n", "theta_start = np.matrix(np.zeros(X2.shape[1])).reshape(X2.shape[1],1)\n", "theta, errors = GD(h, J, dJ, theta_start, X2, Y2, \n", " alpha=0.1, eps=10**-7, maxSteps=10000)\n", "print('theta = {}'.format(theta))" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "def plot_decision_boundary(fig, theta, X):\n", " \"\"\"Wykres granicy klas\"\"\"\n", " ax = fig.axes[0]\n", " xx, yy = np.meshgrid(np.arange(-1.0, 1.0, 0.02),\n", " np.arange(-1.0, 1.0, 0.02))\n", " l = len(xx.ravel())\n", " C = powerme(xx.reshape(l, 1), yy.reshape(l, 1), n)\n", " z = classifyBi(theta, C).reshape(int(np.sqrt(l)), int(np.sqrt(l)))\n", "\n", " plt.contour(xx, yy, z, levels=[0.5], lw=3);" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "Y_expected = Y2.astype(int)\n", "Y_predicted = (classifyBi(theta, X2) > 0.5).astype(int)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "# Przygotowanie interaktywnego wykresu\n", "\n", "dropdown_highlight = widgets.Dropdown(options=['all', 'tp', 'fp', 'tn', 'fn'], value='all', description='highlight')\n", "\n", "def interactive_classification(highlight):\n", " fig = plot_data_for_classification(X2, Y2, xlabel=r'$x_1$', ylabel=r'$x_2$',\n", " Y_predicted=Y_predicted, highlight=highlight)\n", " plot_decision_boundary(fig, theta, X2)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/pawel/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:10: UserWarning: The following kwargs were not used by contour: 'lw'\n", " # Remove the CWD from sys.path while we load stuff.\n" ] }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAmwAAAFmCAYAAADQ5sbeAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9y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YiI1wFbgdOZ+QJAZp7MzFubrZmkPjNhk6SaImIr8A/ALuC/I+LGhqskaSBM2CSphoh4MbAf+J3MPAb8AXBno5WSNBiOYZOk8xQRlwEfAN4IfDQzP9hwlST1jAmbJElSy9klKkmS1HImbJIkSS1nwiZJktRyJmySJEktZ8ImSZLUciZskiRJLWfCJkmS1HImbJIkSS1nwiZJktRy/w8iX1JMsAtbFwAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" }, { "data": { "text/plain": [ "" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "widgets.interact(interactive_classification, highlight=dropdown_highlight)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "Zadanie klasyfikacyjne z powyższego przykładu polega na przypisaniu punktów do jednej z dwóch kategorii:\n", " 0. czerwone krzyżyki\n", " 1. zielone kółka\n", "\n", "W tym celu zastosowano regresję logistyczną.\n", "\n", "W rezultacie otrzymano model, który dzieli płaszczyznę na dwa obszary:\n", " 0. na zewnątrz granatowej krzywej\n", " 1. wewnątrz granatowej krzywej\n", " \n", "Model przewiduje klasę 0 („czerwoną”) dla punktów znajdujący się w obszarze na zewnątrz krzywej, natomiast klasę 1 („zieloną”) dla punktów znajdujących sie w obszarze wewnąrz krzywej." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "Wszysktie obserwacje możemy podzielić zatem na cztery grupy:\n", " * **true positives (TP)** – prawidłowo sklasyfikowane pozytywne przykłady (zielone kółka w wewnętrznym obszarze)\n", " * **true negatives (TN)** – prawidłowo sklasyfikowane negatywne przykłady (czerwone krzyżyki w zewnętrznym obszarze)\n", " * **false positives (FP)** – negatywne przykłady sklasyfikowane jako pozytywne (czerwone krzyżyki w wewnętrznym obszarze)\n", " * **false negatives (FN)** – pozytywne przykłady sklasyfikowane jako negatywne (zielone kółka w zewnętrznym obszarze)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "Innymi słowy:\n", "\n", "" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "TP = 5\n", "TN = 35\n", "FP = 3\n", "FN = 6\n" ] } ], "source": [ "# Obliczmy TP, TN, FP i FN\n", "\n", "tp = 0\n", "tn = 0\n", "fp = 0\n", "fn = 0\n", "\n", "for i in range(len(Y_expected)):\n", " if Y_expected[i] == 1 and Y_predicted[i] == 1:\n", " tp += 1\n", " elif Y_expected[i] == 0 and Y_predicted[i] == 0:\n", " tn += 1\n", " elif Y_expected[i] == 0 and Y_predicted[i] == 1:\n", " fp += 1\n", " elif Y_expected[i] == 1 and Y_predicted[i] == 0:\n", " fn += 1\n", " \n", "print('TP =', tp)\n", "print('TN =', tn)\n", "print('FP =', fp)\n", "print('FN =', fn)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Możemy teraz zdefiniować następujące metryki:" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "#### Dokładność (_accuracy_)\n", "$$ \\mbox{accuracy} = \\frac{\\mbox{przypadki poprawnie sklasyfikowane}}{\\mbox{wszystkie przypadki}} = \\frac{TP + TN}{TP + TN + FP + FN} $$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "notes" } }, "source": [ "Dokładność otrzymujemy przez podzielenie liczby przypadków poprawnie sklasyfikowanych przez liczbę wszystkich przypadków:" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Accuracy: 0.8163265306122449\n" ] } ], "source": [ "accuracy = (tp + tn) / (tp + tn + fp + fn)\n", "print('Accuracy:', accuracy)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "notes" } }, "source": [ "**Uwaga:** Nie zawsze dokładność będzie dobrą miarą, zwłaszcza gdy klasy są bardzo asymetryczne!\n", "\n", "*Przykład:* Wyobraźmy sobie test na koronawirusa, który **zawsze** zwraca wynik negatywny. Jaką przydatność będzie miał taki test w praktyce? Żadną. A jaka będzie jego *dokładność*? Policzmy:\n", "$$ \\mbox{accuracy} \\, = \\, \\frac{\\mbox{szacowana liczba osób zdrowych na świecie}}{\\mbox{populacja Ziemi}} \\, \\approx \\, \\frac{7\\,700\\,000\\,000 - 600\\,000}{7\\,700\\,000\\,000} \\, \\approx \\, 0.99992 $$\n", "(zaokrąglone dane z 27 marca 2020)\n", "\n", "Powyższy wynik jest tak wysoki, ponieważ zdecydowana większość osób na świecie nie jest zakażona, więc biorąc losowego Ziemianina możemy w ciemno strzelać, że nie ma koronawirusa.\n", "\n", "W tym przypadku duża różnica w liczności obu zbiorów (zakażeni/niezakażeni) powoduje, że *accuracy* nie jest dobrą metryką.\n", "\n", "Dlatego dysponujemy również innymi metrykami:" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "#### Precyzja (_precision_)\n", "$$ \\mbox{precision} = \\frac{TP}{TP + FP} $$" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Precision: 0.625\n" ] } ], "source": [ "precision = tp / (tp + fp)\n", "print('Precision:', precision)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "notes" } }, "source": [ "Precyzja określa, jaka część przykładów sklasyfikowanych jako pozytywne to faktycznie przykłady pozytywne." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "#### Pokrycie (czułość, _recall_)\n", "$$ \\mbox{recall} = \\frac{TP}{TP + FN} $$" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Recall: 0.45454545454545453\n" ] } ], "source": [ "recall = tp / (tp + fn)\n", "print('Recall:', recall)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "notes" } }, "source": [ "Pokrycie mówi nam, jaka część przykładów pozytywnych została poprawnie sklasyfikowana." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "#### _$F$-measure_ (_$F$-score_)\n", "$$ F = \\frac{2 \\cdot \\mbox{precision} \\cdot \\mbox{recall}}{\\mbox{precision} + \\mbox{recall}} $$" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "F-score: 0.5263157894736842\n" ] } ], "source": [ "fscore = (2 * precision * recall) / (precision + recall)\n", "print('F-score:', fscore)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "notes" } }, "source": [ "$F$-_measure_ jest kompromisem między precyzją a pokryciem (a ściślej: jest średnią harmoniczną precyzji i pokrycia)." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "$F$-_measure_ jest szczególnym przypadkiem ogólniejszej miary:" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "_$F_\\beta$-measure_:\n", "$$ F_\\beta = \\frac{(1 + \\beta) \\cdot \\mbox{precision} \\cdot \\mbox{recall}}{\\beta^2 \\cdot \\mbox{precision} + \\mbox{recall}} $$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "Dla $\\beta = 1$ otrzymujemy:\n", "$$ F_1 \\, = \\, \\frac{(1 + 1) \\cdot \\mbox{precision} \\cdot \\mbox{recall}}{1^2 \\cdot \\mbox{precision} + \\mbox{recall}} \\, = \\, \\frac{2 \\cdot \\mbox{precision} \\cdot \\mbox{recall}}{\\mbox{precision} + \\mbox{recall}} \\, = \\, F $$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## 4.3. Obserwacje odstające" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "notes" } }, "source": [ "**Obserwacje odstające** (*outliers*) – to wszelkie obserwacje posiadające nietypową wartość.\n", "\n", "Mogą być na przykład rezultatem błędnego pomiaru albo pomyłki przy wprowadzaniu danych do bazy, ale nie tylko.\n", "\n", "Obserwacje odstające mogą niekiedy znacząco wpłynąć na parametry modelu, dlatego ważne jest, żeby takie obserwacje odrzucić zanim przystąpi się do tworzenia modelu." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "W poniższym przykładzie można zobaczyć wpływ obserwacji odstających na wynik modelowania na przykładzie danych dotyczących cen mieszkań zebranych z ogłoszeń na portalu Gratka.pl: tutaj przykładem obserwacji odstającej może być ogłoszenie, w którym podano cenę w tys. zł zamiast ceny w zł." ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "# Przydatne funkcje\n", "\n", "def h_linear(Theta, x):\n", " \"\"\"Funkcja regresji liniowej\"\"\"\n", " return x * Theta\n", "\n", "def linear_regression(theta):\n", " \"\"\"Ta funkcja zwraca funkcję regresji liniowej dla danego wektora parametrów theta\"\"\"\n", " return lambda x: h_linear(theta, x)\n", "\n", "def cost(theta, X, y):\n", " \"\"\"Wersja macierzowa funkcji kosztu\"\"\"\n", " m = len(y)\n", " J = 1.0 / (2.0 * m) * ((X * theta - y).T * (X * theta - y))\n", " return J.item()\n", "\n", "def gradient(theta, X, y):\n", " \"\"\"Wersja macierzowa gradientu funkcji kosztu\"\"\"\n", " return 1.0 / len(y) * (X.T * (X * theta - y)) \n", "\n", "def gradient_descent(fJ, fdJ, theta, X, y, alpha=0.1, eps=10**-5):\n", " \"\"\"Algorytm gradientu prostego (wersja macierzowa)\"\"\"\n", " current_cost = fJ(theta, X, y)\n", " logs = [[current_cost, theta]]\n", " while True:\n", " theta = theta - alpha * fdJ(theta, X, y)\n", " current_cost, prev_cost = fJ(theta, X, y), current_cost\n", " if abs(prev_cost - current_cost) > 10**15:\n", " print('Algorithm does not converge!')\n", " break\n", " if abs(prev_cost - current_cost) <= eps:\n", " break\n", " logs.append([current_cost, theta]) \n", " return theta, logs\n", "\n", "def plot_data(X, y, xlabel, ylabel):\n", " \"\"\"Wykres danych (wersja macierzowa)\"\"\"\n", " fig = plt.figure(figsize=(16*.6, 9*.6))\n", " ax = fig.add_subplot(111)\n", " fig.subplots_adjust(left=0.1, right=0.9, bottom=0.1, top=0.9)\n", " ax.scatter([X[:, 1]], [y], c='r', s=50, label='Dane')\n", " \n", " ax.set_xlabel(xlabel)\n", " ax.set_ylabel(ylabel)\n", " ax.margins(.05, .05)\n", " plt.ylim(y.min() - 1, y.max() + 1)\n", " plt.xlim(np.min(X[:, 1]) - 1, np.max(X[:, 1]) + 1)\n", " return fig\n", "\n", "def plot_regression(fig, fun, theta, X):\n", " \"\"\"Wykres krzywej regresji (wersja macierzowa)\"\"\"\n", " ax = fig.axes[0]\n", " x0 = np.min(X[:, 1]) - 1.0\n", " x1 = np.max(X[:, 1]) + 1.0\n", " L = [x0, x1]\n", " LX = np.matrix([1, x0, 1, x1]).reshape(2, 2)\n", " ax.plot(L, fun(theta, LX), linewidth='2',\n", " label=(r'$y={theta0:.2}{op}{theta1:.2}x$'.format(\n", " theta0=float(theta[0][0]),\n", " theta1=(float(theta[1][0]) if theta[1][0] >= 0 else float(-theta[1][0])),\n", " op='+' if theta[1][0] >= 0 else '-')))" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "# Wczytanie danych (mieszkania) przy pomocy biblioteki pandas\n", "\n", "alldata = pandas.read_csv('data_flats_with_outliers.tsv', sep='\\t',\n", " names=['price', 'isNew', 'rooms', 'floor', 'location', 'sqrMetres'])\n", "data = np.matrix(alldata[['price', 'sqrMetres']])\n", "\n", "m, n_plus_1 = data.shape\n", "n = n_plus_1 - 1\n", "Xn = data[:, 0:n]\n", "\n", "Xo = np.matrix(np.concatenate((np.ones((m, 1)), Xn), axis=1)).reshape(m, n + 1)\n", "yo = np.matrix(data[:, -1]).reshape(m, 1)\n", "\n", "Xo /= np.amax(Xo, axis=0)\n", "yo /= np.amax(yo, axis=0)" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAmwAAAFoCAYAAADq7KeuAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAcvElEQVR4nO3de7CkZ10n8O9vkpDozBQBEgyEZNHKLIgXAnskQVK7iFILs2zCrlgT19KAwYhcRLmsQSxBtMq4LiJCECNyiWvhWGhhdAOIXMQUBphgAiQxO2NcYZwRwmXjyZALk3n2j+5xTk56Jj3n9Ol+Ts/nU3Wqu9/3ed/3d97uPvOd57081VoLAAD92jDrAgAAODKBDQCgcwIbAEDnBDYAgM4JbAAAnRPYAAA6N7PAVlVnVNVHqurmqrqxql46ok1V1W9V1a6q+kxVPXEWtQIAzNLxM9z2/iQvb619uqo2J7muqj7YWrtpSZtnJtky/DknyW8PHwEAjhkz62Frre1trX16+Hwxyc1JTl/W7IIkV7aBa5OcXFWPmHKpAAAz1cU5bFX16CRPSPKJZbNOT/KFJa935/6hDgBgrs3ykGiSpKo2JfnjJD/TWvuX5bNHLHK/sbSq6pIklyTJxo0b/91jH/vYidcJALAa11133Zdba6euZNmZBraqOiGDsPYHrbU/GdFkd5Izlrx+VJI9yxu11q5IckWSLCwstB07dqxBtQAAK1dV/7jSZWd5lWgl+b0kN7fWfuMwza5K8mPDq0XPTXJ7a23v1IoEAOjALHvYnpLkR5N8tqquH077+SRnJklr7a1Jrk6yNcmuJF9P8rwZ1AkAMFMzC2yttWsy+hy1pW1akhdNpyIAgD51cZUoAACHJ7ABAHROYAMA6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ancPnJyR5c1WdneTeJP92Wdt3JHmnsAZMgsAGzLu7lzw/sOT1gQz+Bt6b5Adba7csXaiqzhmxrn1Lnv9ski8meXwG5wPftWTZVyf5emvtTauuHiAuOgD4QJKXVFUlSVU9YTh9McnmIyz34CR7W2sHMhjo+bjh8lszONz6gjWrGDjmCGzAse6XMzi8+Zmq+tzwdZJ8JMnjqur6qto2Yrm3JLmoqq7N4HDowd63VyY5Lcm1w2XfsLblA8cCFx0AAHRODxsAQOcENgCAzglsAACdE9gAADonsAEAdE5gAwDonMAGANA5gQ0AoHP/H8NZqxKSv1A/AAAAAElFTkSuQmCC\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "fig = plot_data(Xo, yo, xlabel=u'metraż', ylabel=u'cena')\n", "theta_start = np.matrix([0.0, 0.0]).reshape(2, 1)\n", "theta, logs = gradient_descent(cost, gradient, theta_start, Xo, yo, alpha=0.01)\n", "plot_regression(fig, h_linear, theta, Xo)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "notes" } }, "source": [ "Na powyższym przykładzie obserwacja odstająca jawi sie jako pojedynczy punkt po prawej stronie wykresu. Widzimy, że otrzymana krzywa regresji zamiast odwzorowywać ogólny trend, próbuje „dopasować się” do tej pojedynczej obserwacji.\n", "\n", "Dlatego taką obserwację należy usunąć ze zbioru danych (zobacz ponizej)." ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "# Odrzućmy obserwacje odstające\n", "alldata_no_outliers = [\n", " (index, item) for index, item in alldata.iterrows() \n", " if item.price > 100 and item.sqrMetres > 10]\n", "\n", "alldata_no_outliers = alldata.loc[(alldata['price'] > 100) & (alldata['sqrMetres'] > 100)]" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "data = np.matrix(alldata_no_outliers[['price', 'sqrMetres']])\n", "\n", "m, n_plus_1 = data.shape\n", "n = n_plus_1 - 1\n", "Xn = data[:, 0:n]\n", "\n", "Xo = np.matrix(np.concatenate((np.ones((m, 1)), Xn), axis=1)).reshape(m, n + 1)\n", "yo = np.matrix(data[:, -1]).reshape(m, 1)\n", "\n", "Xo /= np.amax(Xo, axis=0)\n", "yo /= np.amax(yo, axis=0)" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAmwAAAFoCAYAAADq7KeuAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3dfZDkVX3v8c93nndnengIq7ssbJBiFbEUMBOBuOXlqiSwZSBX0cWbiosXiktYooJaQrzXx1hiKvgMmBXJAjG4CaZ0E1cpHy/ZKOhAQFxgYUJKWWfFFXCnZ3aeeuZ7//j9eqen59c93TPd/TvT/X5VdfXD79fdZ6anlw/nfM855u4CAABAuNrSbgAAAADKI7ABAAAEjsAGAAAQOAIbAABA4AhsAAAAgSOwAQAABC61wGZmJ5rZ983sMTPba2bvTDjHzOyzZjZkZj81s1em0VYAAIA0daT43jlJ73b3B80sI+kBM/u2uz9acM4FkjbGl7Mk3RJfAwAAtIzUetjc/YC7Pxjfzkp6TNL6otMuknSHR+6TdLSZrWtwUwEAAFIVRA2bmZ0k6UxJ9xcdWi/p6YL7+7Uw1AEAADS1NIdEJUlm1ifpq5Le5e4jxYcTnrJgLy0zu0LSFZLU29v7e6eeemrN2wkAALAcDzzwwG/cfc1SnptqYDOzTkVh7cvu/s8Jp+yXdGLB/RMkDRef5O7bJW2XpIGBAR8cHKxDawEAAJbOzH6+1OemOUvUJH1J0mPu/skSp+2S9LZ4tujZkg65+4GGNRIAACAAafawvVrSn0l6xMweih/7S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GbzDzC5UNHvrOUmXptbgJmZmd0k6V9JxZrZf0gcldUqSu39B0m5JmyUNSTos6e3ptLR5VfAZXCzpz80sJ2lc0iX8D2TNvVrSn0l6xMweih/7S0kbpKV/F9jpAAAAIHAMiQIAAASOwAYAABA4AhsAAEDgCGwAAACBI7ABAAAEjsAGAAnM7Ix4JfilPv+HtWwPgNZGYAOAZGcoWidpgXjHirLc/Q9q3iIALYt12AA0rXjj5W9J2iPpbEkPS/o7SR+W9AJJfyppr6TPSXq5osXEPyTpm4oWtFwl6ZeSPq5o4enjJZ0k6TeKFsK8U1Jv/HZXu/sP4wV7L4wfO1bSA+7+P+r2QwJoCQQ2AE0rDmxDivbM3atoG6uHJV2mKFS9XdH2bI+6+9+b2dGSfhyf/2ZJA+5+dfxaH5L0x5I2ufu4ma2WNOvuE2a2UdHm8gMF790r6V5J17j7vQ34cQE0MbamAtDs/svdH5EkM9sr6bvu7mb2iKLeshMkXWhm74nP71G8hUyCXe4+Ht/ulPR5MztD0oykFxed+3eSdhDWANQCgQ1As5ssuD1bcH9W0b+BM5Le5O77Cp9kZmclvNZYwe1rJD0j6XRF9cATBc99v6TD7v65ZbceAMSkAwC4R9JfmJlJkpmdGT+elZQp87yjJB1w91lFGz23x8/frGi49cq6tRhAyyGwAWh1H1U0vPlTM/tZfF+Svi/pNDN7yMy2JDzvZklbzew+RcOh+d6390paK+m++Lmfqm/zAbQCJh0AAAAEjh42AACAwBHYAAAAAkdgAwAACByBDQAAIHAENgAAgMAR2AAAAAJHYAMAAAgcgQ0AACBw/x8FU+TbtSGH2wAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "fig = plot_data(Xo, yo, xlabel=u'metraż', ylabel=u'cena')\n", "theta_start = np.matrix([0.0, 0.0]).reshape(2, 1)\n", "theta, logs = gradient_descent(cost, gradient, theta_start, Xo, yo, alpha=0.01)\n", "plot_regression(fig, h_linear, theta, Xo)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Na powyższym wykresie widać, że po odrzuceniu obserwacji odstających otrzymujemy dużo bardziej „wiarygodną” krzywą regresji." ] } ], "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": "amu" } }, "nbformat": 4, "nbformat_minor": 4 }