aitech-eks-pub/wyk/09_neurozoo.ipynb

2051 lines
132 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![Logo 1](https://git.wmi.amu.edu.pl/AITech/Szablon/raw/branch/master/Logotyp_AITech1.jpg)\n",
"<div class=\"alert alert-block alert-info\">\n",
"<h1> Ekstrakcja informacji </h1>\n",
"<h2> 9. <i>Przegląd składowych sieci neuronowych</i> [wykład]</h2> \n",
"<h3> Filip Graliński (2021)</h3>\n",
"</div>\n",
"\n",
"![Logo 2](https://git.wmi.amu.edu.pl/AITech/Szablon/raw/branch/master/Logotyp_AITech2.jpg)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Neurozoo\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Kilka uwag dotyczących wektorów\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Wektor wierszowy $\\left[x_1,\\dots,x_n\\right]$ czy kolumnowy $\\left[\\begin{array}{c}\n",
" x_1 \\\\ \\vdots \\\\ x_n\\end{array}\\right]$?\n",
"\n",
"Często zakłada się wektor kolumny, będziemy używać **transpozycji**, by otrzymać wektor\n",
"wierszowy $\\vec{x}^T = \\left[x_1,\\dots,x_n\\right]$.\n",
"\n",
"W praktyce, np. w PyTorchu, może to nie mieć wielkiego znaczenia:\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([ 1.0000, -0.5000, 2.0000])"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch\n",
"x = torch.tensor([1.0, -0.5, 2.0])\n",
"x"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Musimy tylko uważać, jeśli przemnażamy wektor przez macierz!\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Funkcja sigmoidalna\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Funkcja sigmoidalna zamienia dowolną wartość („sygnał”) w wartość z przedziału $(0,1)$, czyli wartość, która może być interperetowana jako prawdopodobieństwo.\n",
"\n",
"$$\\sigma(x) = \\frac{1}{1 + e^{-x}}$$\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor(0.6457)"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch\n",
"\n",
"def sigmoid(x):\n",
" return 1 / (1 + torch.exp(-x))\n",
"\n",
"sigmoid(torch.tensor(0.6))"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'sigmoid.png'"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEGCAYAAABo25JHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Z1A+gAAAACXBIWXMAAAsTAAALEwEAmpwYAAAhNUlEQVR4nO3deXyV5Z3+8c83+04gCVsIqyAguwHcWm2tDijuti5YFW39aWvHWtuqHaszdanLtFNn1PKjFpda12opVQpq6zYubMoWQiCGJWHLRvY9554/EpkMBgTMk+cs1/v1Oq/knOdJvI7Gcz3rfZtzDhERiVxRfgcQERF/qQhERCKcikBEJMKpCEREIpyKQEQkwsX4HeBIZWZmuuHDh/sdQ0QkpKxevbrcOZfV3bKQK4Lhw4ezatUqv2OIiIQUM9t+sGU6NCQiEuFUBCIiEU5FICIS4VQEIiIRzrMiMLOFZlZqZhsOstzM7D/NrNDM1pnZNK+yiIjIwXm5R/AkMOsQy2cDozsf1wG/9TCLiIgchGdF4Jx7F6g8xCrnAU+7Dh8B6WY2yKs8IiLSPT/vI8gGirs8L+l8bfeBK5rZdXTsNTB06NBeCSci0hucczS3BahpaqWuqY265rb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YKEAAAAASUVORK5CYII=\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
"import torch\n",
"\n",
"x = torch.linspace(-5,5,100)\n",
"plt.xlabel(\"x\")\n",
"plt.ylabel(\"y\")\n",
"plt.plot(x, sigmoid(x))\n",
"fname = 'sigmoid.png'\n",
"plt.savefig(fname)\n",
"fname"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[[file:# Out[32]:\n",
"\n",
" 'sigmoid.png'\n",
"\n",
"![img](./obipy-resources/Tb0Of9.png)]]\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### PyTorch\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Funkcja `torch.sigmoid` po prostu stosuje sigmoidę do każdego elementu tensora (*element-wise*).\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([0.6457, 0.7311, 0.0067])"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch\n",
"\n",
"torch.sigmoid(torch.tensor([0.6, 1.0, -5.0]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Istnieje również `torch.nn.Sigmoid`, które może być używane jako warstwa.\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([0.5000, 0.4502, 0.5987])"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch.nn as nn\n",
"\n",
"s = nn.Sigmoid()\n",
"s(torch.tensor([0.0, -0.2, 0.4]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Implementacja w Pytorchu\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([0.5000, 0.6225, 0.5744])"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch.nn as nn\n",
"import torch\n",
"\n",
"class MySigmoid(nn.Module):\n",
" def __init__(self):\n",
" super(MySigmoid, self).__init__()\n",
"\n",
" def forward(self, x):\n",
" return 1 / (1 + torch.exp(-x))\n",
"\n",
"s = MySigmoid()\n",
"s(torch.tensor([0.0, 0.5, 0.3]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Wagi\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Funkcja sigmoidalna nie ma żadnych wyuczalnych wag.\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### **Pytanie**: Czy można rozszerzyć funkcję sigmoidalną o jakieś wyuczalne wagi?\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Regresja liniowa\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Iloczyn skalarny — przypomnienie\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$$\\left[1.0, -0.5, 2.0\\right]\n",
" \\left[\\begin{array}{c}\n",
" 3.0 \\\\\n",
" 1.5 \\\\\n",
" 0.0\\end{array}\\right]\n",
" =\n",
" 1.0 \\cdot 3.0 + -0.5 \\cdot 1.5 + 2.0 \\cdot 0.0 = 2.25$$\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Intuicje\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"- $\\vec{a}^T \\vec{b}$ mierzy jak bardzo $\\vec{a}$ „pasuje” do\n",
" $\\vec{b}$,\n",
"- … zwłaszcza gdy znormalizujemy wektory dzieląc przez $|\\vec{a}|$ i $|\\vec{b}|$:\n",
" $\\frac{\\vec{a}^T \\vec{b}}{|\\vec{a}||\\vec{b}|} = \\cos \\theta$,\n",
" gdzie $\\theta$ to kąt pomiędzy $\\vec{a}$ and $\\vec{b}$ (podobieństwo kosinusowe!)\n",
"- co, jeśli if $\\vec{a}^T \\vec{b} = 0$? — $\\vec{a}$ i $\\vec{b}$ są prostopadłe, np.\n",
" $\\left[1, 2\\right] \\cdot \\left[-2, -1\\right]^T = 0$\n",
"- a co, jeśli $\\vec{a}^T \\vec{b} = -1$ — wektor są skierowane w przeciwnym kierunku, jeśli dodatkowo $|\\vec{a}|=|\\vec{b}|=1$, np.\n",
" $\\left[\\frac{\\sqrt{2}}{2},\\frac{\\sqrt{2}}{2}\\right] \\cdot \\left[-\\frac{\\sqrt{2}}{2},-\\frac{\\sqrt{2}}{2}\\right]^T = -1$\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### W PyTorchu\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor(2.2500)"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch\n",
"x = torch.tensor([1.0, -0.5, 2.0])\n",
"y = torch.tensor([3.0, 1.5, 0.0])\n",
"x @ y"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Regresja liniowa jako element sieci neuronowej\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Przypomnijmy sobie wzór na regresję liniową:\n",
"\n",
"$$y = w_0 + w_1x_1 + w_2x_2 + \\dots + w_{|V|}x_{|v|}$$\n",
"\n",
"Jeśli wprowadzimy sztuczny element wektora $\\vec{x}$ ustawiony zawsze na 1 ($x_0 = 1$), wówczas\n",
"wzór może przyjąc bardziej zwartą postać:\n",
"\n",
"$$y = \\sum_{i=0}^{|V|} w_ix_i = \\vec{w}\\vec{x}$$\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### PyTorch\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Implementacja w PyTorchu\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Zakładamy, że wektor wejściowy **nie** obejmuje dodatkowego elementu $x_0 = 1$.\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor(0., dtype=torch.float64, grad_fn=<AddBackward0>)"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch\n",
"import torch.nn as nn\n",
"\n",
"class MyLinearRegressor(nn.Module):\n",
" def __init__(self, vlen):\n",
" super(MyLinearRegressor, self).__init__()\n",
" self.register_parameter(name='w', param=torch.nn.Parameter(\n",
" torch.zeros(vlen, dtype=torch.double, requires_grad=True)))\n",
" self.register_parameter(name='b', param=torch.nn.Parameter(\n",
" torch.tensor(0., dtype=torch.double, requires_grad=True)))\n",
"\n",
" def forward(self, x):\n",
" return self.b + x @ self.w\n",
"\n",
"regressor = MyLinearRegressor(3)\n",
"regressor(torch.tensor([0.3, 0.4, 1.0], dtype=torch.double))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Gotowy moduł w PyTorchu\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Możemy skorzystać z ogólniejszej konstrukcji — warstwy liniowej (ale,\n",
"uwaga!, na wyjściu będzie wektor jednoelementowy).\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([-0.0557], grad_fn=<AddBackward0>)"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch\n",
"import torch.nn as nn\n",
"\n",
"regressor = torch.nn.Linear(in_features=3, out_features=1, bias=True)\n",
"regressor(torch.tensor([0.3, 0.4, 1.0]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Zastosowania\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Bezpośrednio możemy zastosować do zadania regresji dla tekstu (np.\n",
"przewidywanie roku publikacji tekstu).\n",
"\n",
"![img](./img-linear-regression.png)\n",
"\n",
"W połączeniu z sigmoidą otrzymamy regresją logistyczną, np. dla zadania klasyfikacji tekstu:\n",
"\n",
"$$p(c|\\vec{x}) = \\sigma(w_0 + w_1x_1 + w_2x_2 + \\dots + w_{|V|}x_{|v})\n",
"= \\sigma(\\Sigma_{i=0}^{|V|} w_ix_i) = \\sigma(\\vec{w}\\vec{x})$$\n",
"\n",
"![img](./img-logistic-regression.png)\n",
"\n",
"Tak sieć będzie aktywowana dla tekstu <u>aardvark in Aachen</u>:\n",
"\n",
"![img](./img-logistic-regression-aardvark.png)\n",
"\n",
"Regresje logistyczną (liniową zresztą też) dla tekstu możemy połączyć z trikiem z haszowaniem:\n",
"\n",
"$$p(c|\\vec{x}) = \\sigma(w_0 + w_1x_1 + w_2x_2 + \\dots + w_{2^b}x_{2^b})\n",
"= \\sigma(\\Sigma_{i=0}^{2^b} w_ix_i) = \\sigma(\\vec{w}\\vec{x})$$ \n",
"{\\small hashing function $H : V \\rightarrow \\{1,\\dots,2^b\\}$,\n",
" e.g. MurmurHash3}\n",
"\n",
"![img](./img-logistic-regression-hashing.png)\n",
"\n",
"****Pytanie:**** Jaki tekst otrzyma na pewno taką samą klasę jak <u>aardvark in Aachen</u>?\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Wagi\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Liczba wag jest równa rozmiarowi wektora wejściowego (oraz opcjonalnie\n",
"obciążenie).\n",
"\n",
"Każda waga odpowiada wyrazowi ze słownika, możemy więc interpretować\n",
"wagi jako jednowymiarowy parametr opisujący słowa.\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Warstwa liniowa\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Mnożenie macierzy przez wektor — przypomnienie\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Mnożenie macierzy przez wektor można interpretować jako zrównolegloną operację mnożenie wektora przez wektor.\n",
"\n",
"$$\\left[\\begin{array}{ccc}\n",
" \\alert<2>{1.0} & \\alert<2>{-2.0} & \\alert<2>{3.0} \\\\\n",
" \\alert<3>{-2.0} & \\alert<3>{0.0} & \\alert<3>{10.0}\\end{array}\\right]\n",
" \\left[\\begin{array}{c}\n",
" \\alert<2-3>{1.0} \\\\\n",
" \\alert<2-3>{-0.5} \\\\\n",
" \\alert<2-3>{2.0}\\end{array}\\right]\n",
" =\n",
" \\left[\\begin{array}{c}\n",
" \\uncover<2->{\\alert<2>{8.0}} \\\\\n",
" \\uncover<3->{\\alert<3>{18.0}}\\end{array}\\right]$$\n",
"\n",
"Jeśli przemnożymy macierz $n \\times m$ przez wektor kolumnowy o długości\n",
"$m$, otrzymamy wektor o rozmiarze $n$.\n",
"\n",
"W PyTorchu:\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([ 8., 18.])"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch\n",
"m = torch.tensor([[1.0, -2.0, 3.0],\n",
" [-2.0, 0.0, 10.0]])\n",
"x = torch.tensor([1.0, -0.5, 2.0])\n",
"m @ x"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[[file:# Out[19]:\n",
"\n",
" tensor([ 8., 18.])]]\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Definicja warstwy liniowej\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Warstwa liniowa polega na przemnożeniu wejścia przez macierz. Można\n",
"to intepretować jako zrównolegloną operację regresji liniowej (równolegle\n",
"uczymy czy wykonujemy $n$ regresji liniowych).\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### PyTorch\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Warstwa liniowa, która przyjmuje wektor o rozmiarze 3 i zwraca wektor o rozmiarze 2.\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([0.7000, 0.2270], grad_fn=<AddBackward0>)"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch\n",
"import torch.nn as nn\n",
"\n",
"regressor = torch.nn.Linear(in_features=3, out_features=2, bias=True)\n",
"regressor(torch.tensor([0.3, 0.4, 1.0]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Pytanie**: Ile wag (parametrów) ma powyżej użyta warstwa?\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Zastosowania\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Warstwa liniowa jest podstawowym elementem sieci neuronowych —\n",
"począwszy od prostych sieci neuronowych feed-forward, gdzie warstwy\n",
"liniowe łączymy używając funkcji aktywacji (np. sigmoidy).\n",
"\n",
"Oto przykład prostej dwuwarstwowej sieci neuronowej do klasyfikacji binarnej.\n",
"\n",
"![img](./img-feed-forward.png)\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Softmax\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"W klasyfikacji wieloklasowej należy zwrócić musimy zwrócić rozkład\n",
"prawdopodobieństwa po wszystkich klasach, w przeciwieństwie do\n",
"klasyfikacji binarnej, gdzie wystarczy zwrócić jedną liczbę —\n",
"prawdopodobieństwo pozytywnej klasy ($p$; prawdopodobieństwo drugiej\n",
"klasy to po prostu $1-p$).\n",
"\n",
"A zatem na potrzeby klasyfikacji wieloklasowej potrzeba wektorowego\n",
"odpowiednika funkcji sigmoidalnej, to jest funkcji, która zamienia\n",
"nieznormalizowany wektor $\\vec{z} = [z_1,\\dots,z_k]$ (pochodzący np. z\n",
"poprzedzającej warstwy liniowej) na rozkład prawdopobieństwa.\n",
"Potrzebujemy zatem funkcji $s: \\mathcal{R}^k \\rightarrow [0,1]^k$\n",
"\n",
"spełniającej następujące warunki:\n",
"\n",
"- $s(z_i) = s_i(z) \\in [0,1]$\n",
"- $\\Sigma_i s(z_i) = 1$\n",
"- $z_i > z_j \\Rightarrow s(z_i) > s(z_j)$\n",
"\n",
"Można by podać takie (**błędne**!) rozwiązanie:\n",
"\n",
"$$s(z_i) = \\frac{z_i}{\\Sigma_{j=1}^k z_j}$$\n",
"\n",
"To rozwiązanie zadziała błędnie dla liczb ujemnych, trzeba najpierw\n",
"użyć funkcji monotonicznej, która przekształaca $\\mathcal{R}$ na $\\mathcal{R^+}$.\n",
"Naturalna funkcja tego rodzaju to funkcja wykładnicza $\\exp{x} = e^x$.\n",
"Tym sposobem dochodzimy do funkcji softmax:\n",
"\n",
"$$s(z_i) = \\frac{e^{z_i}}{\\Sigma_{j=1}^k e^{z_j}}$$\n",
"\n",
"Mianownik ułamka w definicji funkcji softmax nazywamy czasami czynnikiem normalizacyjnym:\n",
"$Z(\\vec{z}) = \\Sigma_{j=1}^k e^{z_j}$, wtedy:\n",
"\n",
"$$s(z_i) = \\frac{e^{z_i}}{Z(\\vec{z})}$$\n",
"\n",
"Definicja w PyTorchu:\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([0.1182, 0.0022, 0.0059, 0.8737])"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch\n",
"\n",
"def softmax(z):\n",
" z_plus = torch.exp(z)\n",
" return z_plus / torch.sum(z_plus)\n",
"\n",
"softmax(torch.tensor([3., -1., 0., 5.]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![img](./softmax.png \"Softmax\")\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Soft vs hard\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Dlaczego *softmax*? Czasami używa się funkcji **hardmax**, która np.\n",
"wektora $[3, -1, 0, 5]$ zwróciłaby $[0, 0, 0, 5]$ — to jest po prostu\n",
"wektorowa wersja funkcji zwracającej maksimum. Istnieje też funkcja\n",
"hard\\*arg\\*max, która zwraca wektor *one-hot* — z jedną jedynką na\n",
"pozycji dla największej wartości (zamiast podania największej\n",
"wartości), np. wartość hardargmax dla $[3, -1, 0, 5]$ zwróciłaby $[0,\n",
"0, 0, 1]$.\n",
"\n",
"Zauważmy, że powszechnie przyjęta nazwa *softmax* jest właściwie\n",
"błędna, funkcja ta powinna nazywać się *softargmax*, jako że w\n",
"„miękki” sposób identyfikuje największą wartość przez wartość zbliżoną\n",
"do 1 (na pozostałych pozycjach wektora nie będzie 0).\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### **Pytanie**: Jak można zdefiniować funkcję *softmax* w ścisłym tego słowa znaczeniu („miękki” odpowiednik hardmax, nie hardargmax)?\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### PyTorch\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Funkcja `torch.nn.functional.softmax` normalizuje wartości dla całego tensora:\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"<ipython-input-13-e808e5e4899b>:3: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.\n",
" nn.functional.softmax(torch.tensor([0.6, 1.0, -5.0]))\n"
]
},
{
"data": {
"text/plain": [
"tensor([0.4007, 0.5978, 0.0015])"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch.nn as nn\n",
"\n",
"nn.functional.softmax(torch.tensor([0.6, 1.0, -5.0]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"… zobaczmy, jak ta funkcja zachowuje się dla macierzy:\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"<ipython-input-14-95deaae56e16>:3: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.\n",
" nn.functional.softmax(torch.tensor([[0.6, 1.0], [-2.0, 3.5]]))\n"
]
},
{
"data": {
"text/plain": [
"tensor([[0.4013, 0.5987],\n",
" [0.0041, 0.9959]])"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch.nn as nn\n",
"\n",
"nn.functional.softmax(torch.tensor([[0.6, 1.0], [-2.0, 3.5]]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Za pomocą (zalecanego zresztą) argumentu `dim` możemy określić wymiar, wzdłuż którego dokonujemy normalizacji:\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([[0.9309, 0.0759],\n",
" [0.0691, 0.9241]])"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch.nn as nn\n",
"\n",
"nn.functional.softmax(torch.tensor([[0.6, 1.0], [-2.0, 3.5]]), dim=0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Istnieje również `torch.nn.Softmax`, które może być używane jako warstwa.\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([0.3021, 0.2473, 0.4506])"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch.nn as nn\n",
"\n",
"s = nn.Softmax(dim=0)\n",
"s(torch.tensor([0.0, -0.2, 0.4]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Implementacja w Pytorchu\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([0.5000, 0.6225, 0.5744])"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch.nn as nn\n",
"import torch\n",
"\n",
"class MySoftmax(nn.Module):\n",
" def __init__(self):\n",
" super(MySoftmax, self).__init__()\n",
"\n",
" def forward(self, x):\n",
" ex = torch.exp(x)\n",
" return ex / torch.sum(ex)\n",
"\n",
"s = MySigmoid()\n",
"s(torch.tensor([0.0, 0.5, 0.3]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"###### **Pytanie**: Tak naprawdę wyżej zdefiniowana klasa `MySoftmax` nie zachowuje się identycznie jak `nn.Softmax`. Na czym polega różnica?\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Przypadek szczególny\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Sigmoida jest przypadkiem szczególnym funkcji softmax:\n",
"\n",
"$$\\sigma(x) = \\frac{1}{1 + e^{-x}} = \\frac{e^x}{e^x + 1} = \\frac{e^x}{e^x + e^0} = s([x, 0])_1$$\n",
"\n",
"Ogólniej: softmax na dwuelementowych wektorach daje przesuniętą sigmoidę (przy ustaleniu jednej z wartości).\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'softmax3.png'"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEKCAYAAAAfGVI8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Z1A+gAAAACXBIWXMAAAsTAAALEwEAmpwYAAAgb0lEQVR4nO3dd3yV9d3/8dcnm4RNwt4QpopIBESL1lHBRfXXu+6FLdpqHb3vVuqotra189Z6i0WLaB0U60ZFLVWr1kEhiECYIRgSVhICYWSd8f39cY5timEIuXKd8X4+HueRc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iSUxGIiCQ5FYGISJJTEYiIJDkVgYhIkvv/iv9SOtogqN4AAAAASUVORK5CYII=\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
"import torch\n",
"import torch.nn as nn\n",
"\n",
"x = torch.linspace(-5,5,100)\n",
"plt.xlabel(\"x\")\n",
"plt.ylabel(\"y\")\n",
"a = torch.Tensor(x.size()[0]).fill_(2.)\n",
"m = torch.stack([x, a])\n",
"plt.plot(x, nn.functional.softmax(m, dim=0)[0])\n",
"fname = 'softmax3.png'\n",
"plt.savefig(fname)\n",
"fname"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[[file:# Out[19]:\n",
"\n",
" 'softmax3.png'\n",
"\n",
"![img](./obipy-resources/gjBA7K.png)]]\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'softmax3d.png'"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPcAAADuCAYAAADlVZEAAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Z1A+gAAAACXBIWXMAAAsTAAALEwEAmpwYAACLy0lEQVR4nO2dd3hb5dnGf0fLsuS994gd20m8EycQ9t4k7L0pZbVQSqGMjq+D0TJKoZS9y0wChABh7wBxhncS7xnb8h6ytc/3h3xOZFuypcROQvB9XcbBtl69ks59nud9xv0IoigyhznM4cCDYl9vYA5zmMPsYI7cc5jDAYo5cs9hDgco5sg9hzkcoJgj9xzmcIBijtxzmMMBCtU0v5/Lk81hDrMPYTYWnbPcc5jDAYo5cs9hDgco5sg9hzkcoJgj9xzmcIBijtxzmMMBijlyz2EOByjmyD2HORygmCP3HOZ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l0q4eVUVL16aT3KwatobhqeUW2dnJ9XV1fj5+WG326murvbJco9dx1MKNQiCEAI8DpwoimKzIAheCQ/u9TO32Wxm8+bNOBwOigryAGdATakQOKsgjo9/fQi/OnIeX9d0c/Jj33Pv+moGRsfLDk3llpssdoqLi4mIiGDRokXyhxbgp+K8Bf68d10Rxy2I5ImvGznh3xtYtaXNLelkyz32O6vVytatW3E4HPL52hUHpYax5pfLuHFZGE19Js56aiN3vFNJ15AZ6fqaeOb2FmmRep44P5tHz1nk1BUH1ld27dZarhBF58V+anYUj33VxAfVQz7dMCRt8KwFzorAsLBQlDj45UKI0cFt79Wy3TDq04QYq0Oc1O65NCWEe07PZEvLIPd93YnoRXbe4sYtlxCkVfH4edno1Equf72cnf2jPpeLSim3zMxMli5dSkZGBv39/axZs4Znn32Wyy67jOLi4mnXGVPLrRVFsX5MVUUSanDFhcAaURSbAURRNHizx71axNLb28u2bdvIyMggMjISs9XZUDHikgrTaZTceNQ8zlkczyOf1/HiD828XbKT64+Yx4VFCWhUCo+W22YeZdRqY9GiQre65AqFgphADQ+encMly5K4d301d727jVd+bOGOEzNYlrqr51kOqIlOV6usrIx58+YRExPj8fUpFQInZQRxcnYMq7YZefnHZtZXGji70Fkj7Xo/6u7uprW1ldDQUMLDw6fNjQqCwJEZ4UAGv3qrkleK24j2i+KYebt/vpPKT/9yagbDZhtPbuolIljPeT7ONZNujv5+fnLl2PMZo1zywlb+udGIik0khfjJzR9TjTiy2h1uC1hOXBhF17CFf3xSzxMbe/h7QvyU15t0PNO4ITdAbLCWx8/P5rKXSrnlnRruOmjPRj75+/tz9NFHy6OMli9f7pU2fltbG0wv1JABqAVB+BKnUMMjoii+NN3ae8VyS+5sbW0tixcvloM1fmoVSmFXKswV0UF+3LNyIe9cu4xFsUHcu76aU//zPZ9sM0zSE5cEES2jRmwOPLbbuVr8/MRgXr96CQ+enU3/qJVLX9jCDa+V0tQzAuyy3GaLjbKyMnJycqYktgRBENBrFNx+wnw5av/SD87PrrHH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TiY+Pn/HshiiK3HvvvTQ1NfHCCy/sVWIPDw9zxBFHcNddd3HmmWfO5NJz5N4diKLItm3bWLVqFevWrSMkJIRjjjmGjz76iMcee2xvTZSQ68SnqgITRXFcY0hAQICcS/f1IpZuXmFhYXtFoRR2dctlZWUxODhIV1cXdrt9XIPOntxERVHkwQcfpKqqildeeWVWe/Unwmq1cuqpp3LCCSdwyy23zPTyc+TeU4iiyOeff86ll15KamoqGo2G008/ndNPP53o6OhZs96+1olLex0aGpJz6Z6mk7qD3W6npKRkr6bXJGLn5+ePs9ZWq3VGxjSJosijjz5KcXExr7/++l6ppnN97ssuu4ywsDD+9a9/zcZTzJF7JvCPf/yDY489loKCAhobG1m9ejVvv/02SqWS0047jZUrV85YkEsUxXE55T1xIV2LZlQqlZxLn+gFWK1WSktL95pCKXgm9kRMHNMUEhIiV5dNdQQRRZEnn3ySL7/8klWrVu2V+ndXfPvttxx22GHj6gLuueceTj755Jl6ijlyzxZEUaStrU0musVi4bTTTmPFihUkJyfvFtFno05cwujoqJxikwQoIiMjUSqVezVvDuPbRH05X08c0xQQECD3pru626Io8txzz/HBBx/w9ttv75UKxX2AOXLvDYiiSGdnJ2vWrGHNmjUMDg5yyimnsHLlSq/nYe2NOnEJZrMZg8FAR0cHQ0NDREVFkZqauleqs3aX2BMxsZxXo9EQEBCAVqvliy++YPXq1axdu3bWesz3A8yRe1+gq6uLd955hzVr1tDV1cVJJ53EihUrPBaCSKN2goOD91oUXlIonTdvHjabDYPBgNlsJjw8nOjo6N2qLJsOkrTVnhLbHUZGRiguLubWW2+ls7OTW265hQsuuGBWI/77GHPk3tfo6+uTxSdaWlo4/vjjOeOMM2QBB6vVKvea761AlieFUpvNRk9PD52dnRiNRrmneybG+ErEdlWImWmsWbOGp59+mueff54vvvgCrVbLRRddNCvPtR9gjtz7EwYGBuSe9NraWg455BA2bNjA888/T2Zm5l7Zg7cKpe4EKKKioqado+UOvb291NTUkJ+fP2vEfu+993j00Ufl1OVsYP369dx0003Y7Xauvvpqfv/738/K83iJOXLvr6iqquLUU08lMzOT1tZWjjrqKFasWMHSpUv3O4VST8McvMmlS1JMs0ns9evX889//pP333/fbbvtTMBut5ORkcEnn3xCQkICRUVFvPbaazNZK+4rfnoCiT8XVFRU8Prrr7N06VJGR0f5+OOPeeGFF7jppps47LDDWLFiBcuXL5+xogvXum1fGzIUCgVhYWGyuIE03qi+vh6dTifn0ifuVSJ2QUHBrKWiPvvsM+677z4++OCDWSM2wMaNG0lPT5fnip9//vm8++67+5Lcs4I5yz2LMJvNfPbZZ6xatYoff/yRgw8+mJUrV3LYYYftdhGGFKGe6bptdxFrKcU2NDQ068T++uuvufvuu3n//fdnPY23atUq1q9fzzPPPAPAyy+/zI8//shjjz02q887BWbFcu+9Vhov8cADDyAIgjyR8acMPz8/Tj75ZJ577jlKSko477zzWLduHcuXL+e6667jo48+wmw2e71eT0+PHMia6bSQIAgEBgaSlpbGsmXLyMjIwGq1smnTJnket6eJrXuK7777jjvvvJO1a9futb72ifgJSTJ5jf3KLW9paeGTTz7xeaDeTwFqtZrjjjuO4447DpvNxrfffsuqVav4wx/+QG5uLitXruSYY47xSFpJoXQ2racr9Ho9o6OjqFQqioqK6Ovro7KyUh7mEBUVNSM92j/++CO33XYba9euJS4ubgZ2Pj0SEhJoaWmR/7+1tXWvPffexH7llp999tn84Q9/YMWKFWzatImIiIi9+fT7BHa7ne+//17uSc/KymLlypUcf/zxciFKe3s7ra2te02hFJz5/YaGhkmNLhaLRVZpkYY5REdH71ZTyJYtW7jhhht4991391oDDzjThBkZGXz22WfEx8dTVFTEq6++yqJFi/baHibgwA6orV27lvj4ePLy8vb1VvYqlEolhx56KIceeigOh4PNmzfz1ltv8Y9//IN58+YRGRkpd0PtrS4oT8QG58SQ+Ph44uPjZZWWuro6uSlkKn10V5SWlnL99dezZs2avUpsAJVKxWOPPcYJJ5yA3W7nyiuv3JfEnjXsVct97LHH0tHRMennf//737nnnnv4+OOP5cqun4vl9gSHw8Fdd93F6tWrCQoKknvSTznllBmfKuoKidgFBQU+eQnu9NElAYqJufTKykquuuoq3nrrrb1WE7Cf46dvuT/99FO3Py8vL5eH64HzDFRYWMjGjRt/ahK1Mwar1YrNZqO8vByNRkNVVRWrVq1i5cqVhIWFsWLFCk499dQZvQG6nut9df9dVV8dDgd9fX10dnayY8cOWY4pMDCQxsZGrrrqKl577bU5Ys8y9qszt4Q5y+0ZUrfZqlWrWLt2LTqdjhUrVnDaaaftUU+6wWCQxSRm8lwvyTHt2LGDq666CovFws0338y111476+OPf0L4eaTCZhK/+93vyMrKIjc3lzPOOIP+/v59vaU9hiAIZGRkcOedd/L999/zzDPPYLFYuOSSSzjppJN4/PHH2blzp9t0jyfMFrGl/YaEhMgNLPfddx/9/f3cdtttM/o8c5iM/dJyzxQ+/vhjjj76aFQqFbfffjsA999//z7e1exAFEVaW1vlnnSbzcZpp53G6aefPmVPemdnJ83NzbMaiW9paeG8887jySefZNmyZbPyHK743e9+x3vvvYdGoyEtLY3nn39+xmrU//CHPxARESHrlt91111ER0fz61//ek+Wnast3xO8/fbbrFq1iv/973/7eiuzDlEU6ejokHvSh4eHOeWUU1ixYsW4nnSJ2AUFBbMWid+5cyfnnHMOjz76KIceeuisPMdEzOZNvbGxkTPPPJMtW7bgcDiYP38+Gzdu3FPt+Z9+QG1f4rnnnuO8887b19vYKxAEgdjYWG644QZuuOEGurq6ePvtt7n99tvp6enhpJNOQqVSYbPZuPXWW2eN2B0dHZx33nk8/PDDe43YAMcff7z874MOOohVq1bN2NopKSmEh4ezdetWOjs7KSgo2CtDJXYHP3nLPVV6bcWKFfK/N23axJo1aw7IMkNf0Nvby1133cW7775LfHw8xxxzDGecccaU44V2B11dXZx11lnce++9Myne7zNOO+00zjvvPC6++OIZW/ONN95gw4YNdHR0cNlll82EltqcW747ePHFF3niiSf47LPPZmWkzU8NAwMDXH755bz00ks4HA7WrVvH6tWrqaur47jjjmPlypXk5+fvEdF7eno466yz+POf/zyTIoLjsC9v6haLhZycHKxWKzU1NTPR1jtHbl+xfv16brnlFr766isiIyP39Xb2awwPD/PBBx+watUqtm3bxtFHH82KFSsoKiry6eLt7+/nzDPP5I477pBJti8w2zf1a6+9lpCQEO67776ZWG523ElRFKf6+kkjLS1NTEhIEPPy8sS8vDzxl7/85W6v9eGHH4oZGRliWlqaeO+9987gLvc/jIyMiG+//bZ40UUXiYsWLRKvu+46cf369eLAwIBoNBo9frW3t4vLly8X33rrrX26/w8//FBcsGCBaDAYZmV9u90u5uXlidXV1TO15HQ83K2vA5rcMwWbzSbOmzdPrKurE81ms5ibmytWVlbu623tFZhMJnHdunXi5ZdfLi5atEi8+uqrxXXr1on9/f3jiN3Z2Skefvjh4quvvrqvtzyjN/WJqKysFFNTU8VbbrllxtYUZ4ncB7RbPlP4/vvv+fOf/8xHH30EwL333gvAHXfcsS+3tddhtVplqeFvv/2WoqIiVq5cybJly7jooou47LLLuOyyy/b1Nn+KmKtQ21doa2sjMTFR/v+EhATa2tr24Y72DdRqNccffzxPPvkkpaWlXH755XzyySfk5ORw/PHHzxF7P8PPJs+9J3Dn3fzcU2oqlYojjzySI488koceemivj/iZw/SYI7cX+Lkod+wuZksJdQ57hjm33AsUFRVRU1NDQ0MDFouF119/ndNPP31fb+tniQNJY2+2MUduL+Cq3LFgwQLOPffcGVHuaGlp4aijjmLBggUsWrSIRx55ZAZ2e+DiQNbYmw3MRcv3Idrb22lvb6ewsJChoSEWL17MO++8c8DpZ88UDmCNvblo+YGG2NhYCgsLAQgMDGTBggU/yyi8N/i5auztCeYCavsJGhsb2bp1617pd95f4Y3G3hy8x5xbvh9geHiYI444grvuuoszzzxzX29nv0N5eTnHHHOMXCMuZSsOII29ucaRAxFWq5VTTz2VE044gVtuuWVfb+cngQNQY2/uzH2gQRRFrrrqKhYsWDBH7DnMOOYs9z7Et99+y2GHHUZOTo7cP33PPffMSA+03W5nyZIlxMfHs27duj1ebw6zijmZpQMNhx56qE8qpb7gkUceYcGCBQwODs7K+nPY//Gzd8uLi4vJzc3FZDJhNBpZtGgRFRUV+3pbe4TW1lbef/99rr766n29lTnsQ0znlv8sIAjC3wAt4A+0iqJ47z7e0h5BEIRVwL1AIHCrKIqn7uMtzWEfYM4td+IvQDFgAvZIgHpfQxCEUwGDKIqbBUE4ch9vZw77ED97t3wMYUAATkun3cd72VMcApwuCEIj8DpwtCAIr+zbLc1hX2DOLQcEQViLkwipQKwoijfu4y3NCMYs95xb/jPFz94tFwThUsAmiuKrgiAogQ2CIBwtiuLn+3pvc5jDnmDOcs9hDgco5s7cc5jDAYo5cs9hDgco5sg9hzkcoJgj9xzmcIBijtxzmMMBijlyz2EOByjmyD2HORygmCP3HOZwgOL/AaJgSf7ygNsrAAAAAElFTkSuQmCC\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
"from mpl_toolkits import mplot3d\n",
"import torch\n",
"import torch.nn as nn\n",
"\n",
"x = torch.linspace(-5,5,10)\n",
"y = torch.linspace(-5,5,10)\n",
"fig = plt.figure()\n",
"ax = fig.add_subplot(111, projection='3d')\n",
"plt.xlabel(\"x\")\n",
"plt.ylabel(\"y\")\n",
"X, Y = torch.meshgrid(x, y)\n",
"m = torch.stack([X, Y])\n",
"z = nn.functional.softmax(m, dim=0)\n",
"ax.plot_wireframe(x, y, z[0])\n",
"fname = 'softmax3d.png'\n",
"plt.savefig(fname)\n",
"fname"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[[file:# Out[27]:\n",
"\n",
" 'softmax3d.png'\n",
"\n",
"![img](./obipy-resources/p96515.png)]]\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Wagi\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Podobnie jak funkcja sigmoidalna, softmax nie ma żadnych wyuczalnych wag.\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Zastosowania\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Podstawowym zastosowaniem funkcji softmax jest klasyfikacja\n",
"wieloklasowa, również w wypadku zadań przetwarzania sekwencji, które\n",
"mogą być interpretowane jako klasyfikacja wieloklasowa:\n",
"\n",
"- przewidywanie kolejnego słowa w modelowaniu języka (klasą jest słowo, zbiór klas to słownik, np. klasą początku tekstu *Dzisiaj rano kupiłem w piekarni* może być *bułki*)\n",
"- przypisywanie etykiet (np. części mowy) słowom.\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### LogSoftmax\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Ze względów obliczeniowych często korzysta się z funkcji **LogSoftmax**\n",
"która zwraca logarytmy pradopodobieństw (*logproby*).\n",
"\n",
"$$log s(z_i) = log \\frac{e^{z_i}}{\\Sigma_{j=1}^k e^{z_j}}$$\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### PyTorch\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([-1.1971, -1.3971, -0.7971])"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch.nn as nn\n",
"\n",
"s = nn.LogSoftmax(dim=0)\n",
"s(torch.tensor([0.0, -0.2, 0.4]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Niektóre funkcje kosztu (np. `NLLLoss`) zaimplementowane w PyTorchu\n",
"operują właśnie na logarytmach prawdopobieństw.\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Przykład: klasyfikacja wieloklasowa\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Na przykładzie rozpoznawania dyscypliny sportu: git://gonito.net/sport-text-classification.git\n",
"\n",
"Wczytujemy zbiór uczący:\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'zimowe': 0,\n",
" 'moto': 1,\n",
" 'tenis': 2,\n",
" 'pilka-reczna': 3,\n",
" 'sporty-walki': 4,\n",
" 'koszykowka': 5,\n",
" 'siatkowka': 6,\n",
" 'pilka-nozna': 7}"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import gzip\n",
"from pytorch_regression.analyzer import vectorize_text, vector_length\n",
"\n",
"texts = []\n",
"labels = []\n",
"labels_dic = {}\n",
"labels_revdic = {}\n",
"c = 0\n",
"\n",
"with gzip.open('sport-text-classification/train/train.tsv.gz', 'rt') as fh:\n",
" for line in fh:\n",
" line = line.rstrip('\\n')\n",
" line = line.replace('\\\\\\t', ' ')\n",
" label, text = line.split('\\t')\n",
" texts.append(text)\n",
" if label not in labels_dic:\n",
" labels_dic[label] =c\n",
" labels_revdic[c] = label\n",
" c += 1\n",
" labels.append(labels_dic[label])\n",
"nb_of_labels = len(labels_dic)\n",
"labels_dic"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Przygotowujemy model:\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [],
"source": [
"import torch.nn as nn\n",
"from torch import optim\n",
"\n",
"model = nn.Sequential(\n",
" nn.Linear(vector_length, nb_of_labels),\n",
" nn.LogSoftmax()\n",
" )\n",
"\n",
"optimizer = optim.Adam(model.parameters())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Funkcja kosztu to log-loss.\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor(2.3026)"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch\n",
"import torch.nn.functional as F\n",
"\n",
"loss_fn = torch.nn.NLLLoss()\n",
"\n",
"expected_class_id = torch.tensor([2])\n",
"loss_fn(torch.log(\n",
" torch.tensor([[0.3, 0.5, 0.1, 0.0, 0.1]])),\n",
" expected_class_id)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Pętla ucząca:\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/usr/lib/python3.9/site-packages/torch/nn/modules/container.py:119: UserWarning: Implicit dimension choice for log_softmax has been deprecated. Change the call to include dim=X as an argument.\n",
" input = module(input)\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.04162006452679634 2.081003189086914 0 0 tensor([[0.1248, 0.1249, 0.1252, 0.1248, 0.1248, 0.1253, 0.1251, 0.1251]],\n",
" grad_fn=<ExpBackward>) MŚ w hokeju: [...]\n",
"1.3499293327331543 1.4718239307403564 4950 5 tensor([[0.1089, 0.0784, 0.1235, 0.1255, 0.0868, 0.2295, 0.1285, 0.1189]],\n",
" grad_fn=<ExpBackward>) Liga Letnia NBA: [...].\n"
]
}
],
"source": [
"iteration = 0\n",
"step = 50\n",
"closs = torch.tensor(0.0, dtype=torch.float, requires_grad=False)\n",
"\n",
"for t, y_exp in zip(texts, labels):\n",
" x = vectorize_text(t).float().unsqueeze(dim=0)\n",
"\n",
" optimizer.zero_grad()\n",
"\n",
" y_logprobs = model(x)\n",
"\n",
" loss = loss_fn(y_logprobs, torch.tensor([y_exp]))\n",
"\n",
" loss.backward()\n",
"\n",
" with torch.no_grad():\n",
" closs += loss\n",
"\n",
" optimizer.step()\n",
"\n",
" if iteration % 50 == 0:\n",
" print((closs / step).item(), loss.item(), iteration, y_exp, torch.exp(y_logprobs), t)\n",
" closs = torch.tensor(0.0, dtype=torch.float, requires_grad=False)\n",
" iteration += 1\n",
"\n",
" if iteration == 5000:\n",
" break"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Model jest tak prosty, że jego wagi są interpretowalne.\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([[0.0926, 0.1013, 0.0889, 0.0887, 0.0975, 0.3423, 0.0921, 0.0965]])"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"with torch.no_grad():\n",
" x = vectorize_text('NBA').float().unsqueeze(dim=0)\n",
" y_prob = model(x)\n",
"torch.exp(y_prob)"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([-0.6260, -0.6487, -0.6373, -0.6369, -0.5877, 0.6338, -0.6376, -0.6468],\n",
" grad_fn=<SelectBackward>)"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"with torch.no_grad():\n",
" x = vectorize_text('NBA').float().unsqueeze(dim=0)\n",
" ix = torch.argmax(x).item()\n",
"model[0].weight[:,ix]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Możemy nawet zaprezentować wykres przedstawiający rozmieszczenie słów względem dwóch osi odnoszących się do poszczególnych wybranych dyscyplin.\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAD5CAYAAAAqaDI/AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Z1A+gAAAACXBIWXMAAAsTAAALEwEAmpwYAAAbi0lEQVR4nO3df3QV1b338feXAMqDIlBQwo824uJHMQFiAw8PVECFi8XWgOBTXdUbrJhaa++9/YFF0a6qvS1Kr1rXY3FxVQRtkRY0UuSWq6hFqbaJooD0piCmlYRCAANiQEn4Pn9kOA3x5BczSQ6Zz2uts87Mnr1n730O5uPMOWfG3B0REYmvDm09ABERaVsKAhGRmFMQiIjEnIJARCTmFAQiIjGnIBARibmOUezEzC4Ffg6kAY+4+/w6278G/CBYPQR8093fbmy/vXr18oyMjCiGKCISC2+88cZed+/dnDahg8DM0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gd86PTgS311W1hoeYRQfsoNGUMhcAgMzvXzDoDVwXt2vq9qHdctawC/jn45s0Y4EBwCqwpbVvDSc/BzLqa2ZkAZtYV+Cfa7r+FMK9nqrwX0WrrT6tT/QF8BlgHbAueewblfYE1teotA3ZR8+HSTuD6oPwJYDOwiZp/MOmn6DyStk/ROUwF/kLNtzvm1Spv0/ci2biAG4Ebg2UDHgq2bwZyGptTG7wHJzUHar5l83bweKct59DEefQJ/v0fBCqC5W6p9F5E+dAvi0VEYk6nhkREYk5BICIScwoCEZGYUxCIiMScgkBEJOYUBCIiMacgEBGJOQWBiEjM/X/f77bhPki9GAAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
"\n",
"with torch.no_grad():\n",
" words = ['piłka', 'klub', 'kort', 'boisko', 'samochód']\n",
" words_ixs = [torch.argmax(vectorize_text(w).float().unsqueeze(dim=0)).item() for w in words]\n",
"\n",
" x_label = labels_dic['pilka-nozna']\n",
" y_label = labels_dic['tenis']\n",
"\n",
" x = [model[0].weight[x_label, ix] for ix in words_ixs]\n",
" y = [model[0].weight[y_label, ix] for ix in words_ixs]\n",
"\n",
" fig, ax = plt.subplots()\n",
" ax.scatter(x, y)\n",
"\n",
" for i, txt in enumerate(words):\n",
" ax.annotate(txt, (x[i], y[i]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Zadanie etykietowania sekwencji\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Zadanie etykietowania sekwencji (*sequence labelling*) polega na przypisaniu poszczególnym wyrazom (tokenom) tekstu **etykiet** ze skończonego zbioru. Definiując formalnie:\n",
"\n",
"- rozpatrujemy ciąg wejściowy tokenów $(t^1,\\dots,t^K)$\n",
"- dany jest skończony zbiór etykiet $L = \\{l_1,\\dots,l_{|L|}\\}$, dla uproszczenia można założyć, że etykietami\n",
" są po prostu kolejne liczby, tj. $L=\\{0,\\dots,|L|-1\\}$\n",
"- zadanie polega na wygenerowaniu sekwencji etykiet (o tej samej długości co ciąg wejściowy!) $(y^1,\\dots,y^K)$,\n",
" $y^k \\in L$\n",
"\n",
"Zadanie etykietowania można traktować jako przypadek szczególny klasyfikacji wieloklasowej, z tym, że klasyfikacji dokonujemy wielokrotnie — dla każdego tokenu (nie dla każdego tekstu).\n",
"\n",
"Przykłady zastosowań:\n",
"\n",
"- oznaczanie częściami mowy (*POS tagger*) — czasownik, przymiotnik, rzeczownik itd.\n",
"- oznaczanie etykiet nazw w zadaniu NER (nazwisko, kwoty, adresy — najwięcej tokenów będzie miało etykietę pustą, zazwyczaj oznaczaną przez `O`)\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### **Pytanie**: czy zadanie tłumaczenia maszynowego można potraktować jako problem etykietowania sekwencji?\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Przykładowe wyzwanie NER CoNLL-2003\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Zob. [https://gonito.net/challenge/en-ner-conll-2003](https://gonito.net/challenge/en-ner-conll-2003).\n",
"\n",
"Przykładowy przykład uczący (`xzcat train.tsv.xz| head -n 1`):\n",
"\n",
"O O B-MISC I-MISC O O O O O B-LOC O B-LOC O O O O O O O O O O O B-MISC I-MISC O O O O O B-PER I-PER O B-LOC O O O O O O B-PER I-PER O B-LOC O O O O O O B-PER I-PER I-PER O B-LOC O O O O O B-PER I-PER O O B-LOC O O O O O O B-PER I-PER O B-LOC O O O O O B-PER I-PER O O O O O B-PER I-PER O B-LOC O O O O O B-PER I-PER O B-LOC O B-LOC O O O O O O B-PER I-PER O O O O B-PER I-PER O B-LOC O O O O O O B-PER I-PER O B-LOC O O O O O B-PER I-PER O O O O O B-PER I-PER O B-LOC O O O O O B-PER I-PER O B-LOC O O O O O O B-PER I-PER O O O O O B-PER I-PER O B-LOC O O O O O B-PER I-PER O B-LOC O O O O O O B-PER I-PER O O O O B-PER I-PER I-PER O B-LOC O O O O O O B-PER I-PER O O O O B-PER I-PER O B-LOC O O O O O O B-PER I-PER O B-LOC O O O O O O B-PER I-PER O O O O B-PER I-PER O B-LOC O O O O O O B-PER I-PER O O O O B-PER I-PER O B-LOC O O O O O O B-PER I-PER O B-LOC O O O O O B-PER I-PER O B-LOC O B-LOC O O O O O B-PER I-PER O O O O O\tGOLF - BRITISH MASTERS THIRD ROUND SCORES . </S> NORTHAMPTON , England 1996-08-30 </S> Leading scores after </S> the third round of the British Masters on Friday : </S> 211 Robert Allenby ( Australia ) 69 71 71 </S> 212 Pedro Linhart ( Spain ) 72 73 67 </S> 216 Miguel Angel Martin ( Spain ) 75 70 71 , Costantino Rocca </S> ( Italy ) 71 73 72 </S> 217 Antoine Lebouc ( France ) 74 73 70 , Ian Woosnam 70 76 71 , </S> Francisco Cea ( Spain ) 70 71 76 , Gavin Levenson ( South </S> Africa ) 66 75 76 </S> 218 Stephen McAllister 73 76 69 , Joakim Haeggman ( Swe ) 71 77 </S> 70 , Jose Coceres ( Argentina ) 69 78 71 , Paul Eales 75 71 72 , </S> Klas Eriksson ( Sweden ) 71 75 72 , Mike Clayton ( Australia ) </S> 69 76 73 , Mark Roe 69 71 78 </S> 219 Eamonn Darcy ( Ireland ) 74 76 69 , Bob May ( U.S. ) 74 75 70 , </S> Paul Lawrie 72 75 72 , Miguel Angel Jimenez ( Spain ) 74 72 </S> 73 , Peter Mitchell 74 71 75 , Philip Walton ( Ireland ) 71 74 </S> 74 , Peter O'Malley ( Australia ) 71 73 75 </S> 220 Barry Lane 73 77 70 , Wayne Riley ( Australia ) 71 78 71 , </S> Martin Gates 71 77 72 , Bradley Hughes ( Australia ) 73 75 72 , </S> Peter Hedblom ( Sweden ) 70 75 75 , Retief Goosen ( South </S> Africa ) 71 74 75 , David Gilford 69 74 77 . </S>\n",
"\n",
"W pierwszym polu oczekiwany wynik zapisany za pomocą notacji **BIO**.\n",
"\n",
"Jako metrykę używamy F1 (z pominięciem tagu `O`)\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Metryka F1\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Etykietowanie za pomocą klasyfikacji wieloklasowej\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Można potraktować problem etykietowania dokładnie tak jak problem\n",
"klasyfikacji wieloklasowej (jak w przykładzie klasyfikacji dyscyplin\n",
"sportowych powyżej), tzn. rozkład prawdopodobieństwa możliwych etykiet\n",
"uzyskujemy poprzez zastosowanie prostej warstwy liniowej i funkcji softmax:\n",
"\n",
"$$p(l^k=j) = s(W\\vec{v}(t^k))_j = \\frac{e^{(W\\vec{v}(t^k))_j}}{Z},$$\n",
"\n",
"gdzie $\\vec{v}(t^k)$ to reprezentacja wektorowa tokenu $t^k$.\n",
"Zauważmy, że tutaj (w przeciwieństwie do klasyfikacji całego tekstu)\n",
"reprezentacja wektorowa jest bardzo uboga: wektor <u>one-hot</u>! Taki\n",
"klasyfikator w ogóle nie będzie brał pod uwagę kontekstu, tylko sam\n",
"wyraz, więc tak naprawdę zdegeneruje się to do zapamiętania częstości\n",
"etykiet dla każdego słowa osobno.\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Bogatsza reprezentacja słowa\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Można spróbować uzyskać bogatszą reprezentację dla słowa biorąc pod uwagę na przykład:\n",
"\n",
"- długość słowa\n",
"- kształt słowa (*word shape*), np. czy pisany wielkimi literami, czy składa się z cyfr itp.\n",
"- n-gramy znakowe wewnątrz słowa (np. słowo *Kowalski* można zakodować jako sumę wektorów\n",
" trigramów znakówych $\\vec{v}(Kow) + \\vec{v}(owa) + \\vec{v}(wal) + \\vec{v}(als) + \\vec{v}(lsk) + \\vec{v}(ski)$\n",
"\n",
"Cały czas nie rozpatrujemy jednak w tej metodzie kontekstu wyrazu.\n",
"(*Renault* w pewnym kontekście może być nazwą firmy, w innym —\n",
"nazwiskiem).\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Reprezentacja kontekstu\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Za pomocą wektora można przedstawić nie pojedynczy token $t^k$, lecz\n",
"cały kontekst, dla *okna* o długości $c$ będzie to kontekst $t^{k-c},\\dots,t^k,\\dots,t^{k+c}$.\n",
"Innymi słowy klasyfikujemy token na podstawie jego samego oraz jego kontekstu:\n",
"\n",
"$$p(l^k=j) = \\frac{e^{(W\\vec{v}(t^{k-c},\\dots,t^k,\\dots,t^{k+c}))_j}}{Z}.$$\n",
"\n",
"Zauważmy, że w tej metodzie w ogóle nie rozpatrujemy sensowności\n",
"sekwencji wyjściowej (etykiet), np. może być bardzo mało\n",
"prawdopodobne, że bezpośrednio po nazwisku występuje data.\n",
"\n",
"Napiszmy wzór określający prawdopodobieństwo całej sekwencji, nie\n",
"tylko pojedynczego tokenu. Na razie będzie to po prostu iloczyn poszczególnych wartości.\n",
"\n",
"$$l = (l^1,\\\\dots,l^k), p(l) = \\prod_{k=1}^K \\frac{e^{(W\\vec{v}(t^{k-c},\\dots,t^k,\\dots,t^{k+c}))_{l^k}}}{Z_k} = \\frac{e^{\\sum_{k=1}^K (W\\vec{v}(t^{k-c},\\dots,t^k,\\dots,t^{k+c}))_{l^k}}}{\\prod_{k=1}^K Z_k}$$\n",
"\n",
"Reprezentacja kontekstu może być funkcją embeddingów wyrazów\n",
"(zakładamy, że embedding nie zależy od pozycji słowa).\n",
"\n",
"$$\\vec{v}(t^{k-c},\\dots,t^k,\\dots,t^{k+c}) = f(\\vec{E}(t^{k-c}),\\dots,\\vec{E}(t^k),\\dots,\\vec{E}({t^{k+c}}))$$\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Warunkowe pola losowe\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Warunkowe pola losowe (*Conditional Random Fields*, *CRF*) to klasa\n",
"modeli, które pozwalają uwzględnić zależności między punktami danych\n",
"(które można wyrazić jako graf). Najprostszym przykładem będzie prosty\n",
"graf wyrażający „następowanie po” (czyli sekwencje). Do poprzedniego\n",
"wzoru dodamy składnik $V_{i,j}$ (który można interpretować jako\n",
"macierz) określający prawdopodobieństwo, że po etykiecie o numerze $i$ wystąpi etykieta o numerze $j$.\n",
"\n",
"**Pytanie**: Czy macierz $V$ musi być symetryczna? Czy $V_{i,j} = V_{j,i}$? Czy jakieś specjalne wartości występują na przekątnej?\n",
"\n",
"Macierz $V$ wraz z macierzą $W$ będzie stanowiła wyuczalne wagi w naszym modelu.\n",
"\n",
"Wartości $V_{i,j}$ nie stanowią bezpośrednio prawdopodobieństwa, mogą\n",
"przyjmować dowolne wartości, które będę normalizowane podobnie, tak jak to się dzieje w funkcji Softmax.\n",
"\n",
"W takiej wersji warunkowych pól losowych otrzymamy następujący wzór na prawdopodobieństwo całej sekwencji.\n",
"\n",
"$$p(l) = \\frac{e^{\\sum_{k=1}^K (W\\vec{v}(t^{k-c},\\dots,t^k,\\dots,t^{k+c}))_{l^k} + \\sum_{k=1}^{K-1} V_{l^k,l^{k+1}}}}{\\prod_{k=1}^K Z_k}$$\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Algorytm Viterbiego\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"W czasie inferencji mamy ustalone wagi funkcji $\\vec{v}(\\dots)$ oraz\n",
"macierz $V$. Szukamy sekwencji $y$ która maksymalizuje prawdopodobieństwo estymowane przez model:\n",
"\n",
"$$y = \\underset{l}{\\operatorname{argmax}} \\hat{p}(l|t^1,\\dots,t^K)$$\n",
"\n",
"Naiwne podejście polegające na obliczeniu prawdopodobieństw wszystkich możliwych sekwencji miałoby\n",
"nieakceptowalną złożoność czasową $O(|L|^K)$.\n",
"\n",
"Na szczęście, możemy użyć **algorytmu Viterbiego** o lepszej złożoności\n",
"obliczeniowej, algorytmu opartego na idei programowania dynamicznego.\n",
"\n",
"W algorytmie będziemy wypełniać dwuwymiarowe tabele $s[i, j]$ i $b[i, j]$:\n",
"\n",
"- $s[i, j]$ — będzie zawierać maksymalne prawdopodobieństwo (właściwie: nieznormalizowaną wartość,\n",
" która jest monotoniczna względem prawdopodobieństwa)\n",
" dla ciągów o długości $i$ zakończonych etykietą $l_j$,\n",
"- $b[i, j]$ — będzie zawierać „wskaźnik” wsteczny (*backpointer*) do podciągu o długości $i-1$, dla którego\n",
" razem z $l_j$ jest osiągana maksymalna wartość $s[i, j]$.\n",
"\n",
"Inicjalizacja:\n",
"\n",
"- $s[1, j] = (W\\vec{v}(t^k,\\dots,t^{k+c}))_j$,\n",
"- $b[1, j]$ — nie musimy wypełniać tej wartości.\n",
"\n",
"Dla $i > 1$ i dla każdego $j$ będziemy teraz szukać:\n",
"\n",
"$$\\underset{q \\in \\{1,\\dots,|V|\\}}{\\operatorname{max}} s[i-1, q] + (W\\vec{v}(t^{k-c},\\dots,t^k,\\dots,t^{k+c}))_j + V_{q, j}$$\n",
"\n",
"Tę wartość przypiszemy do $s[i, j]$, z kolei do $b[i, j]$ — indeks\n",
"$q$, dla którego ta największa wartość jest osiągnięta.\n",
"\n",
"Najpierw obliczenia wykonujemy wprzód wypełniając tabelę dla coraz większych wartości $j$.\n",
"W ten sposób otrzymamy największą wartość (nieznormalizowanego) prawdopodobieństwa:\n",
"\n",
"$$\\underset{q \\in \\{1,\\dots,|V|\\}}{\\operatorname{max}} s[K, q]$$\n",
"\n",
"oraz ostatnią etykietę:\n",
"\n",
"$$y^K = \\underset{q \\in \\{1,\\dots,|V|\\}}{\\operatorname{argmax}} s[K, q]$$\n",
"\n",
"Aby uzyskać cały ciąg, kierujemy się *wstecz* używając wskaźników:\n",
"\n",
"$$y^i = b[i, y^{i+1}]$$\n",
"\n",
"![img](./crf-viterbi.png)\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Złożoność obliczeniowa\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Zauważmy, że rozmiar tabel $s$ i $b$ wynosi $K \\times |L|$, a koszt\n",
"wypełnienia każdej komórki to $|L|$, a zatem złożoność algorytmu jest wielomianowa:\n",
"$O(K|L|^2)$.\n",
"\n",
"**Pytanie:** Czy gdyby uzależnić etykietę nie tylko od poprzedniej\n",
"etykiety, lecz również od jeszcze wcześniejszej, to złożoność\n",
"obliczeniowa byłaby taka sama?\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Przykład\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Rozpatrzmy uproszczony przykład tagowania częściami mowy:\n",
"\n",
"- słownik $V=\\{\\mathit{Ala}, \\mathit{powieść}, \\mathit{ma}\\}$,\n",
"- zbiór etykiet $L=\\{\\mathit{C}, \\mathit{P}, \\mathit{R}\\}$,\n",
"- kontekst nie jest uwzględniany ($c = 0$).\n",
"\n",
"(To, że liczba słów i etykiet jest taka sama, jest przypadkowe, nie ma znaczenia)\n",
"\n",
"Zakładamy, że słowa reprezentujemy wektorowo za pomocą prostej reprezentacji one-hot.\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([0., 1., 0.])"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch\n",
"\n",
"vocab = ['Ala', 'ma', 'powieść']\n",
"labels = ['C', 'P', 'R']\n",
"\n",
"onehot = {\n",
" 'Ala': torch.tensor([1., 0., 0.]),\n",
" 'ma': torch.tensor([0., 1., 0.]),\n",
" 'powieść': torch.tensor([0., 0., 1.])\n",
" }\n",
"\n",
"onehot['ma']"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Przyjmijmy, że w czasie uczenia zostały ustalone następujące wartości\n",
"macierzy $W$ i $V$ (samego procesu uczenia nie pokazujemy tutaj):\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([0.4983, 0.0034, 0.4983])"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch\n",
"import torch.nn as nn\n",
"\n",
"matrixW = torch.tensor(\n",
" [[-1., 3.0, 3.0], # C\n",
" [0., 2.0, -2.0], # P\n",
" [4., -2.0, 3.0]]) # R\n",
" # Ala ma powieść\n",
"# rozkład prawdopodobieństwa, gdyby patrzeć tylko na słowo\n",
"nn.functional.softmax(matrixW @ onehot['powieść'], dim=0)"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([0.1027, 0.1386, 0.7587])"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch\n",
"import torch.nn as nn\n",
"\n",
"matrixV = torch.tensor(\n",
" [[-0.5, 1.5, 2.0], # C\n",
" [0.5, 0.8, 2.5], # P\n",
" [2.0, 0.8, 0.2]]) # R\n",
"# C P R\n",
"\n",
"# co występuje po przymiotniku? - rozkład prawdopodobieństwa\n",
"nn.functional.softmax(matrixV[1], dim=0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Algorytm Viterbiego:\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[4.0, 3.5, 4.5]"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"d = ['Ala', 'ma', 'powieść']\n",
"\n",
"s = []\n",
"b = []\n",
"\n",
"# inicjalizacja\n",
"s.append(matrixW @ onehot[d[0]])\n",
"b.append(None)\n",
"\n",
"# wprzód\n",
"i = 1\n",
"os = []\n",
"ob = []\n",
"for j in range(0, len(labels)):\n",
" z = s[i-1] + matrixV[:,j] + matrixW @ onehot[d[i]]\n",
"\n",
" ns = torch.max(z).item()\n",
" nb = torch.argmax(z).item()\n",
"\n",
" os.append(ns)\n",
" ob.append(nb)\n",
"\n",
"os"
]
}
],
"metadata": {
"author": "Filip Graliński",
"email": "filipg@amu.edu.pl",
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"lang": "pl",
"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.9.6"
},
"org": null,
"subtitle": "9.Przegląd składowych sieci neuronowych[wykład]",
"title": "Ekstrakcja informacji",
"year": "2021"
},
"nbformat": 4,
"nbformat_minor": 4
}