Conditions for passing the course, study materials
Umělé neuronové sítě se inspirují fungováním neuronových sítí živých organismů a mezi jejich schopnosti patří např. učit se na příkladech, vyrovnat se s částečným poškozením sítě, zobecňovat naučená data. Důležitými vlastnostmi jsou masívní paralelismus a absence centrálního řízení sítě. Jednotlivé neurony v sítí si vzájemně posílají signály, jejichž intenzita je modulována vahami synapsí - propojů mezi neurony. V každém neuronu je zpracován souhrn do něj přicházejících signálů a výsledek je přeposlán dále. Sítě jsou v naprosté většině aplikací simulovány na běžně dostupných GPU, speciální hardware se dnes používá v minimální míře.
Artificial neural networks are inspired by the functioning of neural networks of living organisms and their capabilities include, for example, learning from examples, coping with partial damage to the network, and generalizing learned data. Important features are massive parallelism and the absence of central network control. Individual neurons in the network send signals to each other, the intensity of which is modulated by the weights of synapses - connections between neurons. Each neuron processes the sum of the signals coming to it and the result is forwarded. In the vast majority of applications, networks are simulated on commonly available GPUs; special hardware is used to a minimal extent today.
Lineární klasifikátor je nejjednodušší model hlubokého učení (v tomto případě "mělkého" učení, protože nepoužívá hlubokou architekturu). Lineární klasifikátor implementujeme pomocí jednoduchého modelu neuronu - tzv. perceptronu, s nímž jste se seznámili v předchozí kapitole. Vyložíme základní rámec hlubokého učení, na čem je založeno, jak probíhá a jaké základní fáze a komponenty používá. Představíme tři algoritmy tréninku - lineární regresi, perceptronový učící algoritmus a logistickou regresi. Hledání minima ztrátové funkce přiblížíme z pohledu gradientního sestupu, z pohledu algebry a pomocí počtu pravděpodobnosti - aby pravděpodobnost správné klasifikace byla co nejvyšší.
Následně ukážeme klasifikaci do více kategorií. Při klasifikaci do dvou kategorií se ve výstupní vrstvě (s jedním neuronem) používá obvykle aktivační funkce sigmoida, a jako ztrátová funkce sítě se bere střední kvadratická chyba (mean_squared_error), anebo lépe binární křížová entropie (binary_crossentropy). Co ale v případě více kategorií? Ukážeme, že přirozeným zobecněním sigmoidy na více kategorií je aktivační funkce softmax, a ztrátovou funkcí poskytujíc správné výsledky s největší pravděpodobností je křížová entropie (categorical_crossentropy).
The linear classifier is the simplest model of deep learning (in this case, "shallow" learning, because it does not use a deep architecture). We implement the linear classifier using a simple neuron model - the so-called perceptron, which you learned in the previous chapter. We will explain the basic framework of deep learning, what it is based on, how it works, and what basic phases and components it uses. We will introduce three training algorithms - linear regression, perceptron learning algorithm, and logistic regression. We will approach the search for the minimum of the loss function from the perspective of gradient descent, from the perspective of algebra, and using the calculus of probability - so that the probability of correct classification is as high as possible.
Then we will show classification into multiple categories. When classifying into two categories, the sigmoid activation function is usually used in the output layer (with one neuron), and the mean square error (mean_squared_error), or better yet, binary cross-entropy (binary_crossentropy), is taken as the loss function of the network. But what about in the case of multiple categories? We will show that the natural generalization of the sigmoid to multiple categories is the softmax activation function, and the loss function providing the correct results with the highest probability is the cross-entropy (categorical_crossentropy).
Základním modelem hlubokého učení jsou vícevrstvé přímovazebné sítě složené z neuronů, které počítají lineární kombinaci vstupů a vah wx, na niž navazuje nelinearita (nejčastěji relU nebo sigmoid). Typicky využívají učení s učitelem založené na minimalizaci ztrátové funkce, nejčastěji s využitím gradientních metod. Tyto sítě mají řadu aplikací a vyskytují se jako samostatné moduly v řadě složitějších architektur.
Klasický algoritmus Backpropagation ze 70. let, který jako první umožnil učení vícevrstvého perceptronu, je stále používán a optimalizován pro zvýšení rychlosti a účinnosti učení.
The basic model of deep learning is a multilayer feedforward network composed of neurons that compute a linear combination of inputs and weights wx, followed by a nonlinearity (most often relU or sigmoid). They typically use supervised learning based on minimizing the loss function, most often using gradient methods. These networks have a number of applications and are found as separate modules in a number of more complex architectures.
The classic Backpropagation algorithm from the 1970s, which first enabled learning of a multilayer perceptron, is still used and optimized to increase the speed and efficiency of learning.
Pro zvýšení rychlosti tréninku a zejména pro zlepšení kvality výsledného naučení sítě (kdy nejčastějším problémem bývá přeučení) je nutno laborovat s nastavením sítě, tedy s hyperparametry jako např. počet, velikost a struktura vrstev, jejich aktivační funkce apod. Regularizace je pak modifikace učícího algoritmu zaměřená na snížení chyby na testovací množině, bez ohledu na tréninkovou chybu. Konečně optimalizátor je metoda úpravy vah na základě ztrátového skóre během učení. Nejjednodušším optimalizátorem je klasický algoritmus SGD, existuje však řada jeho vylepšení, které zvýšují efektivitu a přesnost učení.
Přestože existují metodiky, jak všechna tato vylepšení učení používat, není zatím možné je zcela automatizovat a zpravidla vyžadují experimentování a zkušenost toho, kdo síť nastavuje.
To increase the speed of training and especially to improve the quality of the resulting learning of the network (where the most common problem is overfitting), it is necessary to work with the network settings, i.e. with hyperparameters such as the number, size and structure of layers, their activation functions, etc. Regularization is then a modification of the learning algorithm aimed at reducing the error on the test set, regardless of the training error. Finally, optimizer is a method of adjusting weights based on the loss score during learning. The simplest optimizer is the classic SGD algorithm, but there are a number of its improvements that increase the efficiency and accuracy of learning.
Although there are methodologies for using all these learning improvements, it is not yet possible to fully automate them and usually require experimentation and experience on the part of the person setting up the network.
Zpracování obrazu je dnes jednou z nejrozšířenějších aplikací hlubokého učení a výsledky jsou často srovnatelné s lidským pozorovatelem. Obrazová data (tj. matice obrazových bodů) vyžadují poněkud odlišný způsob zpracování. Dříve se obrazy složitě předzpracovávaly a extrahovaly se z nich tzv. příznaky nezávislé na obrazových transformacích (posun, rotace, změna měřítka, osvětlení...). Příznaky pak sloužily jako vstup sítě. S nástupem hlubokého učení je možno napájet síť přímo obrazovými data. To však vyžaduje mnohavrstevné architektury se speciálními typy vrstev, zejména konvoluční vrstvy a vrstvy sdružující dle maxima (max-pooling).
Image processing is one of the most widespread applications of deep learning today, and the results are often comparable to a human observer. Image data (i.e., a matrix of pixels) requires a somewhat different approach. Previously, images were preprocessed in a complex manner and features independent of image transformations (shift, rotation, scaling, illumination, etc.) were extracted from them. The features were then used as input to the network. With the advent of deep learning, it is possible to feed the network directly with image data. However, this requires multilayer architectures with special types of layers, especially convolutional layers and max-pooling layers.
Sekvenčními daty jsou nejčastěji číselné časové řady (kurzy měn, burza apod.), texty, popřípadě sekvence obrázků (video) anebo zvuků (hudba). Tedy data, kde existuje vnitřní logika a závislost mezi jednotlivými prvky sekvence, a to mnohdy od sebe vzdálenými na textové/časové ose. Rekurentní vrstvy sítě se snaží tyto závislosti postihnout pomoc vnitřních zpětných vazeb, tzn. vstupem do vrstvy je jednak výstup předchozí vrstvy, jednak výstup této vrstvy samotné z předchozího kroku výpočtu. Graf propojení neuronů v síti tedy obsahuje cykly.
Sequential data are most often numerical time series (currency rates, stock market, etc.), texts, or sequences of images (video) or sounds (music). That is, data where there is internal logic and dependence between individual elements of the sequence, often distant from each other on the text/time axis. Recurrent layers of the network try to capture these dependencies using internal feedback, i.e. the input to the layer is both the output of the previous layer and the output of this layer itself from the previous calculation step. The graph of connections of neurons in the network therefore contains cycles.
Transformer je model hlubokého učení, který využívá mechanismus sebepozornosti (self-attention), přiřazující každé části vstupních/výstupních dat k ní relevantní kontext. Používá se především v oblastech zpracování přirozeného jazyka (NLP) a počítačového vidění (CV). Transformery se zpravidla skládají z enkodéru, který kóduje vstupní sekvenci do její vnitřní reprezentace stejné délky, a dekodéru, který z vnitřní reprezentace generuje výstup. Některé modely (např. pro generování textů) neobsahují enkodér.
A transformer is a deep learning model that uses a self-attention mechanism to assign context to each part of the input/output data. It is used primarily in the areas of natural language processing (NLP) and computer vision (CV). Transformers typically consist of an encoder that encodes the input sequence into its internal representation of the same length, and a decoder that generates output from the internal representation. Some models (e.g. for text generation) do not include an encoder.








