{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "

Artificial Neural Networks

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
(C) Nikolai Nowaczyk, Jörg Kienitz 2019-2021
" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Using TensorFlow backend.\n" ] } ], "source": [ "%matplotlib widget\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "from keras.models import Sequential\n", "from keras.layers import Dense\n", "from IPython.display import SVG" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Mathematical Definitions" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Definition (neural network):** A *neural network* $\\operatorname{NN}$ is a tuple $\\operatorname{NN}=(A_l, b_l, \\sigma_l)_{1 \\leq l \\leq N_l}$ defined by\n", "* a numer $n_i$ of *inputs*,\n", "* a number $n_o$ of *outputs*\n", "* a number $N_L$ of *layers* and\n", "* for each layer $1 \\leq l \\leq N_L$ \n", " * a number $n_l$ of *neurons* (or *units*),\n", " * a matrix $A_{l} = (A_{l;ij}) \\in \\mathbb{R}^{n_{l-1} \\times n_l}$ and a vector $b_l = b_{l;i} \\in \\mathbb{R}^{n_l}$ of *weights* such that $n_0 = n_i$, $n_{N_L}=n_o$ and\n", " * an *activation function* $\\sigma_l:\\mathbb{R} \\to \\mathbb{R}$.\n", "For any $1 \\leq l \\leq N_L$, the tuple $(A_l, b_l, \\sigma_l)$ is called a *layer*. For $l=N_L$, the layer is called *output layer* and for $1 \\leq l