├── Grid ├── LICENSE ├── README.md ├── images │ └── cc-logo.png ├── install.sh └── src │ ├── Makefile │ ├── all_imports.tex │ ├── all_new_commands.tex │ ├── definitions │ ├── colors.tex │ └── styles.tex │ ├── header.tex │ ├── images │ └── liamflogo.png │ ├── main.tex │ ├── my_references.bib │ ├── pdf │ └── GridPresentation.pdf │ └── tikzfiles │ ├── ara_ad_star.tex │ ├── astar.tex │ └── dstar.tex ├── NeuralNetworks ├── LICENSE ├── README.md ├── images │ └── cc-logo.png ├── install.sh └── src │ ├── Makefile │ ├── TikzFiles │ ├── 3x3.tex │ ├── 5x5.tex │ ├── Compgraph1.tex │ ├── Compgraph2.tex │ ├── Compgraph3.tex │ ├── Compgraph4.tex │ ├── DFNclassification.tex │ ├── DeepNN.tex │ ├── Dropout1.tex │ ├── Dropout2.tex │ ├── Entropy1.tex │ ├── Entropy2.tex │ ├── Kernel_image_pro.tex │ ├── KullbackLeibler.tex │ ├── NN.tex │ ├── OldNN1.tex │ ├── OldNN2.tex │ ├── OldNN3.tex │ ├── ReLU.tex │ ├── Sigmoid.tex │ ├── Softmax.tex │ ├── b1_path2_grad.tex │ ├── batch_example_values.tex │ ├── batch_graph.tex │ ├── chain_rule_nodes.tex │ ├── div.tex │ ├── examples_values.tex │ ├── exp.tex │ ├── expanded_graph_0.tex │ ├── fashionMNIST.tex │ ├── feature_map.tex │ ├── log.tex │ ├── minus1.tex │ ├── mult.tex │ ├── multiple_paths.tex │ ├── perceptron.tex │ └── soma.tex │ ├── all_imports.tex │ ├── all_new_commands.tex │ ├── definitions │ ├── colors.tex │ └── styles.tex │ ├── header.tex │ ├── images │ ├── Vd-Blur1.png │ ├── Vd-Edge3.png │ ├── Vd-Orig.png │ ├── Vd-Sharp.png │ └── shirt.png │ ├── main.tex │ ├── my_references.bib │ └── pdf │ └── NN.pdf ├── README.md ├── RL ├── LICENSE ├── README.md ├── images │ └── cc-logo.png ├── install.sh └── src │ ├── Makefile │ ├── all_imports.tex │ ├── all_new_commands.tex │ ├── definitions │ ├── colors.tex │ └── styles.tex │ ├── header.tex │ ├── images │ ├── agent.jpg │ ├── enduro.png │ ├── frame1.png │ ├── frame2.png │ ├── frame3.png │ ├── liamflogo.png │ └── robo.jpg │ ├── main.tex │ ├── my_references.bib │ ├── pdf │ └── RLpresentation.pdf │ └── tikzfiles │ ├── Basic_RL.tex │ ├── Enduro.tex │ ├── RL_deep.tex │ ├── RL_hand.tex │ └── Tabular_RL.tex └── RNN ├── LICENSE ├── README.md ├── gifs └── cc-logo.png ├── install.sh └── src ├── Makefile ├── TikzFiles ├── Add_op_simplified.tex ├── BackPropScalar.tex ├── BackPropVector.tex ├── Compgraph1.tex ├── Compgraph2.tex ├── Compgraph3.tex ├── Compgraph4.tex ├── Entropy1.tex ├── Entropy2.tex ├── KullbackLeibler.tex ├── LSTM_cell.tex ├── LSTM_simplified.tex ├── LSTM_unfolded.tex ├── LanguageModelExpanded.tex ├── LanguageModelSimplified.tex ├── LanguageModelUnfolded.tex ├── OldNN1.tex ├── OldNN2.tex ├── OldNN3.tex ├── RNNGraphExpanded.tex ├── RNNSimplified.tex ├── RNNSimplifiedUnfolded.tex ├── Sigmoid.tex ├── Softmax.tex ├── perceptron.tex ├── rnn-backprop-through-time.tex ├── rnn-backprop.tex └── rnn-time-unfolding.tex ├── all_imports.tex ├── all_new_commands.tex ├── definitions ├── colors.tex └── styles.tex ├── equations.tex ├── header.tex ├── main.tex ├── my_references.bib └── pdf └── RNNpresentation.pdf /Grid/LICENSE: -------------------------------------------------------------------------------- 1 | CC0 1.0 Universal 2 | 3 | Statement of Purpose 4 | 5 | The laws of most jurisdictions throughout the world automatically confer 6 | exclusive Copyright and Related Rights (defined below) upon the creator and 7 | subsequent owner(s) (each and all, an "owner") of an original work of 8 | authorship and/or a database (each, a "Work"). 9 | 10 | Certain owners wish to permanently relinquish those rights to a Work for the 11 | purpose of contributing to a commons of creative, cultural and scientific 12 | works ("Commons") that the public can reliably and without fear of later 13 | claims of infringement build upon, modify, incorporate in other works, reuse 14 | and redistribute as freely as possible in any form whatsoever and for any 15 | purposes, including without limitation commercial purposes. These owners may 16 | contribute to the Commons to promote the ideal of a free culture and the 17 | further production of creative, cultural and scientific works, or to gain 18 | reputation or greater distribution for their Work in part through the use and 19 | efforts of others. 20 | 21 | For these and/or other purposes and motivations, and without any expectation 22 | of additional consideration or compensation, the person associating CC0 with a 23 | Work (the "Affirmer"), to the extent that he or she is an owner of Copyright 24 | and Related Rights in the Work, voluntarily elects to apply CC0 to the Work 25 | and publicly distribute the Work under its terms, with knowledge of his or her 26 | Copyright and Related Rights in the Work and the meaning and intended legal 27 | effect of CC0 on those rights. 28 | 29 | 1. Copyright and Related Rights. A Work made available under CC0 may be 30 | protected by copyright and related or neighboring rights ("Copyright and 31 | Related Rights"). Copyright and Related Rights include, but are not limited 32 | to, the following: 33 | 34 | i. the right to reproduce, adapt, distribute, perform, display, communicate, 35 | and translate a Work; 36 | 37 | ii. moral rights retained by the original author(s) and/or performer(s); 38 | 39 | iii. publicity and privacy rights pertaining to a person's image or likeness 40 | depicted in a Work; 41 | 42 | iv. rights protecting against unfair competition in regards to a Work, 43 | subject to the limitations in paragraph 4(a), below; 44 | 45 | v. rights protecting the extraction, dissemination, use and reuse of data in 46 | a Work; 47 | 48 | vi. database rights (such as those arising under Directive 96/9/EC of the 49 | European Parliament and of the Council of 11 March 1996 on the legal 50 | protection of databases, and under any national implementation thereof, 51 | including any amended or successor version of such directive); and 52 | 53 | vii. other similar, equivalent or corresponding rights throughout the world 54 | based on applicable law or treaty, and any national implementations thereof. 55 | 56 | 2. Waiver. To the greatest extent permitted by, but not in contravention of, 57 | applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and 58 | unconditionally waives, abandons, and surrenders all of Affirmer's Copyright 59 | and Related Rights and associated claims and causes of action, whether now 60 | known or unknown (including existing as well as future claims and causes of 61 | action), in the Work (i) in all territories worldwide, (ii) for the maximum 62 | duration provided by applicable law or treaty (including future time 63 | extensions), (iii) in any current or future medium and for any number of 64 | copies, and (iv) for any purpose whatsoever, including without limitation 65 | commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes 66 | the Waiver for the benefit of each member of the public at large and to the 67 | detriment of Affirmer's heirs and successors, fully intending that such Waiver 68 | shall not be subject to revocation, rescission, cancellation, termination, or 69 | any other legal or equitable action to disrupt the quiet enjoyment of the Work 70 | by the public as contemplated by Affirmer's express Statement of Purpose. 71 | 72 | 3. Public License Fallback. Should any part of the Waiver for any reason be 73 | judged legally invalid or ineffective under applicable law, then the Waiver 74 | shall be preserved to the maximum extent permitted taking into account 75 | Affirmer's express Statement of Purpose. In addition, to the extent the Waiver 76 | is so judged Affirmer hereby grants to each affected person a royalty-free, 77 | non transferable, non sublicensable, non exclusive, irrevocable and 78 | unconditional license to exercise Affirmer's Copyright and Related Rights in 79 | the Work (i) in all territories worldwide, (ii) for the maximum duration 80 | provided by applicable law or treaty (including future time extensions), (iii) 81 | in any current or future medium and for any number of copies, and (iv) for any 82 | purpose whatsoever, including without limitation commercial, advertising or 83 | promotional purposes (the "License"). The License shall be deemed effective as 84 | of the date CC0 was applied by Affirmer to the Work. Should any part of the 85 | License for any reason be judged legally invalid or ineffective under 86 | applicable law, such partial invalidity or ineffectiveness shall not 87 | invalidate the remainder of the License, and in such case Affirmer hereby 88 | affirms that he or she will not (i) exercise any of his or her remaining 89 | Copyright and Related Rights in the Work or (ii) assert any associated claims 90 | and causes of action with respect to the Work, in either case contrary to 91 | Affirmer's express Statement of Purpose. 92 | 93 | 4. Limitations and Disclaimers. 94 | 95 | a. No trademark or patent rights held by Affirmer are waived, abandoned, 96 | surrendered, licensed or otherwise affected by this document. 97 | 98 | b. Affirmer offers the Work as-is and makes no representations or warranties 99 | of any kind concerning the Work, express, implied, statutory or otherwise, 100 | including without limitation warranties of title, merchantability, fitness 101 | for a particular purpose, non infringement, or the absence of latent or 102 | other defects, accuracy, or the present or absence of errors, whether or not 103 | discoverable, all to the greatest extent permissible under applicable law. 104 | 105 | c. Affirmer disclaims responsibility for clearing rights of other persons 106 | that may apply to the Work or any use thereof, including without limitation 107 | any person's Copyright and Related Rights in the Work. Further, Affirmer 108 | disclaims responsibility for obtaining any necessary consents, permissions 109 | or other rights required for any use of the Work. 110 | 111 | d. Affirmer understands and acknowledges that Creative Commons is not a 112 | party to this document and has no duty or obligation with respect to this 113 | CC0 or use of the Work. 114 | 115 | For more information, please see 116 | 117 | -------------------------------------------------------------------------------- /Grid/README.md: -------------------------------------------------------------------------------- 1 | # anytime dynamic A* presentation 2 | 3 | ![alt text](images/cc-logo.png "CC") 4 | 5 | 6 | Licensed under [creative commons](https://github.com/LIAMF-USP/TikzTemplates/blob/master/Grid/LICENSE) 7 | 8 | ## Usage 9 | 10 | You can find the pdf of the presentation in the folder /src/pdf. But if you want to compile (**for Ubuntu users**) the latex file just run: 11 | 12 | ``` 13 | $ bash install.sh 14 | $ cd src/ 15 | $ make 16 | ``` 17 | 18 | -------------------------------------------------------------------------------- /Grid/images/cc-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/Grid/images/cc-logo.png -------------------------------------------------------------------------------- /Grid/install.sh: -------------------------------------------------------------------------------- 1 | sudo apt-get install texlive-latex-base 2 | sudo apt-get install latex-beamer 3 | sudo apt-get install texlive-latex-extra 4 | sudo apt-get install texlive-fonts-extra 5 | -------------------------------------------------------------------------------- /Grid/src/Makefile: -------------------------------------------------------------------------------- 1 | BASE_NAME := main 2 | BUILD_DIR := build 3 | PDF_NAME := GridPresentation.pdf 4 | 5 | PDFLATEX_OPTIONS = -halt-on-error -aux-directory=$(BUILD_DIR) -output-directory=$(BUILD_DIR) --shell-escape 6 | LATEX := latex 7 | PDFLATEX = pdflatex $(PDFLATEX_OPTIONS) 8 | BIBTEX := bibtex 9 | 10 | pdf: $(BASE_NAME).pdf 11 | 12 | $(BASE_NAME).pdf: $(BASE_NAME).tex 13 | mkdir -p $(BUILD_DIR) 14 | $(PDFLATEX) $< 15 | $(PDFLATEX) $< 16 | $(PDFLATEX) $< 17 | $(PDFLATEX) $< 18 | cp $(BUILD_DIR)/$(BASE_NAME).pdf $(PDF_NAME) 19 | 20 | clean: 21 | rm -rf build $(PDF_NAME) 22 | -------------------------------------------------------------------------------- /Grid/src/all_imports.tex: -------------------------------------------------------------------------------- 1 | \usepackage[utf8]{inputenc} 2 | \usepackage[T1]{fontenc} 3 | \usepackage{lmodern} 4 | \usepackage{appendixnumberbeamer} 5 | \usepackage{hyperref} 6 | \usepackage{booktabs} 7 | \usepackage{bm} 8 | \usepackage[scale=2]{ccicons} 9 | \usepackage[outputdir=build]{minted} 10 | \usepackage{pgfplots} 11 | \usepackage{array,colortbl,xcolor} 12 | \usepgfplotslibrary{dateplot} 13 | \usepackage{setspace} 14 | \usepackage{etoolbox} 15 | \usepackage{xspace} 16 | \usepackage{tikz} 17 | \usetikzlibrary{shapes,arrows,positioning,fit,backgrounds} 18 | \usepackage{tkz-euclide} 19 | \usepackage{soul} 20 | \usepackage{ragged2e} 21 | \usepackage{caption} 22 | \usepackage{amsmath} 23 | -------------------------------------------------------------------------------- /Grid/src/all_new_commands.tex: -------------------------------------------------------------------------------- 1 | \newcommand{\themename}{\textbf{\textsc{metropolis}}\xspace} 2 | \newcommand{\vect}[1]{\bm{#1}} 3 | \newcommand{\myprime}[1]{{#1}^{\prime}} 4 | \newcommand{\grad}[2]{\nabla_{#1} {#2}} 5 | \newcommand{\dotp}[2]{{#1}^{\top}{#2}} 6 | \newcommand{\dotpPright}[2]{{#1}^{\top}\left({#2}\right)} 7 | \newcommand{\outerp}[2]{\left({#1}\right){#2}^{\top}} 8 | \newcommand{\Jacobian}[2]{\frac{\partial #1}{\partial #2}} 9 | \newcommand{\Vocab}{\mathbb{V}} 10 | \DeclareMathOperator*{\argmin}{arg\,min} 11 | 12 | % Quote with author reference at the end 13 | \let\oldquote\quote 14 | \let\endoldquote\endquote 15 | \renewenvironment{quote}[2][] 16 | {\if\relax\detokenize{#1}\relax 17 | \def\quoteauthor{#2}% 18 | \else 19 | \def\quoteauthor{#2~---~#1}% 20 | \fi 21 | \oldquote} 22 | {\par\nobreak\smallskip\hfill(\quoteauthor)% 23 | \endoldquote\addvspace{\bigskipamount}} 24 | 25 | -------------------------------------------------------------------------------- /Grid/src/definitions/colors.tex: -------------------------------------------------------------------------------- 1 | \definecolor{blue}{RGB}{159, 192, 176} 2 | \definecolor{green}{RGB}{160, 227, 127} 3 | \definecolor{orange}{RGB}{243, 188, 125} 4 | \definecolor{red}{RGB}{253, 123, 84} 5 | \definecolor{nephritis}{RGB}{39, 174, 96} 6 | \definecolor{emerald}{RGB}{46, 204, 113} 7 | \definecolor{turquoise}{RGB}{39, 174, 96} 8 | \definecolor{green-sea}{RGB}{22, 160, 133} -------------------------------------------------------------------------------- /Grid/src/definitions/styles.tex: -------------------------------------------------------------------------------- 1 | % Tikzstyles for Computation Graphs 2 | 3 | % nodes 4 | \tikzstyle{noop} = [circle, draw=none, fill=red, minimum size = 10pt] 5 | \tikzstyle{op} = [circle, draw=red, line width=1.5pt, fill=red!70, text=black, text centered, font=\bf \normalsize, minimum size = 25pt] 6 | \tikzstyle{state} = [circle, draw=blue, line width=1.5pt, fill=blue!70, text=black, text centered, font=\bf \normalsize, minimum size = 25pt] 7 | % \tikzstyle{gradient} = [circle, draw=green, line width=1.5pt, fill=green!60, text=black, text centered, font=\bf \normalsize, minimum size = 25pt] 8 | \tikzstyle{gradient} = [circle, draw=nephritis, line width=1.5pt, fill=nephritis!60, text=black, text centered, font=\bf \normalsize, minimum size = 25pt] 9 | \tikzstyle{textonly} = [draw=none, fill=none, text centered, font=\bf \normalsize] 10 | \tikzstyle{boxtextonly} = [draw=none, fill=none, align=center, font=\bf \normalsize] 11 | 12 | % edges 13 | % \tikzstyle{tedge} = [draw, thick, >=stealth, ->] 14 | \tikzstyle{tedge} = [draw, thick, >=latex, ->] 15 | 16 | % namedscope 17 | \tikzstyle{namedscope} = [circle, draw=orange, line width=1.5pt, fill=orange!60, align=center, inner sep=0pt] 18 | 19 | % \tikzstyle{container} = [draw=none, rectangle, dotted, inner ysep=1.5em] 20 | % \tikzstyle{novertex} = [draw=none, fill=none, text centered] 21 | % \tikzstyle{predicate} = [ellipse, draw, thick, text centered, rounded corners, minimum size=30pt] 22 | % \tikzstyle{aux} = [rectangle, draw, thick, text centered, rounded corners, minimum size=30pt] 23 | % \tikzstyle{ledge} = [draw, dashed, thick, >=stealth, ->] 24 | % \tikzstyle{pedge} = [draw, thick, >=stealth, ->] 25 | 26 | -------------------------------------------------------------------------------- /Grid/src/header.tex: -------------------------------------------------------------------------------- 1 | \title{Anytime Dynamic A*: \\ 2 | \Large An Anytime Replanning Algorithm} 3 | \date{\today} 4 | \author{Autores: Maxim Likhachev, Dave Ferguson, Geoff Gordon, Anthony Stentz e Sebastian Thrun\\ 5 | \\Paula Moraes} 6 | \institute{\textbf{IME-USP}: Instituto de Matemática e Estatística - Universidade de São Paulo} 7 | 8 | \titlegraphic{ 9 | \hspace{9cm} 10 | \includegraphics[scale=0.2]{images/liamflogo.png} 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Grid/src/images/liamflogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/Grid/src/images/liamflogo.png -------------------------------------------------------------------------------- /Grid/src/main.tex: -------------------------------------------------------------------------------- 1 | \documentclass[10pt]{beamer} 2 | \usetheme{metropolis} 3 | % all imports 4 | \input{all_imports} 5 | \title{Apresentação_Anytime Dynamic A*} 6 | 7 | \AtBeginEnvironment{quote}{\singlespacing} 8 | 9 | % new commands 10 | \input{all_new_commands} 11 | 12 | \input{header} 13 | 14 | \begin{document} 15 | 16 | \maketitle 17 | 18 | \begin{frame}{Astar} 19 | \input{tikzfiles/astar} 20 | \end{frame} 21 | 22 | 23 | \begin{frame}{D* Lite} 24 | \input{tikzfiles/dstar} 25 | \end{frame} 26 | 27 | 28 | \begin{frame}{ARA* / AD* \hfill $\epsilon= 2.5,\: 1.5, \:1.0$} 29 | \input{tikzfiles/ara_ad_star} 30 | \end{frame} 31 | 32 | 33 | 34 | \end{document} -------------------------------------------------------------------------------- /Grid/src/my_references.bib: -------------------------------------------------------------------------------- 1 | % web 2 | 3 | @misc{alphago, 4 | title = {{Deepmind} AlphaGo Zero}, 5 | howpublished = {\url{https://deepmind.com/blog/alphago-zero-learning-scratch/}} 6 | } 7 | 8 | % main article 9 | 10 | @inproceedings{likhachev2005anytime, 11 | title={Anytime Dynamic A*: An Anytime, Replanning Algorithm.}, 12 | author={Likhachev, Maxim and Ferguson, David I and Gordon, Geoffrey J and Stentz, Anthony and Thrun, Sebastian}, 13 | booktitle={ICAPS}, 14 | pages={262--271}, 15 | year={2005} 16 | } -------------------------------------------------------------------------------- /Grid/src/pdf/GridPresentation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/Grid/src/pdf/GridPresentation.pdf -------------------------------------------------------------------------------- /Grid/src/tikzfiles/astar.tex: -------------------------------------------------------------------------------- 1 | $\epsilon\!=\!1.0$ 2 | \begin{tikzpicture}[every node/.style={minimum size=.5cm-\pgflinewidth, outer sep=0pt}] 3 | \draw[step=0.5cm,color=black] (-2,-2.5) grid (1,1); 4 | % First row left to right 5 | \node[fill=gray!50] at (-1.75,+0.75) {G}; 6 | \node[fill=gray!50] at (-1.25,+0.75) {}; 7 | \node[fill=gray!50] at (-0.75,+0.75) {}; 8 | \node[fill=gray!50] at (-0.25,+0.75) {}; 9 | \node[fill=gray!50] at (+0.25,+0.75) {}; 10 | \node at (+0.75,+0.75) {}; 11 | 12 | % Second row left to right 13 | \node[fill=gray!50] at (-1.75,+0.25) {}; 14 | \node[fill=black] at (-1.25,+0.25) {}; 15 | \node[fill=black] at (-0.75,+0.25) {}; 16 | \node[fill=black] at (-0.25,+0.25) {}; 17 | \node[fill=black] at (+0.25,+0.25) {}; 18 | \node[fill=gray!50] at (+0.75,+0.25) {}; 19 | 20 | % Third row left to right 21 | \node[fill=gray!50] at (-1.75,-0.25) {}; 22 | \node[fill=black] at (-1.25,-0.25) {}; 23 | \node at (-0.75,-0.25) {}; 24 | \node at (-0.25,-0.25) {}; 25 | \node[fill=gray!50] at (+0.25,-0.25) {}; 26 | \node[fill=gray!50] at (+0.75,-0.25) {}; 27 | 28 | % Fourth row left to right 29 | \node[fill=gray!50] at (-1.75,-0.75) {}; 30 | \node[fill=black] at (-1.25,-0.75) {}; 31 | \node at (-0.75,-0.75) {}; 32 | \node[fill=gray!50] at (-0.25,-0.75) {}; 33 | \node[fill=gray!50] at (+0.25,-0.75) {}; 34 | \node[fill=gray!50] at (+0.75,-0.75) {}; 35 | 36 | % Fifth row left to right 37 | \node[fill=gray!50] at (-1.75,-1.25) {}; 38 | \node[fill=black] at (-1.25,-1.25) {}; 39 | \node[fill=black] at (-0.75,-1.25) {}; 40 | \node[fill=gray!50] at (-0.25,-1.25) {}; 41 | \node[fill=black] at (+0.25,-1.25) {}; 42 | \node[fill=gray!50] at (+0.75,-1.25) {}; 43 | 44 | % Sixth row left to right 45 | \node[fill=gray!50] at (-1.75,-1.75) {}; 46 | \node[fill=gray!50] at (-1.25,-1.75) {}; 47 | \node[fill=gray!50] at (-0.75,-1.75) {}; 48 | \node[fill=gray!50] at (-0.25,-1.75) {}; 49 | \node[fill=black] at (+0.25,-1.75) {}; 50 | \node[fill=gray!50] at (+0.75,-1.75) {}; 51 | 52 | % Seventh row left to right 53 | \node[fill=black] at (-1.75,-2.25) {}; 54 | \node[fill=black] at (-1.25,-2.25) {}; 55 | \node[fill=black] at (-0.75,-2.25) {}; 56 | \node[fill=black] at (-0.25,-2.25) {}; 57 | \node[fill=black] at (+0.25,-2.25) {}; 58 | \node at (+0.75,-2.25) {S}; 59 | 60 | % Draw path in blue 61 | \draw[ultra thick, red] (-1.75,+0.75) -- (+0.25,+0.75); 62 | \draw[ultra thick, red] (+0.25,+0.75) -- (+0.75,+0.25); 63 | \draw[ultra thick, red] (+0.75,+0.25) -- (+0.75,-2.25); 64 | \end{tikzpicture} 65 | \hspace{0.1cm} 66 | \begin{tikzpicture}[every node/.style={minimum size=.5cm-\pgflinewidth, outer sep=0pt}] 67 | \draw[step=0.5cm,color=black] (-2,-2.5) grid (1,1); 68 | % First row left to right 69 | \node at (-1.75,+0.75) {G}; 70 | \node at (-1.25,+0.75) {}; 71 | \node at (-0.75,+0.75) {}; 72 | \node at (-0.25,+0.75) {}; 73 | \node at (+0.25,+0.75) {}; 74 | \node at (+0.75,+0.75) {}; 75 | 76 | % Second row left to right 77 | \node at (-1.75,+0.25) {}; 78 | \node[fill=black] at (-1.25,+0.25) {}; 79 | \node[fill=black] at (-0.75,+0.25) {}; 80 | \node[fill=black] at (-0.25,+0.25) {}; 81 | \node[fill=black] at (+0.25,+0.25) {}; 82 | \node at (+0.75,+0.25) {}; 83 | 84 | % Third row left to right 85 | \node at (-1.75,-0.25) {}; 86 | \node[fill=black] at (-1.25,-0.25) {}; 87 | \node at (-0.75,-0.25) {}; 88 | \node at (-0.25,-0.25) {}; 89 | \node at (+0.25,-0.25) {}; 90 | \node at (+0.75,-0.25) {}; 91 | 92 | % Fourth row left to right 93 | \node at (-1.75,-0.75) {}; 94 | \node[fill=black] at (-1.25,-0.75) {}; 95 | \node at (-0.75,-0.75) {}; 96 | \node at (-0.25,-0.75) {}; 97 | \node at (+0.25,-0.75) {}; 98 | \node at (+0.75,-0.75) {}; 99 | 100 | % Fifth row left to right 101 | \node at (-1.75,-1.25) {}; 102 | \node[fill=black] at (-1.25,-1.25) {}; 103 | \node[fill=black] at (-0.75,-1.25) {}; 104 | \node at (-0.25,-1.25) {}; 105 | \node[fill=black] at (+0.25,-1.25) {}; 106 | \node at (+0.75,-1.25) {}; 107 | 108 | % Sixth row left to right 109 | \node at (-1.75,-1.75) {}; 110 | \node at (-1.25,-1.75) {}; 111 | \node at (-0.75,-1.75) {}; 112 | \node at (-0.25,-1.75) {}; 113 | \node[fill=black] at (+0.25,-1.75) {}; 114 | \node at (+0.75,-1.75) {S}; 115 | 116 | % Seventh row left to right 117 | \node[fill=black] at (-1.75,-2.25) {}; 118 | \node[fill=black] at (-1.25,-2.25) {}; 119 | \node[fill=black] at (-0.75,-2.25) {}; 120 | \node[fill=black] at (-0.25,-2.25) {}; 121 | \node[fill=black] at (+0.25,-2.25) {}; 122 | \node at (+0.75,-2.25) {}; 123 | 124 | % Draw path in blue 125 | \draw[ultra thick, red] (-1.75,+0.75) -- (+0.25,+0.75); 126 | \draw[ultra thick, red] (+0.25,+0.75) -- (+0.75,+0.25); 127 | \draw[ultra thick, red] (+0.75,+0.25) -- (+0.75,-1.75); 128 | \end{tikzpicture} 129 | \hspace{0.1cm} 130 | \begin{tikzpicture}[every node/.style={minimum size=.5cm-\pgflinewidth, outer sep=0pt}] 131 | \draw[step=0.5cm,color=black] (-2,-2.5) grid (1,1); 132 | % First row left to right 133 | \node[fill=gray!50] at (-1.75,+0.75) {G}; 134 | \node[fill=gray!50] at (-1.25,+0.75) {}; 135 | \node[fill=gray!50] at (-0.75,+0.75) {}; 136 | \node at (-0.25,+0.75) {}; 137 | \node at (+0.25,+0.75) {}; 138 | \node at (+0.75,+0.75) {}; 139 | 140 | % Second row left to right 141 | \node[fill=gray!50] at (-1.75,+0.25) {}; 142 | \node[fill=black] at (-1.25,+0.25) {}; 143 | \node[fill=black] at (-0.75,+0.25) {}; 144 | \node[fill=gray!50] at (-0.25,+0.25) {}; 145 | \node[fill=black] at (+0.25,+0.25) {}; 146 | \node at (+0.75,+0.25) {}; 147 | 148 | % Third row left to right 149 | \node at (-1.75,-0.25) {}; 150 | \node[fill=black] at (-1.25,-0.25) {}; 151 | \node at (-0.75,-0.25) {}; 152 | \node[fill=gray!50] at (-0.25,-0.25) {}; 153 | \node[fill=gray!50] at (+0.25,-0.25) {}; 154 | \node at (+0.75,-0.25) {}; 155 | 156 | % Fourth row left to right 157 | \node at (-1.75,-0.75) {}; 158 | \node[fill=black] at (-1.25,-0.75) {}; 159 | \node at (-0.75,-0.75) {}; 160 | \node at (-0.25,-0.75) {}; 161 | \node[fill=gray!50] at (+0.25,-0.75) {}; 162 | \node[fill=gray!50] at (+0.75,-0.75) {}; 163 | 164 | % Fifth row left to right 165 | \node at (-1.75,-1.25) {}; 166 | \node[fill=black] at (-1.25,-1.25) {}; 167 | \node[fill=black] at (-0.75,-1.25) {}; 168 | \node at (-0.25,-1.25) {}; 169 | \node[fill=black] at (+0.25,-1.25) {}; 170 | \node at (+0.75,-1.25) {S}; 171 | 172 | % Sixth row left to right 173 | \node at (-1.75,-1.75) {}; 174 | \node at (-1.25,-1.75) {}; 175 | \node at (-0.75,-1.75) {}; 176 | \node at (-0.25,-1.75) {}; 177 | \node[fill=black] at (+0.25,-1.75) {}; 178 | \node at (+0.75,-1.75) {}; 179 | 180 | % Seventh row left to right 181 | \node[fill=black] at (-1.75,-2.25) {}; 182 | \node[fill=black] at (-1.25,-2.25) {}; 183 | \node[fill=black] at (-0.75,-2.25) {}; 184 | \node[fill=black] at (-0.25,-2.25) {}; 185 | \node[fill=black] at (+0.25,-2.25) {}; 186 | \node at (+0.75,-2.25) {}; 187 | 188 | % Draw path in blue 189 | \draw[ultra thick, red] (-1.75,+0.75) -- (-0.75,+0.75); 190 | \draw[ultra thick, red] (-0.75,+0.75) -- (+0.75,-0.75); 191 | \draw[ultra thick, red] (+0.75,-0.75) -- (+0.75,-1.25); 192 | \end{tikzpicture} 193 | 194 | \vspace*{20px} 195 | $\epsilon\!=\!2.5$ 196 | \begin{tikzpicture}[every node/.style={minimum size=.5cm-\pgflinewidth, outer sep=0pt}] 197 | \draw[step=0.5cm,color=black] (-2,-2.5) grid (1,1); 198 | % First row left to right 199 | \node[fill=gray!50] at (-1.75,+0.75) {G}; 200 | \node[fill=gray!50] at (-1.25,+0.75) {}; 201 | \node at (-0.75,+0.75) {}; 202 | \node at (-0.25,+0.75) {}; 203 | \node at (+0.25,+0.75) {}; 204 | \node at (+0.75,+0.75) {}; 205 | 206 | % Second row left to right 207 | \node[fill=gray!50] at (-1.75,+0.25) {}; 208 | \node[fill=black] at (-1.25,+0.25) {}; 209 | \node[fill=black] at (-0.75,+0.25) {}; 210 | \node[fill=black] at (-0.25,+0.25) {}; 211 | \node[fill=black] at (+0.25,+0.25) {}; 212 | \node at (+0.75,+0.25) {}; 213 | 214 | % Third row left to right 215 | \node[fill=gray!50] at (-1.75,-0.25) {}; 216 | \node[fill=black] at (-1.25,-0.25) {}; 217 | \node at (-0.75,-0.25) {}; 218 | \node at (-0.25,-0.25) {}; 219 | \node at (+0.25,-0.25) {}; 220 | \node at (+0.75,-0.25) {}; 221 | 222 | % Fourth row left to right 223 | \node[fill=gray!50] at (-1.75,-0.75) {}; 224 | \node[fill=black] at (-1.25,-0.75) {}; 225 | \node at (-0.75,-0.75) {}; 226 | \node at (-0.25,-0.75) {}; 227 | \node[fill=gray!50] at (+0.25,-0.75) {}; 228 | \node at (+0.75,-0.75) {}; 229 | 230 | % Fifth row left to right 231 | \node[fill=gray!50] at (-1.75,-1.25) {}; 232 | \node[fill=black] at (-1.25,-1.25) {}; 233 | \node[fill=black] at (-0.75,-1.25) {}; 234 | \node[fill=gray!50] at (-0.25,-1.25) {}; 235 | \node[fill=black] at (+0.25,-1.25) {}; 236 | \node[fill=gray!50] at (+0.75,-1.25) {}; 237 | 238 | % Sixth row left to right 239 | \node at (-1.75,-1.75) {}; 240 | \node[fill=gray!50] at (-1.25,-1.75) {}; 241 | \node[fill=gray!50] at (-0.75,-1.75) {}; 242 | \node[fill=gray!50] at (-0.25,-1.75) {}; 243 | \node[fill=black] at (+0.25,-1.75) {}; 244 | \node[fill=gray!50] at (+0.75,-1.75) {}; 245 | 246 | % Seventh row left to right 247 | \node[fill=black] at (-1.75,-2.25) {}; 248 | \node[fill=black] at (-1.25,-2.25) {}; 249 | \node[fill=black] at (-0.75,-2.25) {}; 250 | \node[fill=black] at (-0.25,-2.25) {}; 251 | \node[fill=black] at (+0.25,-2.25) {}; 252 | \node at (+0.75,-2.25) {S}; 253 | 254 | % Draw path in red 255 | \draw[ultra thick, red] (-1.75,+0.75) -- (-1.75,-1.25); 256 | \draw[ultra thick, red] (-1.75,-1.25) -- (-1.25,-1.75); 257 | \draw[ultra thick, red] (-1.25,-1.75) -- (-0.75,-1.75); 258 | \draw[ultra thick, red] (-0.75,-1.75) -- (+0.25,-0.75); 259 | \draw[ultra thick, red] (+0.25,-0.75) -- (+0.75,-1.25); 260 | \draw[ultra thick, red] (+0.75,-1.25) -- (+0.75,-2.25); 261 | \end{tikzpicture} 262 | \hspace{0.1cm} 263 | \begin{tikzpicture}[every node/.style={minimum size=.5cm-\pgflinewidth, outer sep=0pt}] 264 | \draw[step=0.5cm,color=black] (-2,-2.5) grid (1,1); 265 | % First row left to right 266 | \node at (-1.75,+0.75) {G}; 267 | \node at (-1.25,+0.75) {}; 268 | \node at (-0.75,+0.75) {}; 269 | \node at (-0.25,+0.75) {}; 270 | \node at (+0.25,+0.75) {}; 271 | \node at (+0.75,+0.75) {}; 272 | 273 | % Second row left to right 274 | \node at (-1.75,+0.25) {}; 275 | \node[fill=black] at (-1.25,+0.25) {}; 276 | \node[fill=black] at (-0.75,+0.25) {}; 277 | \node[fill=black] at (-0.25,+0.25) {}; 278 | \node[fill=black] at (+0.25,+0.25) {}; 279 | \node at (+0.75,+0.25) {}; 280 | 281 | % Third row left to right 282 | \node at (-1.75,-0.25) {}; 283 | \node[fill=black] at (-1.25,-0.25) {}; 284 | \node at (-0.75,-0.25) {}; 285 | \node at (-0.25,-0.25) {}; 286 | \node at (+0.25,-0.25) {}; 287 | \node at (+0.75,-0.25) {}; 288 | 289 | % Fourth row left to right 290 | \node at (-1.75,-0.75) {}; 291 | \node[fill=black] at (-1.25,-0.75) {}; 292 | \node at (-0.75,-0.75) {}; 293 | \node at (-0.25,-0.75) {}; 294 | \node at (+0.25,-0.75) {}; 295 | \node at (+0.75,-0.75) {}; 296 | 297 | % Fifth row left to right 298 | \node at (-1.75,-1.25) {}; 299 | \node[fill=black] at (-1.25,-1.25) {}; 300 | \node[fill=black] at (-0.75,-1.25) {}; 301 | \node at (-0.25,-1.25) {}; 302 | \node[fill=black] at (+0.25,-1.25) {}; 303 | \node at (+0.75,-1.25) {}; 304 | 305 | % Sixth row left to right 306 | \node at (-1.75,-1.75) {}; 307 | \node at (-1.25,-1.75) {}; 308 | \node at (-0.75,-1.75) {}; 309 | \node at (-0.25,-1.75) {}; 310 | \node[fill=black] at (+0.25,-1.75) {}; 311 | \node at (+0.75,-1.75) {S}; 312 | 313 | % Seventh row left to right 314 | \node[fill=black] at (-1.75,-2.25) {}; 315 | \node[fill=black] at (-1.25,-2.25) {}; 316 | \node[fill=black] at (-0.75,-2.25) {}; 317 | \node[fill=black] at (-0.25,-2.25) {}; 318 | \node[fill=black] at (+0.25,-2.25) {}; 319 | \node at (+0.75,-2.25) {}; 320 | 321 | % Draw path in red 322 | \draw[ultra thick, red] (-1.75,+0.75) -- (-1.75,-1.25); 323 | \draw[ultra thick, red] (-1.75,-1.25) -- (-1.25,-1.75); 324 | \draw[ultra thick, red] (-1.25,-1.75) -- (-0.75,-1.75); 325 | \draw[ultra thick, red] (-0.75,-1.75) -- (+0.25,-0.75); 326 | \draw[ultra thick, red] (+0.25,-0.75) -- (+0.75,-1.25); 327 | \draw[ultra thick, red] (+0.75,-1.25) -- (+0.75,-1.75); 328 | \end{tikzpicture} 329 | \hspace{0.1cm} 330 | \begin{tikzpicture}[every node/.style={minimum size=.5cm-\pgflinewidth, outer sep=0pt}] 331 | \draw[step=0.5cm,color=black] (-2,-2.5) grid (1,1); 332 | % First row left to right 333 | \node[fill=gray!50] at (-1.75,+0.75) {G}; 334 | \node[fill=gray!50] at (-1.25,+0.75) {}; 335 | \node[fill=gray!50] at (-0.75,+0.75) {}; 336 | \node at (-0.25,+0.75) {}; 337 | \node at (+0.25,+0.75) {}; 338 | \node at (+0.75,+0.75) {}; 339 | 340 | % Second row left to right 341 | \node at (-1.75,+0.25) {}; 342 | \node[fill=black] at (-1.25,+0.25) {}; 343 | \node[fill=black] at (-0.75,+0.25) {}; 344 | \node[fill=gray!50] at (-0.25,+0.25) {}; 345 | \node[fill=black] at (+0.25,+0.25) {}; 346 | \node at (+0.75,+0.25) {}; 347 | 348 | % Third row left to right 349 | \node at (-1.75,-0.25) {}; 350 | \node[fill=black] at (-1.25,-0.25) {}; 351 | \node at (-0.75,-0.25) {}; 352 | \node at (-0.25,-0.25) {}; 353 | \node[fill=gray!50] at (+0.25,-0.25) {}; 354 | \node at (+0.75,-0.25) {}; 355 | 356 | % Fourth row left to right 357 | \node at (-1.75,-0.75) {}; 358 | \node[fill=black] at (-1.25,-0.75) {}; 359 | \node at (-0.75,-0.75) {}; 360 | \node at (-0.25,-0.75) {}; 361 | \node at (+0.25,-0.75) {}; 362 | \node[fill=gray!50] at (+0.75,-0.75) {}; 363 | 364 | % Fifth row left to right 365 | \node at (-1.75,-1.25) {}; 366 | \node[fill=black] at (-1.25,-1.25) {}; 367 | \node[fill=black] at (-0.75,-1.25) {}; 368 | \node at (-0.25,-1.25) {}; 369 | \node[fill=black] at (+0.25,-1.25) {}; 370 | \node at (+0.75,-1.25) {S}; 371 | 372 | % Sixth row left to right 373 | \node at (-1.75,-1.75) {}; 374 | \node at (-1.25,-1.75) {}; 375 | \node at (-0.75,-1.75) {}; 376 | \node at (-0.25,-1.75) {}; 377 | \node[fill=black] at (+0.25,-1.75) {}; 378 | \node at (+0.75,-1.75) {}; 379 | 380 | % Seventh row left to right 381 | \node[fill=black] at (-1.75,-2.25) {}; 382 | \node[fill=black] at (-1.25,-2.25) {}; 383 | \node[fill=black] at (-0.75,-2.25) {}; 384 | \node[fill=black] at (-0.25,-2.25) {}; 385 | \node[fill=black] at (+0.25,-2.25) {}; 386 | \node at (+0.75,-2.25) {}; 387 | 388 | % Draw path in red 389 | \draw[ultra thick, red] (-1.75,+0.75) -- (-0.75,+0.75); 390 | \draw[ultra thick, red] (-0.75,+0.75) -- (+0.75,-0.75); 391 | \draw[ultra thick, red] (+0.75,-0.75) -- (+0.75,-1.25); 392 | \end{tikzpicture} -------------------------------------------------------------------------------- /Grid/src/tikzfiles/dstar.tex: -------------------------------------------------------------------------------- 1 | $\epsilon\!=\!1.0$ 2 | \begin{tikzpicture}[every node/.style={minimum size=.5cm-\pgflinewidth, outer sep=0pt}] 3 | \draw[step=0.5cm,color=black] (-2,-2.5) grid (1,1); 4 | % First row left to right 5 | \node[fill=gray!50] at (-1.75,+0.75) {G}; 6 | \node[fill=gray!50] at (-1.25,+0.75) {}; 7 | \node[fill=gray!50] at (-0.75,+0.75) {}; 8 | \node[fill=gray!50] at (-0.25,+0.75) {}; 9 | \node[fill=gray!50] at (+0.25,+0.75) {}; 10 | \node at (+0.75,+0.75) {}; 11 | 12 | % Second row left to right 13 | \node[fill=gray!50] at (-1.75,+0.25) {}; 14 | \node[fill=black] at (-1.25,+0.25) {}; 15 | \node[fill=black] at (-0.75,+0.25) {}; 16 | \node[fill=black] at (-0.25,+0.25) {}; 17 | \node[fill=black] at (+0.25,+0.25) {}; 18 | \node[fill=gray!50] at (+0.75,+0.25) {}; 19 | 20 | % Third row left to right 21 | \node[fill=gray!50] at (-1.75,-0.25) {}; 22 | \node[fill=black] at (-1.25,-0.25) {}; 23 | \node at (-0.75,-0.25) {}; 24 | \node at (-0.25,-0.25) {}; 25 | \node[fill=gray!50] at (+0.25,-0.25) {}; 26 | \node[fill=gray!50] at (+0.75,-0.25) {}; 27 | 28 | % Fourth row left to right 29 | \node[fill=gray!50] at (-1.75,-0.75) {}; 30 | \node[fill=black] at (-1.25,-0.75) {}; 31 | \node at (-0.75,-0.75) {}; 32 | \node[fill=gray!50] at (-0.25,-0.75) {}; 33 | \node[fill=gray!50] at (+0.25,-0.75) {}; 34 | \node[fill=gray!50] at (+0.75,-0.75) {}; 35 | 36 | % Fifth row left to right 37 | \node[fill=gray!50] at (-1.75,-1.25) {}; 38 | \node[fill=black] at (-1.25,-1.25) {}; 39 | \node[fill=black] at (-0.75,-1.25) {}; 40 | \node[fill=gray!50] at (-0.25,-1.25) {}; 41 | \node[fill=black] at (+0.25,-1.25) {}; 42 | \node[fill=gray!50] at (+0.75,-1.25) {}; 43 | 44 | % Sixth row left to right 45 | \node[fill=gray!50] at (-1.75,-1.75) {}; 46 | \node[fill=gray!50] at (-1.25,-1.75) {}; 47 | \node[fill=gray!50] at (-0.75,-1.75) {}; 48 | \node[fill=gray!50] at (-0.25,-1.75) {}; 49 | \node[fill=black] at (+0.25,-1.75) {}; 50 | \node[fill=gray!50] at (+0.75,-1.75) {}; 51 | 52 | % Seventh row left to right 53 | \node[fill=black] at (-1.75,-2.25) {}; 54 | \node[fill=black] at (-1.25,-2.25) {}; 55 | \node[fill=black] at (-0.75,-2.25) {}; 56 | \node[fill=black] at (-0.25,-2.25) {}; 57 | \node[fill=black] at (+0.25,-2.25) {}; 58 | \node at (+0.75,-2.25) {S}; 59 | 60 | % Draw path in red 61 | \draw[ultra thick, red] (-1.75,+0.75) -- (+0.25,+0.75); 62 | \draw[ultra thick, red] (+0.25,+0.75) -- (+0.75,+0.25); 63 | \draw[ultra thick, red] (+0.75,+0.25) -- (+0.75,-2.25); 64 | \end{tikzpicture} 65 | \hspace{0.1cm} 66 | \begin{tikzpicture}[every node/.style={minimum size=.5cm-\pgflinewidth, outer sep=0pt}] 67 | \draw[step=0.5cm,color=black] (-2,-2.5) grid (1,1); 68 | % First row left to right 69 | \node at (-1.75,+0.75) {G}; 70 | \node at (-1.25,+0.75) {}; 71 | \node at (-0.75,+0.75) {}; 72 | \node at (-0.25,+0.75) {}; 73 | \node at (+0.25,+0.75) {}; 74 | \node at (+0.75,+0.75) {}; 75 | 76 | % Second row left to right 77 | \node at (-1.75,+0.25) {}; 78 | \node[fill=black] at (-1.25,+0.25) {}; 79 | \node[fill=black] at (-0.75,+0.25) {}; 80 | \node[fill=black] at (-0.25,+0.25) {}; 81 | \node[fill=black] at (+0.25,+0.25) {}; 82 | \node at (+0.75,+0.25) {}; 83 | 84 | % Third row left to right 85 | \node at (-1.75,-0.25) {}; 86 | \node[fill=black] at (-1.25,-0.25) {}; 87 | \node at (-0.75,-0.25) {}; 88 | \node at (-0.25,-0.25) {}; 89 | \node at (+0.25,-0.25) {}; 90 | \node at (+0.75,-0.25) {}; 91 | 92 | % Fourth row left to right 93 | \node at (-1.75,-0.75) {}; 94 | \node[fill=black] at (-1.25,-0.75) {}; 95 | \node at (-0.75,-0.75) {}; 96 | \node at (-0.25,-0.75) {}; 97 | \node at (+0.25,-0.75) {}; 98 | \node at (+0.75,-0.75) {}; 99 | 100 | % Fifth row left to right 101 | \node at (-1.75,-1.25) {}; 102 | \node[fill=black] at (-1.25,-1.25) {}; 103 | \node[fill=black] at (-0.75,-1.25) {}; 104 | \node at (-0.25,-1.25) {}; 105 | \node[fill=black] at (+0.25,-1.25) {}; 106 | \node at (+0.75,-1.25) {}; 107 | 108 | % Sixth row left to right 109 | \node at (-1.75,-1.75) {}; 110 | \node at (-1.25,-1.75) {}; 111 | \node at (-0.75,-1.75) {}; 112 | \node at (-0.25,-1.75) {}; 113 | \node[fill=black] at (+0.25,-1.75) {}; 114 | \node at (+0.75,-1.75) {S}; 115 | 116 | % Seventh row left to right 117 | \node[fill=black] at (-1.75,-2.25) {}; 118 | \node[fill=black] at (-1.25,-2.25) {}; 119 | \node[fill=black] at (-0.75,-2.25) {}; 120 | \node[fill=black] at (-0.25,-2.25) {}; 121 | \node[fill=black] at (+0.25,-2.25) {}; 122 | \node at (+0.75,-2.25) {}; 123 | 124 | % Draw path in blue 125 | \draw[ultra thick, red] (-1.75,+0.75) -- (+0.25,+0.75); 126 | \draw[ultra thick, red] (+0.25,+0.75) -- (+0.75,+0.25); 127 | \draw[ultra thick, red] (+0.75,+0.25) -- (+0.75,-1.75); 128 | \end{tikzpicture} 129 | \hspace{0.1cm} 130 | \begin{tikzpicture}[every node/.style={minimum size=.5cm-\pgflinewidth, outer sep=0pt}] 131 | \draw[step=0.5cm,color=black] (-2,-2.5) grid (1,1); 132 | % First row left to right 133 | \node at (-1.75,+0.75) {G}; 134 | \node at (-1.25,+0.75) {}; 135 | \node at (-0.75,+0.75) {}; 136 | \node at (-0.25,+0.75) {}; 137 | \node at (+0.25,+0.75) {}; 138 | \node at (+0.75,+0.75) {}; 139 | 140 | % Second row left to right 141 | \node at (-1.75,+0.25) {}; 142 | \node[fill=black] at (-1.25,+0.25) {}; 143 | \node[fill=black] at (-0.75,+0.25) {}; 144 | \node[fill=gray!50] at (-0.25,+0.25) {}; 145 | \node[fill=black] at (+0.25,+0.25) {}; 146 | \node at (+0.75,+0.25) {}; 147 | 148 | % Third row left to right 149 | \node at (-1.75,-0.25) {}; 150 | \node[fill=black] at (-1.25,-0.25) {}; 151 | \node at (-0.75,-0.25) {}; 152 | \node[fill=gray!50] at (-0.25,-0.25) {}; 153 | \node[fill=gray!50] at (+0.25,-0.25) {}; 154 | \node at (+0.75,-0.25) {}; 155 | 156 | % Fourth row left to right 157 | \node at (-1.75,-0.75) {}; 158 | \node[fill=black] at (-1.25,-0.75) {}; 159 | \node at (-0.75,-0.75) {}; 160 | \node at (-0.25,-0.75) {}; 161 | \node[fill=gray!50] at (+0.25,-0.75) {}; 162 | \node[fill=gray!50] at (+0.75,-0.75) {}; 163 | 164 | % Fifth row left to right 165 | \node at (-1.75,-1.25) {}; 166 | \node[fill=black] at (-1.25,-1.25) {}; 167 | \node[fill=black] at (-0.75,-1.25) {}; 168 | \node at (-0.25,-1.25) {}; 169 | \node[fill=black] at (+0.25,-1.25) {}; 170 | \node at (+0.75,-1.25) {S}; 171 | 172 | % Sixth row left to right 173 | \node at (-1.75,-1.75) {}; 174 | \node at (-1.25,-1.75) {}; 175 | \node at (-0.75,-1.75) {}; 176 | \node at (-0.25,-1.75) {}; 177 | \node[fill=black] at (+0.25,-1.75) {}; 178 | \node at (+0.75,-1.75) {}; 179 | 180 | % Seventh row left to right 181 | \node[fill=black] at (-1.75,-2.25) {}; 182 | \node[fill=black] at (-1.25,-2.25) {}; 183 | \node[fill=black] at (-0.75,-2.25) {}; 184 | \node[fill=black] at (-0.25,-2.25) {}; 185 | \node[fill=black] at (+0.25,-2.25) {}; 186 | \node at (+0.75,-2.25) {}; 187 | 188 | % Draw path in blue 189 | \draw[ultra thick, red] (-1.75,+0.75) -- (-0.75,+0.75); 190 | \draw[ultra thick, red] (-0.75,+0.75) -- (+0.75,-0.75); 191 | \draw[ultra thick, red] (+0.75,-0.75) -- (+0.75,-1.25); 192 | \end{tikzpicture} 193 | 194 | \vspace*{20px} 195 | $\epsilon\!=\!2.5$ 196 | \begin{tikzpicture}[every node/.style={minimum size=.5cm-\pgflinewidth, outer sep=0pt}] 197 | \draw[step=0.5cm,color=black] (-2,-2.5) grid (1,1); 198 | % First row left to right 199 | \node[fill=gray!50] at (-1.75,+0.75) {G}; 200 | \node[fill=gray!50] at (-1.25,+0.75) {}; 201 | \node at (-0.75,+0.75) {}; 202 | \node at (-0.25,+0.75) {}; 203 | \node at (+0.25,+0.75) {}; 204 | \node at (+0.75,+0.75) {}; 205 | 206 | % Second row left to right 207 | \node[fill=gray!50] at (-1.75,+0.25) {}; 208 | \node[fill=black] at (-1.25,+0.25) {}; 209 | \node[fill=black] at (-0.75,+0.25) {}; 210 | \node[fill=black] at (-0.25,+0.25) {}; 211 | \node[fill=black] at (+0.25,+0.25) {}; 212 | \node at (+0.75,+0.25) {}; 213 | 214 | % Third row left to right 215 | \node[fill=gray!50] at (-1.75,-0.25) {}; 216 | \node[fill=black] at (-1.25,-0.25) {}; 217 | \node at (-0.75,-0.25) {}; 218 | \node at (-0.25,-0.25) {}; 219 | \node at (+0.25,-0.25) {}; 220 | \node at (+0.75,-0.25) {}; 221 | 222 | % Fourth row left to right 223 | \node[fill=gray!50] at (-1.75,-0.75) {}; 224 | \node[fill=black] at (-1.25,-0.75) {}; 225 | \node at (-0.75,-0.75) {}; 226 | \node at (-0.25,-0.75) {}; 227 | \node[fill=gray!50] at (+0.25,-0.75) {}; 228 | \node at (+0.75,-0.75) {}; 229 | 230 | % Fifth row left to right 231 | \node[fill=gray!50] at (-1.75,-1.25) {}; 232 | \node[fill=black] at (-1.25,-1.25) {}; 233 | \node[fill=black] at (-0.75,-1.25) {}; 234 | \node[fill=gray!50] at (-0.25,-1.25) {}; 235 | \node[fill=black] at (+0.25,-1.25) {}; 236 | \node[fill=gray!50] at (+0.75,-1.25) {}; 237 | 238 | % Sixth row left to right 239 | \node at (-1.75,-1.75) {}; 240 | \node[fill=gray!50] at (-1.25,-1.75) {}; 241 | \node[fill=gray!50] at (-0.75,-1.75) {}; 242 | \node[fill=gray!50] at (-0.25,-1.75) {}; 243 | \node[fill=black] at (+0.25,-1.75) {}; 244 | \node[fill=gray!50] at (+0.75,-1.75) {}; 245 | 246 | % Seventh row left to right 247 | \node[fill=black] at (-1.75,-2.25) {}; 248 | \node[fill=black] at (-1.25,-2.25) {}; 249 | \node[fill=black] at (-0.75,-2.25) {}; 250 | \node[fill=black] at (-0.25,-2.25) {}; 251 | \node[fill=black] at (+0.25,-2.25) {}; 252 | \node at (+0.75,-2.25) {S}; 253 | 254 | % Draw path in red 255 | \draw[ultra thick, red] (-1.75,+0.75) -- (-1.75,-1.25); 256 | \draw[ultra thick, red] (-1.75,-1.25) -- (-1.25,-1.75); 257 | \draw[ultra thick, red] (-1.25,-1.75) -- (-0.75,-1.75); 258 | \draw[ultra thick, red] (-0.75,-1.75) -- (+0.25,-0.75); 259 | \draw[ultra thick, red] (+0.25,-0.75) -- (+0.75,-1.25); 260 | \draw[ultra thick, red] (+0.75,-1.25) -- (+0.75,-2.25); 261 | \end{tikzpicture} 262 | \hspace{0.1cm} 263 | \begin{tikzpicture}[every node/.style={minimum size=.5cm-\pgflinewidth, outer sep=0pt}] 264 | \draw[step=0.5cm,color=black] (-2,-2.5) grid (1,1); 265 | % First row left to right 266 | \node at (-1.75,+0.75) {G}; 267 | \node at (-1.25,+0.75) {}; 268 | \node at (-0.75,+0.75) {}; 269 | \node at (-0.25,+0.75) {}; 270 | \node at (+0.25,+0.75) {}; 271 | \node at (+0.75,+0.75) {}; 272 | 273 | % Second row left to right 274 | \node at (-1.75,+0.25) {}; 275 | \node[fill=black] at (-1.25,+0.25) {}; 276 | \node[fill=black] at (-0.75,+0.25) {}; 277 | \node[fill=black] at (-0.25,+0.25) {}; 278 | \node[fill=black] at (+0.25,+0.25) {}; 279 | \node at (+0.75,+0.25) {}; 280 | 281 | % Third row left to right 282 | \node at (-1.75,-0.25) {}; 283 | \node[fill=black] at (-1.25,-0.25) {}; 284 | \node at (-0.75,-0.25) {}; 285 | \node at (-0.25,-0.25) {}; 286 | \node at (+0.25,-0.25) {}; 287 | \node at (+0.75,-0.25) {}; 288 | 289 | % Fourth row left to right 290 | \node at (-1.75,-0.75) {}; 291 | \node[fill=black] at (-1.25,-0.75) {}; 292 | \node at (-0.75,-0.75) {}; 293 | \node at (-0.25,-0.75) {}; 294 | \node at (+0.25,-0.75) {}; 295 | \node at (+0.75,-0.75) {}; 296 | 297 | % Fifth row left to right 298 | \node at (-1.75,-1.25) {}; 299 | \node[fill=black] at (-1.25,-1.25) {}; 300 | \node[fill=black] at (-0.75,-1.25) {}; 301 | \node at (-0.25,-1.25) {}; 302 | \node[fill=black] at (+0.25,-1.25) {}; 303 | \node at (+0.75,-1.25) {}; 304 | 305 | % Sixth row left to right 306 | \node at (-1.75,-1.75) {}; 307 | \node at (-1.25,-1.75) {}; 308 | \node at (-0.75,-1.75) {}; 309 | \node at (-0.25,-1.75) {}; 310 | \node[fill=black] at (+0.25,-1.75) {}; 311 | \node at (+0.75,-1.75) {S}; 312 | 313 | % Seventh row left to right 314 | \node[fill=black] at (-1.75,-2.25) {}; 315 | \node[fill=black] at (-1.25,-2.25) {}; 316 | \node[fill=black] at (-0.75,-2.25) {}; 317 | \node[fill=black] at (-0.25,-2.25) {}; 318 | \node[fill=black] at (+0.25,-2.25) {}; 319 | \node at (+0.75,-2.25) {}; 320 | 321 | % Draw path in red 322 | \draw[ultra thick, red] (-1.75,+0.75) -- (-1.75,-1.25); 323 | \draw[ultra thick, red] (-1.75,-1.25) -- (-1.25,-1.75); 324 | \draw[ultra thick, red] (-1.25,-1.75) -- (-0.75,-1.75); 325 | \draw[ultra thick, red] (-0.75,-1.75) -- (+0.25,-0.75); 326 | \draw[ultra thick, red] (+0.25,-0.75) -- (+0.75,-1.25); 327 | \draw[ultra thick, red] (+0.75,-1.25) -- (+0.75,-1.75); 328 | \end{tikzpicture} 329 | \hspace{0.1cm} 330 | \begin{tikzpicture}[every node/.style={minimum size=.5cm-\pgflinewidth, outer sep=0pt}] 331 | \draw[step=0.5cm,color=black] (-2,-2.5) grid (1,1); 332 | % First row left to right 333 | \node at (-1.75,+0.75) {G}; 334 | \node at (-1.25,+0.75) {}; 335 | \node at (-0.75,+0.75) {}; 336 | \node at (-0.25,+0.75) {}; 337 | \node at (+0.25,+0.75) {}; 338 | \node at (+0.75,+0.75) {}; 339 | 340 | % Second row left to right 341 | \node at (-1.75,+0.25) {}; 342 | \node[fill=black] at (-1.25,+0.25) {}; 343 | \node[fill=black] at (-0.75,+0.25) {}; 344 | \node at (-0.25,+0.25) {}; 345 | \node[fill=black] at (+0.25,+0.25) {}; 346 | \node at (+0.75,+0.25) {}; 347 | 348 | % Third row left to right 349 | \node at (-1.75,-0.25) {}; 350 | \node[fill=black] at (-1.25,-0.25) {}; 351 | \node at (-0.75,-0.25) {}; 352 | \node at (-0.25,-0.25) {}; 353 | \node at (+0.25,-0.25) {}; 354 | \node at (+0.75,-0.25) {}; 355 | 356 | % Fourth row left to right 357 | \node at (-1.75,-0.75) {}; 358 | \node[fill=black] at (-1.25,-0.75) {}; 359 | \node at (-0.75,-0.75) {}; 360 | \node at (-0.25,-0.75) {}; 361 | \node at (+0.25,-0.75) {}; 362 | \node at (+0.75,-0.75) {}; 363 | 364 | % Fifth row left to right 365 | \node at (-1.75,-1.25) {}; 366 | \node[fill=black] at (-1.25,-1.25) {}; 367 | \node[fill=black] at (-0.75,-1.25) {}; 368 | \node at (-0.25,-1.25) {}; 369 | \node[fill=black] at (+0.25,-1.25) {}; 370 | \node at (+0.75,-1.25) {S}; 371 | 372 | % Sixth row left to right 373 | \node at (-1.75,-1.75) {}; 374 | \node at (-1.25,-1.75) {}; 375 | \node at (-0.75,-1.75) {}; 376 | \node at (-0.25,-1.75) {}; 377 | \node[fill=black] at (+0.25,-1.75) {}; 378 | \node at (+0.75,-1.75) {}; 379 | 380 | % Seventh row left to right 381 | \node[fill=black] at (-1.75,-2.25) {}; 382 | \node[fill=black] at (-1.25,-2.25) {}; 383 | \node[fill=black] at (-0.75,-2.25) {}; 384 | \node[fill=black] at (-0.25,-2.25) {}; 385 | \node[fill=black] at (+0.25,-2.25) {}; 386 | \node at (+0.75,-2.25) {}; 387 | 388 | % Draw path in red 389 | \draw[ultra thick, red] (-1.75,+0.75) -- (-1.75,-1.25); 390 | \draw[ultra thick, red] (-1.75,-1.25) -- (-1.25,-1.75); 391 | \draw[ultra thick, red] (-1.25,-1.75) -- (-0.75,-1.75); 392 | \draw[ultra thick, red] (-0.75,-1.75) -- (+0.25,-0.75); 393 | \draw[ultra thick, red] (+0.25,-0.75) -- (+0.75,-1.25); 394 | \end{tikzpicture} -------------------------------------------------------------------------------- /NeuralNetworks/LICENSE: -------------------------------------------------------------------------------- 1 | CC0 1.0 Universal 2 | 3 | Statement of Purpose 4 | 5 | The laws of most jurisdictions throughout the world automatically confer 6 | exclusive Copyright and Related Rights (defined below) upon the creator and 7 | subsequent owner(s) (each and all, an "owner") of an original work of 8 | authorship and/or a database (each, a "Work"). 9 | 10 | Certain owners wish to permanently relinquish those rights to a Work for the 11 | purpose of contributing to a commons of creative, cultural and scientific 12 | works ("Commons") that the public can reliably and without fear of later 13 | claims of infringement build upon, modify, incorporate in other works, reuse 14 | and redistribute as freely as possible in any form whatsoever and for any 15 | purposes, including without limitation commercial purposes. These owners may 16 | contribute to the Commons to promote the ideal of a free culture and the 17 | further production of creative, cultural and scientific works, or to gain 18 | reputation or greater distribution for their Work in part through the use and 19 | efforts of others. 20 | 21 | For these and/or other purposes and motivations, and without any expectation 22 | of additional consideration or compensation, the person associating CC0 with a 23 | Work (the "Affirmer"), to the extent that he or she is an owner of Copyright 24 | and Related Rights in the Work, voluntarily elects to apply CC0 to the Work 25 | and publicly distribute the Work under its terms, with knowledge of his or her 26 | Copyright and Related Rights in the Work and the meaning and intended legal 27 | effect of CC0 on those rights. 28 | 29 | 1. Copyright and Related Rights. A Work made available under CC0 may be 30 | protected by copyright and related or neighboring rights ("Copyright and 31 | Related Rights"). Copyright and Related Rights include, but are not limited 32 | to, the following: 33 | 34 | i. the right to reproduce, adapt, distribute, perform, display, communicate, 35 | and translate a Work; 36 | 37 | ii. moral rights retained by the original author(s) and/or performer(s); 38 | 39 | iii. publicity and privacy rights pertaining to a person's image or likeness 40 | depicted in a Work; 41 | 42 | iv. rights protecting against unfair competition in regards to a Work, 43 | subject to the limitations in paragraph 4(a), below; 44 | 45 | v. rights protecting the extraction, dissemination, use and reuse of data in 46 | a Work; 47 | 48 | vi. database rights (such as those arising under Directive 96/9/EC of the 49 | European Parliament and of the Council of 11 March 1996 on the legal 50 | protection of databases, and under any national implementation thereof, 51 | including any amended or successor version of such directive); and 52 | 53 | vii. other similar, equivalent or corresponding rights throughout the world 54 | based on applicable law or treaty, and any national implementations thereof. 55 | 56 | 2. Waiver. To the greatest extent permitted by, but not in contravention of, 57 | applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and 58 | unconditionally waives, abandons, and surrenders all of Affirmer's Copyright 59 | and Related Rights and associated claims and causes of action, whether now 60 | known or unknown (including existing as well as future claims and causes of 61 | action), in the Work (i) in all territories worldwide, (ii) for the maximum 62 | duration provided by applicable law or treaty (including future time 63 | extensions), (iii) in any current or future medium and for any number of 64 | copies, and (iv) for any purpose whatsoever, including without limitation 65 | commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes 66 | the Waiver for the benefit of each member of the public at large and to the 67 | detriment of Affirmer's heirs and successors, fully intending that such Waiver 68 | shall not be subject to revocation, rescission, cancellation, termination, or 69 | any other legal or equitable action to disrupt the quiet enjoyment of the Work 70 | by the public as contemplated by Affirmer's express Statement of Purpose. 71 | 72 | 3. Public License Fallback. Should any part of the Waiver for any reason be 73 | judged legally invalid or ineffective under applicable law, then the Waiver 74 | shall be preserved to the maximum extent permitted taking into account 75 | Affirmer's express Statement of Purpose. In addition, to the extent the Waiver 76 | is so judged Affirmer hereby grants to each affected person a royalty-free, 77 | non transferable, non sublicensable, non exclusive, irrevocable and 78 | unconditional license to exercise Affirmer's Copyright and Related Rights in 79 | the Work (i) in all territories worldwide, (ii) for the maximum duration 80 | provided by applicable law or treaty (including future time extensions), (iii) 81 | in any current or future medium and for any number of copies, and (iv) for any 82 | purpose whatsoever, including without limitation commercial, advertising or 83 | promotional purposes (the "License"). The License shall be deemed effective as 84 | of the date CC0 was applied by Affirmer to the Work. Should any part of the 85 | License for any reason be judged legally invalid or ineffective under 86 | applicable law, such partial invalidity or ineffectiveness shall not 87 | invalidate the remainder of the License, and in such case Affirmer hereby 88 | affirms that he or she will not (i) exercise any of his or her remaining 89 | Copyright and Related Rights in the Work or (ii) assert any associated claims 90 | and causes of action with respect to the Work, in either case contrary to 91 | Affirmer's express Statement of Purpose. 92 | 93 | 4. Limitations and Disclaimers. 94 | 95 | a. No trademark or patent rights held by Affirmer are waived, abandoned, 96 | surrendered, licensed or otherwise affected by this document. 97 | 98 | b. Affirmer offers the Work as-is and makes no representations or warranties 99 | of any kind concerning the Work, express, implied, statutory or otherwise, 100 | including without limitation warranties of title, merchantability, fitness 101 | for a particular purpose, non infringement, or the absence of latent or 102 | other defects, accuracy, or the present or absence of errors, whether or not 103 | discoverable, all to the greatest extent permissible under applicable law. 104 | 105 | c. Affirmer disclaims responsibility for clearing rights of other persons 106 | that may apply to the Work or any use thereof, including without limitation 107 | any person's Copyright and Related Rights in the Work. Further, Affirmer 108 | disclaims responsibility for obtaining any necessary consents, permissions 109 | or other rights required for any use of the Work. 110 | 111 | d. Affirmer understands and acknowledges that Creative Commons is not a 112 | party to this document and has no duty or obligation with respect to this 113 | CC0 or use of the Work. 114 | 115 | For more information, please see 116 | 117 | -------------------------------------------------------------------------------- /NeuralNetworks/README.md: -------------------------------------------------------------------------------- 1 | # Neural Networks presentation 2 | 3 | ![alt text](images/cc-logo.png "CC") 4 | 5 | 6 | Licensed under [creative commons](https://github.com/LIAMF-USP/TikzTemplates/blob/master/NeuralNetworks/LICENSE) 7 | 8 | ## Usage 9 | 10 | You can find the pdf of the presentation in the folder /src/pdf. But if you want to compile (**for Ubuntu users**) the latex file just run: 11 | 12 | ``` 13 | $ bash install.sh 14 | $ cd src/ 15 | $ make 16 | ``` 17 | 18 | -------------------------------------------------------------------------------- /NeuralNetworks/images/cc-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/NeuralNetworks/images/cc-logo.png -------------------------------------------------------------------------------- /NeuralNetworks/install.sh: -------------------------------------------------------------------------------- 1 | sudo apt-get install texlive-latex-base 2 | sudo apt-get install latex-beamer 3 | sudo apt-get install texlive-latex-extra 4 | sudo apt-get install texlive-fonts-extra 5 | -------------------------------------------------------------------------------- /NeuralNetworks/src/Makefile: -------------------------------------------------------------------------------- 1 | BASE_NAME := main 2 | BUILD_DIR := build 3 | PDF_NAME := NN.pdf 4 | 5 | PDFLATEX_OPTIONS = -halt-on-error -aux-directory=$(BUILD_DIR) -output-directory=$(BUILD_DIR) --shell-escape 6 | LATEX := latex 7 | PDFLATEX = pdflatex $(PDFLATEX_OPTIONS) 8 | BIBTEX := bibtex 9 | 10 | pdf: $(BASE_NAME).pdf 11 | 12 | $(BASE_NAME).pdf: $(BASE_NAME).tex 13 | mkdir -p $(BUILD_DIR) 14 | $(PDFLATEX) $< 15 | $(BIBTEX) $(BUILD_DIR)/$(BASE_NAME) 16 | $(PDFLATEX) $< 17 | $(PDFLATEX) $< 18 | $(PDFLATEX) $< 19 | cp $(BUILD_DIR)/$(BASE_NAME).pdf $(PDF_NAME) 20 | 21 | clean: 22 | rm -rf build $(PDF_NAME) 23 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/3x3.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.7}{ 5 | \begin{tikzpicture}[scale=1.4,every node/.style={minimum size=1cm}, on grid] 6 | \draw[fill=base02,opacity=0.4] (0,0) rectangle (3,3); 7 | \draw[draw=base03,thick] (0,0) grid (3,3); 8 | \node (00) at (0.5,2.5) {\Large 0}; 9 | \node (01) at (1.5,2.5) {\Large 1}; 10 | \node (02) at (2.5,2.5) {\Large 2}; 11 | \node (10) at (0.5,1.5) {\Large 2}; 12 | \node (11) at (1.5,1.5) {\Large 2}; 13 | \node (12) at (2.5,1.5) {\Large 0}; 14 | \node (20) at (0.5,0.5) {\Large 0}; 15 | \node (21) at (1.5,0.5) {\Large 1}; 16 | \node (22) at (2.5,0.5) {\Large 2}; 17 | \end{tikzpicture} 18 | } % scalebox 19 | \end{figure} 20 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/5x5.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.7}{ 5 | \begin{tikzpicture}[scale=1.5,every node/.style={minimum size=2cm}, on grid] 6 | \draw[fill=blue2,opacity=1.2] (0,0) rectangle (5,5); 7 | \draw[draw=base03,thick] (0,0) grid (5,5); 8 | \node (00) at (0.5,4.5) {\LARGE 3}; 9 | \node (10) at (0.5,3.5) {\LARGE 0}; 10 | \node (20) at (0.5,2.5) {\LARGE 3}; 11 | \node (30) at (0.5,1.5) {\LARGE 2}; 12 | \node (40) at (0.5,0.5) {\LARGE 2}; 13 | 14 | \node (01) at (1.5,4.5) {\LARGE 3}; 15 | \node (11) at (1.5,3.5) {\LARGE 0}; 16 | \node (21) at (1.5,2.5) {\LARGE 1}; 17 | \node (31) at (1.5,1.5) {\LARGE 0}; 18 | \node (41) at (1.5,0.5) {\LARGE 0}; 19 | 20 | \node (02) at (2.5,4.5) {\LARGE 2}; 21 | \node (12) at (2.5,3.5) {\LARGE 1}; 22 | \node (22) at (2.5,2.5) {\LARGE 2}; 23 | \node (32) at (2.5,1.5) {\LARGE 0}; 24 | \node (42) at (2.5,0.5) {\LARGE 0}; 25 | 26 | \node (03) at (3.5,4.5) {\LARGE 1}; 27 | \node (13) at (3.5,3.5) {\LARGE 3}; 28 | \node (23) at (3.5,2.5) {\LARGE 2}; 29 | \node (33) at (3.5,1.5) {\LARGE 2}; 30 | \node (43) at (3.5,0.5) {\LARGE 0}; 31 | 32 | \node (04) at (4.5,4.5) {\LARGE 0}; 33 | \node (14) at (4.5,3.5) {\LARGE 1}; 34 | \node (24) at (4.5,2.5) {\LARGE 3}; 35 | \node (34) at (4.5,1.5) {\LARGE 2}; 36 | \node (44) at (4.5,0.5) {\LARGE 1}; 37 | \end{tikzpicture} 38 | } % scalebox 39 | \end{figure} 40 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/Compgraph1.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.3}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % nodes 10 | \node[op] (W1) {$\vect{W}$}; 11 | \node[textonly, below=20pt of W1] (inv1) {}; 12 | \node[op, below=40pt of W1] (x1) {$\vect{x}$}; 13 | \node[op, right=30.5pt of inv1] (v1) {matmul}; 14 | \node[op, right=120pt of W1] (W2) {$\vect{W}$}; 15 | \node[textonly, below=20pt of W2] (inv2) {}; 16 | \node[op, below=40pt of W2] (x2) {$\vect{x}$}; 17 | \node[op, right=30.5pt of inv2] (v2) {$\vect{v}$}; 18 | \node[textonly, left=1.5pt of v2] (matmtul) {matmul}; 19 | \node[textonly, left=40pt of inv2] (inv3) {}; 20 | \node[textonly, below=50.5pt of inv3] (result) {{\large $\vect{v} = \vect{W} \vect{x} $}}; 21 | 22 | % edges 23 | \path[tedge] (W1) -- (v1); 24 | \path[tedge] (x1) -- (v1); 25 | \path[tedge] (W2) -- (v2); 26 | \path[tedge] (x2) -- (v2); 27 | 28 | \end{tikzpicture} 29 | } % scalebox 30 | \end{figure} 31 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/Compgraph2.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.15}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % nodes 10 | \node[op] (W1) {$\vect{W}_{1}$}; 11 | \node[textonly, below=40pt of W1] (inv1) {}; 12 | \node[op, below=20pt of inv1] (x) {$\vect{x}$}; 13 | \node[op, right=30.5pt of inv1] (v) {$\vect{v}$}; 14 | \node[textonly, left=1.5pt of v] (matmtul1) {matmul}; 15 | \node[op, right=35pt of v] (h) {$\vect{h}$}; 16 | \node[op, right=110pt of W1] (W2) {$\vect{W}_{2}$}; 17 | \node[op, right=35pt of h] (z) {$\vect{z}$}; 18 | \node[op, right=55pt of z] (y) {$\hat{\vect{y}}$}; 19 | \node[textonly, above left=1.5pt of z] (matmtul2) {matmul}; 20 | 21 | 22 | % edges 23 | \path[tedge] (W1) -- (v); 24 | \path[tedge] (x) -- (v); 25 | \path[tedge] (v) edge node[above=1pt] {{\Large$\sigma$}} (h); 26 | \path[tedge] (z) edge node[above=1pt] {{\Large softmax}} (y); 27 | \path[tedge] (W2) -- (z); 28 | \path[tedge] (h) -- (z); 29 | 30 | 31 | \end{tikzpicture} 32 | } % scalebox 33 | \end{figure} 34 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/Compgraph3.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.2}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % nodes on the left 10 | \node[op] (W1) {$\vect{W}_{1}$}; 11 | \node[textonly, below=20pt of W1] (inv1) {}; 12 | \node[op, right=30pt of inv1] (v) {$\vect{v}$}; 13 | \node[op, below right=30.5pt of v] (x) {$\vect{x}$}; 14 | \node[op, above=30.5pt of v] (hprime) {$\vect{h}^{\prime}$}; 15 | \node[textonly, above right=2pt of hprime] (h) {{\LARGE$\vect{h}$}}; 16 | 17 | 18 | %% namedscope in the left 19 | \begin{scope}[on background layer] 20 | \coordinate (p1) at (hprime.north); 21 | \coordinate (p2) at (v.south east); 22 | \coordinate (p3) at (W1.west); 23 | \tkzCircumCenter(p1,p2,p3) 24 | \tkzGetPoint{O} 25 | \tkzDrawCircle[draw=orange, line width=1.5pt, fill=orange!60](O,p1) 26 | \end{scope} 27 | 28 | % edges on the left 29 | \path[tedge] (W1) -- (v); 30 | \path[tedge] (x) -- (v); 31 | \path[tedge] (v) -- (hprime); 32 | 33 | % nodes on the right 34 | \node[op, right=30pt of x] (hh) {$\vect{h}$}; 35 | \node[op, above right=30.5pt of hh] (z) {$\vect{z}$}; 36 | \node[op, above=30.5pt of z] (yprime) {$\vect{y}^{\prime}$}; 37 | \node[textonly, right=30pt of z] (inv2) {}; 38 | \node[op, above=20pt of inv2] (W2) {$\vect{W}_{2}$}; 39 | \node[textonly, above left=1pt of yprime] (yhat) {{\LARGE$\hat{\vect{y}}$}}; 40 | 41 | 42 | %% namedscope in the right 43 | \begin{scope}[on background layer] 44 | \coordinate (p1) at (yprime.north); 45 | \coordinate (p2) at (W2.north east); 46 | \coordinate (p3) at (z.south west); 47 | \tkzCircumCenter(p1,p2,p3) 48 | \tkzGetPoint{O} 49 | \tkzDrawCircle[draw=orange, line width=1.5pt, fill=orange!60](O,p1) 50 | \end{scope} 51 | 52 | 53 | 54 | % edges on the right 55 | \path[tedge] (W2) -- (z); 56 | \path[tedge] (hh) -- (z); 57 | \path[tedge] (z) -- (yprime); 58 | 59 | 60 | \end{tikzpicture} 61 | } % scalebox 62 | \end{figure} 63 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/Compgraph4.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.5}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | \node[op] (h) {$\vect{h}$}; 9 | \node[op, above=30pt of h] (y) {$\hat{\vect{y}}$}; 10 | \node[op, below=30pt of h] (x) {$\vect{x}$}; 11 | 12 | 13 | % edges 14 | \path[tedge] (x) -- (h); 15 | \path[tedge] (h) -- (y); 16 | 17 | \end{tikzpicture} 18 | } % scalebox 19 | \end{figure} 20 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/DFNclassification.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.3}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % nodes 10 | \node[textonly] (vectorx) {$\begin{bmatrix}0.34\\ \vdots \\0.06\end{bmatrix}$}; 11 | \node[textonly, above=1pt of vectorx] (x) {$\vect{x}$}; 12 | \node[textonly, below=1pt of vectorx] (dimension1) {{\small$784\times 1$}}; 13 | \node[op, right=30pt of vectorx] (model) {\textbf{DFN}}; 14 | \node[textonly, right=30pt of model] (vectoryhat) {$\begin{bmatrix}p(y=1| \vect{x};\vect{\theta})\\ \vdots \\p(y=10| \vect{x};\vect{\theta})\end{bmatrix}$}; 15 | \node[textonly, above=1pt of vectoryhat] (yhat) {$\hat{\vect{y}}$}; 16 | \node[textonly, below=1pt of vectoryhat] (dimension2) {{\small$10\times 1$}}; 17 | 18 | 19 | 20 | % edges 21 | \path[tedge] (vectorx) -- (model); 22 | \path[tedge] (model) -- (vectoryhat); 23 | 24 | 25 | \end{tikzpicture} 26 | } % scalebox 27 | \end{figure} 28 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/DeepNN.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.7}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | \node[op] (h1) {$\vect{h}^{(1)}$}; 9 | \node[op, below=30pt of h1] (x) {$\vect{x}$}; 10 | \node[op, above=30pt of h1] (h2) {$\vect{h}^{(2)}$}; 11 | \node[textonly, above=20pt of h2] (hdots) {{\LARGE$\vdots$}}; 12 | \node[op, above=20pt of hdots] (hn) {$\vect{h}^{(n)}$}; 13 | \node[op, above=30pt of hn] (y) {$\hat{\vect{y}}$}; 14 | 15 | %invisible nodes 16 | \node[textonly, above right=2pt of y] (yinv1) {}; 17 | \node[textonly, below right=2pt of y] (yinv2) {}; 18 | \node[textonly, right=26pt of y] (yinv3) {output layer}; 19 | 20 | \node[textonly, above right=2pt of hn] (hinv1) {}; 21 | \node[textonly, below right=2pt of h1] (hinv2) {}; 22 | \node[textonly, right=26pt of h2] (hinv3) {hidden layers}; 23 | 24 | \node[textonly, above right=2pt of x] (xinv1) {}; 25 | \node[textonly, below right=2pt of x] (xinv2) {}; 26 | \node[textonly, right=26pt of x] (xinv3) {input layer}; 27 | 28 | 29 | \visible<2->{\node[textonly, above left=0.1pt and 0.1pt of y] (d1) {};} 30 | \visible<2->{\node[textonly, below left=0.1pt and 0.1pt of x] (d2) {};} 31 | \visible<2->{\node[textonly, left=56pt of hdots] (d3) {{\large\alert{deep model}}};} 32 | 33 | 34 | % edges 35 | \path[tedge] (x) -- (h1); 36 | \path[tedge] (h1) -- (h2); 37 | \path[tedge] (h2) -- (hdots); 38 | \path[tedge] (hdots) -- (hn); 39 | \path[tedge] (hn) -- (y); 40 | 41 | % visual aid edges 42 | \draw[orange!120, line width=1mm] (yinv3) to [out=180,in=-80] (yinv1); 43 | \draw[orange!120, line width=1mm] (yinv3) to [out=180,in=80] (yinv2); 44 | 45 | 46 | \draw[orange!120, line width=1mm] (hinv3) to [out=180,in=-80] (hinv1); 47 | \draw[orange!120, line width=1mm] (hinv3) to [out=180,in=80] (hinv2); 48 | 49 | 50 | \draw[orange!120, line width=1mm] (xinv3) to [out=180,in=-80] (xinv1); 51 | \draw[orange!120, line width=1mm] (xinv3) to [out=180,in=80] (xinv2); 52 | 53 | 54 | \visible<2->{\draw[orange!180, line width=1mm] (d3) to [out=0,in=180] (d1);} 55 | \visible<2->{\draw[orange!180, line width=1mm] (d3) to [out=0,in=180] (d2);} 56 | 57 | 58 | 59 | \end{tikzpicture} 60 | } % scalebox 61 | \end{figure} 62 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/Dropout1.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.3}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | \node[op] (x2) {$x_2$}; 9 | \node[op, above=20pt of x2] (x1) {$x_1$}; 10 | \node[op, below=20pt of x2] (x3) {$x_3$}; 11 | \node[op, above right=10pt and 40pt of x2] (h2) {$h_2$}; 12 | \node[op, above=20pt of h2] (h1) {$h_1$}; 13 | \node[op, below=20pt of h2] (h3) {$h_3$}; 14 | \node[op, below=20pt of h3] (h4) {$h_4$}; 15 | \node[op, right=90pt of x2] (o) {$\hat{y}$}; 16 | 17 | % edges 18 | \path[tedge_dashed] (x1) edge node[pos=0.25, above=1.8pt, dashed] {\large{\alert{$0$}}} (h1); 19 | \path[tedge] (x1) edge node[above=1.2pt] {} (h2); 20 | \path[tedge] (x1) edge node[above=1.8pt] {} (h3); 21 | \path[tedge] (x1) edge node[above=1.8pt] {} (h4); 22 | 23 | \path[tedge] (x2) edge node[above=1.8pt] {} (h1); 24 | \path[tedge] (x2) edge node[above=1.8pt] {} (h2); 25 | \path[tedge] (x2) edge node[above=1.8pt] {} (h3); 26 | \path[tedge] (x2) edge node[above=1.8pt] {} (h4); 27 | 28 | \path[tedge] (x3) edge node[above=1.8pt] {} (h1); 29 | \path[tedge] (x3) edge node[above=1.8pt] {} (h2); 30 | \path[tedge] (x3) edge node[above=1.8pt] {} (h3); 31 | \path[tedge_dashed] (x3) edge node[above=1.0pt] {} (h4); 32 | 33 | \path[tedge_dashed] (h1) edge node[pos=0.25, above=1.8pt, right=0.1cm] {} (o); 34 | \path[tedge] (h2) edge node[above=1.8pt] {} (o); 35 | \path[tedge] (h3) edge node[above=1.8pt] {} (o); 36 | \path[tedge] (h4) edge node[above=1.8pt] {} (o); 37 | 38 | 39 | % info edges 40 | 41 | 42 | \end{tikzpicture} 43 | } % scalebox 44 | \end{figure} -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/Dropout2.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.3}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | \node[op] (x2) {$x_2$}; 9 | \node[op, above=20pt of x2] (x1) {$x_1$}; 10 | \node[op, below=20pt of x2] (x3) {$x_3$}; 11 | \node[op, above right=10pt and 40pt of x2] (h2) {$h_2$}; 12 | \node[op, above=20pt of h2] (h1) {$h_1$}; 13 | \node[op, below=20pt of h2] (h3) {$h_3$}; 14 | \node[op, below=20pt of h3] (h4) {$h_4$}; 15 | \node[op, right=90pt of x2] (o) {$\hat{y}$}; 16 | % edges 17 | \path[tedge] (x1) edge node[pos=0.25, above=1.8pt] {} (h1); 18 | \path[tedge] (x1) edge node[above=1.2pt] {} (h2); 19 | \path[tedge] (x1) edge node[above=1.8pt] {} (h3); 20 | \path[tedge_dashed] (x1) edge node[above=1.8pt] {} (h4); 21 | 22 | \path[tedge] (x2) edge node[above=1.8pt] {} (h1); 23 | \path[tedge_dashed] (x2) edge node[above=1.8pt] {} (h2); 24 | \path[tedge] (x2) edge node[above=1.8pt] {} (h3); 25 | \path[tedge] (x2) edge node[above=1.8pt] {} (h4); 26 | 27 | \path[tedge_dashed] (x3) edge node[above=1.8pt] {} (h1); 28 | \path[tedge] (x3) edge node[above=1.8pt] {} (h2); 29 | \path[tedge] (x3) edge node[above=1.8pt] {} (h3); 30 | \path[tedge] (x3) edge node[above=1.0pt] {} (h4); 31 | 32 | \path[tedge] (h1) edge node[pos=0.25, above=1.8pt, right=0.1cm] {} (o); 33 | \path[tedge] (h2) edge node[above=1.8pt] {} (o); 34 | \path[tedge] (h3) edge node[above=1.8pt] {} (o); 35 | \path[tedge_dashed] (h4) edge node[below=1.8pt] {\large{\alert{$0$}}}(o); 36 | 37 | 38 | % info edges 39 | 40 | 41 | \end{tikzpicture} 42 | } % scalebox 43 | \end{figure} 44 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/Entropy1.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.3}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % nodes 10 | \node[textonly] (pprob) {$\begin{bmatrix}0.8\\0.2\end{bmatrix}$}; 11 | \node[textonly, right=40pt of pprob] (qprob) {$\begin{bmatrix}0.5\\0.5\end{bmatrix}$}; 12 | \node[textonly, above=1pt of pprob] (p) {$\vect{p}$}; 13 | \node[textonly, above=1pt of qprob] (q) {$\vect{q}$}; 14 | 15 | 16 | \node[textonly, below=20pt of pprob] (Hp) {$H(\vect{p}) = 0.72$}; 17 | \node[textonly, below=20pt of qprob] (Hq) {$H(\vect{q}) = 1$}; 18 | \node[textonly, below=30pt of Hp] (inv1) {}; 19 | \node[textonly, right=-40pt of inv1] (Hquation) {{\Large$H(\vect{p}) = \sum_{i} \vect{p}_i\log\frac{1}{\vect{p}_i}$}}; 20 | 21 | 22 | \end{tikzpicture} 23 | } % scalebox 24 | \end{figure} 25 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/Entropy2.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.0}{ 5 | \begin{tikzpicture} 6 | \begin{axis}% 7 | [ 8 | grid=major, 9 | xmin=0, 10 | xmax=1, 11 | axis x line=bottom, 12 | ytick={0,.5,1}, 13 | ymax=1.1, 14 | axis y line=middle, 15 | xlabel= $p$, 16 | ylabel= $H(\vect{p})$, 17 | ] 18 | \addplot% 19 | [ orange!180, 20 | ultra thick, 21 | % blue,% 22 | mark=none, 23 | samples=200, 24 | domain=0.0001:0.9999, 25 | ] 26 | (x,{(x*log2(1/x)) + ((1-x)*log2(1/(1-x)))}); 27 | \end{axis} 28 | \node[textonly] (pprob) at (8.75,2.8) {{\Large$\begin{bmatrix}p\\1-p\end{bmatrix}$}}; 29 | \node[textonly, above=1pt of pprob] (p) {{\Large$\vect{p}$}}; 30 | \end{tikzpicture} 31 | } % scalebox 32 | \end{figure} -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/Kernel_image_pro.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.70}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % nodes 10 | \node (original) 11 | {\includegraphics[width=.15\textwidth]{images/Vd-Orig.png}}; 12 | \node[above right= 20pt and 150pt of original] (edge) {\includegraphics[width=.15\textwidth]{images/Vd-Edge3.png}}; 13 | \node[below=20pt of edge] (sharpen) {\includegraphics[width=.15\textwidth]{images/Vd-Sharp.png}}; 14 | \node[below=20pt of sharpen] (blur) {\includegraphics[width=.15\textwidth]{images/Vd-Blur1.png}}; 15 | 16 | % edges 17 | \path[tedge, orange!120, line width=1mm] (original) to [out=90,in=180, looseness=9, distance=125pt] (edge); 18 | \path[tedge, orange!120, line width=1mm] (original) to [out=0,in=180] (sharpen); 19 | \path[tedge, orange!120, line width=1mm] (original) to [out=-90,in=180, looseness=9, distance=125pt] (blur); 20 | 21 | % nodes for kernels 22 | \node[op3, right=20pt of original] (kernel1) {$\begin{bmatrix}0 & -1 & 0\\ -1 & 5 & -1\\0 & -1 & 0\end{bmatrix}$}; 23 | \node[op3, above=10pt of kernel1] (kernel2) {$\begin{bmatrix}-1 & -1 & -1\\ -1 & 8 & -1\\-1 & -1 & -1\end{bmatrix}$}; 24 | \node[op3, below=10pt of kernel1] (kernel3) {$\frac{1}{16}\begin{bmatrix}1 & 2 & 1\\ 2 & 4 & 2\\1 & 2 & 1\end{bmatrix}$}; 25 | 26 | \end{tikzpicture} 27 | } % scalebox 28 | \vspace*{-10mm} 29 | \caption{Exemplo de aplicação de filtros em uma imagem (extraído de \url{https://en.wikipedia.org/wiki/Kernel_(image_processing)})} 30 | \end{figure} 31 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/KullbackLeibler.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.3}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % nodes 10 | \node[textonly] (p1prob) {$\begin{bmatrix}0.8\\0.2\end{bmatrix}$}; 11 | \node[textonly, right=30pt of p1prob] (q1prob) {$\begin{bmatrix}0.5\\0.5\end{bmatrix}$}; 12 | \node[textonly, above=1pt of p1prob] (p1) {$\vect{p}$}; 13 | \node[textonly, above=1pt of q1prob] (q1) {$\vect{q}$}; 14 | \node[textonly, right=20pt of q1prob] (p2prob) {$\begin{bmatrix}0.8\\0.2\end{bmatrix}$}; 15 | \node[textonly, right=30pt of p2prob] (q2prob) {$\begin{bmatrix}0.88\\0.12\end{bmatrix}$}; 16 | \node[textonly, above=1pt of p2prob] (p2) {$\vect{p}^{\prime}$}; 17 | \node[textonly, above=1pt of q2prob] (q2) {$\vect{q}^{\prime}$}; 18 | 19 | 20 | \node[textonly, below right=20pt and -15pt of p1prob] (Dkl1) {$D_{KL}(\vect{p}||\vect{q}) = 0.28$}; 21 | \node[textonly, below right=20pt and -15pt of p2prob] (Dkl2) {$D_{KL}(\vect{p}^{\prime}||\vect{q}^{\prime}) = 0.04$}; 22 | \node[textonly, below=20pt of Dkl1] (inv1) {}; 23 | \node[textonly, right=-40pt of inv1] (Dklequation) {{\Large$D_{KL}(\vect{p}||\vect{q}) = \sum_{i} \vect{p}_i\log\frac{\vect{p}_i}{\vect{q}_i}$}}; 24 | 25 | 26 | 27 | % edges 28 | \draw[orange!120, line width=1mm] (Dkl1) to [out=150,in=-90] (p1prob); 29 | \draw[orange!120, line width=1mm] (Dkl1) to [out=150,in=-100] (q1prob); 30 | 31 | \draw[orange!120, line width=1mm] (Dkl2) to [out=150,in=-90] (p2prob); 32 | \draw[orange!120, line width=1mm] (Dkl2) to [out=150,in=-100] (q2prob); 33 | 34 | \end{tikzpicture} 35 | } % scalebox 36 | \end{figure} 37 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/NN.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.5}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | \node[op] (h) {$\vect{h}$}; 9 | \node[op, above=30pt of h] (y) {$\hat{\vect{y}}$}; 10 | \node[op, below=30pt of h] (x) {$\vect{x}$}; 11 | \node[textonly, right=76pt of h] (inv) {}; 12 | \node[textonly, above=16pt of inv] (f1) {$\hat{y} = f^{(2)}(f^{(1)}(\vect{x}; \vect{W}_1); \vect{W}_2)$}; 13 | \node[textonly, below=10pt of f1] (f2) {$\hat{y} = softmax( \vect{W}_2 (\sigma(\vect{W}_1\vect{x})))$}; 14 | 15 | 16 | % edges 17 | \path[tedge] (x) edge [out=90,in=-90] node[right] {$\vect{W}_{1}$} (h); 18 | \path[tedge] (h) edge [out=90,in=-90] node[right] {$\vect{W}_{2}$} (y); 19 | 20 | \end{tikzpicture} 21 | } % scalebox 22 | \end{figure} 23 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/OldNN1.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.7}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % input layer 10 | \node[op] (x5) {$x_5$}; 11 | \node[op, above=2.5pt of x5] (x4) {$x_4$}; 12 | \node[op, above=2.5pt of x4] (x3) {$x_3$}; 13 | \node[op, above=2.5pt of x3] (x2) {$x_2$}; 14 | \node[op, above=2.5pt of x2] (x1) {$x_1$}; 15 | \node[op, below=2.5pt of x5] (x6) {$x_6$}; 16 | \node[op, below=2.5pt of x6] (x7) {$x_7$}; 17 | \node[op, below=2.5pt of x7] (x8) {$x_8$}; 18 | \node[op, below=2.5pt of x8] (x9) {$x_9$}; 19 | \node[op, below=2.5pt of x9] (x10) {$x_{10}$}; 20 | 21 | % hidden layer 22 | \node[op, right=130pt of x5] (v2) {$v_2$}; 23 | \node[op, below=2.5pt of v2] (v3) {$v_3$}; 24 | \node[op, below=2.5pt of v3] (v4) {$v_4$}; 25 | \node[op, above=2.5pt of v2] (v1) {$v_1$}; 26 | 27 | \node[op, right=40pt of v2] (h2) {$h_2$}; 28 | \node[op, below=2.5pt of h2] (h3) {$h_3$}; 29 | \node[op, below=2.5pt of h3] (h4) {$h_4$}; 30 | \node[op, above=2.5pt of h2] (h1) {$h_1$}; 31 | 32 | 33 | % output layer 34 | \node[op, right=60pt of h2] (z1) {$z_1$}; 35 | \node[op, right=60pt of h3] (z2) {$z_2$}; 36 | 37 | \node[op, right=50pt of z1] (y1) {$\hat{y}_1$}; 38 | \node[op, right=50pt of z2] (y2) {$\hat{y}_2$}; 39 | 40 | 41 | % edges input layer to hidden 42 | \path[tedge] (x1) -- (v1); 43 | \path[tedge] (x1) -- (v2); 44 | \path[tedge] (x1) -- (v3); 45 | \path[tedge] (x1) -- (v4); 46 | 47 | \path[tedge] (x2) -- (v1); 48 | \path[tedge] (x2) -- (v2); 49 | \path[tedge] (x2) -- (v3); 50 | \path[tedge] (x2) -- (v4); 51 | 52 | \path[tedge] (x3) -- (v1); 53 | \path[tedge] (x3) -- (v2); 54 | \path[tedge] (x3) -- (v3); 55 | \path[tedge] (x3) -- (v4); 56 | 57 | \path[tedge] (x4) -- (v1); 58 | \path[tedge] (x4) -- (v2); 59 | \path[tedge] (x4) -- (v3); 60 | \path[tedge] (x4) -- (v4); 61 | 62 | \path[tedge] (x5) -- (v1); 63 | \path[tedge] (x5) -- (v2); 64 | \path[tedge] (x5) -- (v3); 65 | \path[tedge] (x5) -- (v4); 66 | 67 | \path[tedge] (x6) -- (v1); 68 | \path[tedge] (x6) -- (v2); 69 | \path[tedge] (x6) -- (v3); 70 | \path[tedge] (x6) -- (v4); 71 | 72 | \path[tedge] (x7) -- (v1); 73 | \path[tedge] (x7) -- (v2); 74 | \path[tedge] (x7) -- (v3); 75 | \path[tedge] (x7) -- (v4); 76 | 77 | \path[tedge] (x8) -- (v1); 78 | \path[tedge] (x8) -- (v2); 79 | \path[tedge] (x8) -- (v3); 80 | \path[tedge] (x8) -- (v4); 81 | 82 | \path[tedge] (x9) -- (v1); 83 | \path[tedge] (x9) -- (v2); 84 | \path[tedge] (x9) -- (v3); 85 | \path[tedge] (x9) -- (v4); 86 | 87 | \path[tedge] (x10) -- (v1); 88 | \path[tedge] (x10) -- (v2); 89 | \path[tedge] (x10) -- (v3); 90 | \path[tedge] (x10) -- (v4); 91 | 92 | % edges hidden to hidden 93 | \path[tedge] (v1) edge node[above=1pt] {{\Large$\sigma$}} (h1) ; 94 | \path[tedge] (v2) edge node[above=1pt] {{\Large$\sigma$}} (h2) ; 95 | \path[tedge] (v3) edge node[above=1pt] {{\Large$\sigma$}} (h3) ; 96 | \path[tedge] (v4) edge node[above=1pt] {{\Large$\sigma$}} (h4) ; 97 | 98 | % edges hidden to output 99 | \path[tedge] (h1) -- (z1); 100 | \path[tedge] (h1) -- (z2); 101 | 102 | \path[tedge] (h2) -- (z1); 103 | \path[tedge] (h2) -- (z2); 104 | 105 | \path[tedge] (h3) -- (z1); 106 | \path[tedge] (h3) -- (z2); 107 | 108 | \path[tedge] (h4) -- (z1); 109 | \path[tedge] (h4) -- (z2); 110 | 111 | % edges output to output 112 | \path[tedge] (z1) edge node[above=1pt] {{\Large softmax}} (y1) ; 113 | \path[tedge] (z2) edge node[above=1pt] {{\Large softmax}} (y2) ; 114 | 115 | 116 | 117 | 118 | \end{tikzpicture} 119 | } % scalebox 120 | \end{figure} 121 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/OldNN2.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.7}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % input layer 10 | \node[op] (x5) {}; 11 | \node[op, above=2.5pt of x5] (x4) {}; 12 | \node[op, above=2.5pt of x4] (x3) {}; 13 | \node[op, above=2.5pt of x3] (x2) {}; 14 | \node[op, above=2.5pt of x2] (x1) {}; 15 | \node[op, below=2.5pt of x5] (x6) {}; 16 | \node[op, below=2.5pt of x6] (x7) {}; 17 | \node[op, below=2.5pt of x7] (x8) {}; 18 | \node[op, below=2.5pt of x8] (x9) {}; 19 | \node[op, below=2.5pt of x9] (x10) {}; 20 | 21 | \node[textonly, above=2.5pt of x1] (x) {{\LARGE$\vect{x}$}}; 22 | \node[textonly, below=4.5pt of x10] (input) {{\large Input layer}}; 23 | 24 | % hidden layer 25 | \node[op, right=130pt of x5] (h2) {}; 26 | \node[op, below=2.5pt of h2] (h3) {}; 27 | \node[op, below=2.5pt of h3] (h4) {}; 28 | \node[op, above=2.5pt of h2] (h1) {}; 29 | 30 | \node[textonly, above=2.5pt of h1] (h) {{\LARGE$\vect{h}$}}; 31 | \node[textonly, below=4.5pt of h4] (hidden) {{\large Hidden layer}}; 32 | 33 | % output layer 34 | \node[op, right=60pt of h2] (y1) {}; 35 | \node[op, right=60pt of h3] (y2) {}; 36 | 37 | \node[textonly, above=2.5pt of y1] (y) {{\LARGE$\hat{\vect{y}}$}}; 38 | \node[textonly, below=4.5pt of y2] (output) {{\large Output layer}}; 39 | 40 | % edges input layer to hidden 41 | \path[tedge] (x1) -- (h1); 42 | \path[tedge] (x1) -- (h2); 43 | \path[tedge] (x1) -- (h3); 44 | \path[tedge] (x1) -- (h4); 45 | 46 | \path[tedge] (x2) -- (h1); 47 | \path[tedge] (x2) -- (h2); 48 | \path[tedge] (x2) -- (h3); 49 | \path[tedge] (x2) -- (h4); 50 | 51 | \path[tedge] (x3) -- (h1); 52 | \path[tedge] (x3) -- (h2); 53 | \path[tedge] (x3) -- (h3); 54 | \path[tedge] (x3) -- (h4); 55 | 56 | \path[tedge] (x4) -- (h1); 57 | \path[tedge] (x4) -- (h2); 58 | \path[tedge] (x4) -- (h3); 59 | \path[tedge] (x4) -- (h4); 60 | 61 | \path[tedge] (x5) -- (h1); 62 | \path[tedge] (x5) -- (h2); 63 | \path[tedge] (x5) -- (h3); 64 | \path[tedge] (x5) -- (h4); 65 | 66 | \path[tedge] (x6) -- (h1); 67 | \path[tedge] (x6) -- (h2); 68 | \path[tedge] (x6) -- (h3); 69 | \path[tedge] (x6) -- (h4); 70 | 71 | \path[tedge] (x7) -- (h1); 72 | \path[tedge] (x7) -- (h2); 73 | \path[tedge] (x7) -- (h3); 74 | \path[tedge] (x7) -- (h4); 75 | 76 | \path[tedge] (x8) -- (h1); 77 | \path[tedge] (x8) -- (h2); 78 | \path[tedge] (x8) -- (h3); 79 | \path[tedge] (x8) -- (h4); 80 | 81 | \path[tedge] (x9) -- (h1); 82 | \path[tedge] (x9) -- (h2); 83 | \path[tedge] (x9) -- (h3); 84 | \path[tedge] (x9) -- (h4); 85 | 86 | \path[tedge] (x10) -- (h1); 87 | \path[tedge] (x10) -- (h2); 88 | \path[tedge] (x10) -- (h3); 89 | \path[tedge] (x10) -- (h4); 90 | 91 | % edges hidden to output 92 | \path[tedge] (h1) -- (y1); 93 | \path[tedge] (h1) -- (y2); 94 | 95 | \path[tedge] (h2) -- (y1); 96 | \path[tedge] (h2) -- (y2); 97 | 98 | \path[tedge] (h3) -- (y1); 99 | \path[tedge] (h3) -- (y2); 100 | 101 | \path[tedge] (h4) -- (y1); 102 | \path[tedge] (h4) -- (y2); 103 | 104 | 105 | 106 | \end{tikzpicture} 107 | } % scalebox 108 | \end{figure} 109 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/OldNN3.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.7}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % input layer 10 | \node[op] (x5) {}; 11 | \node[op, above=2.5pt of x5] (x4) {}; 12 | \node[op, above=2.5pt of x4] (x3) {}; 13 | \node[op, above=2.5pt of x3] (x2) {}; 14 | \node[op, above=2.5pt of x2] (x1) {}; 15 | \node[op, below=2.5pt of x5] (x6) {}; 16 | \node[op, below=2.5pt of x6] (x7) {}; 17 | \node[op, below=2.5pt of x7] (x8) {}; 18 | \node[op, below=2.5pt of x8] (x9) {}; 19 | \node[op, below=2.5pt of x9] (x10) {}; 20 | 21 | \node[textonly, above=2.5pt of x1] (x) {{\LARGE$\vect{x}$}}; 22 | \node[textonly, below=4.5pt of x10] (input) {{\large Input layer}}; 23 | 24 | % hidden layer 25 | \node[op, right=130pt of x5] (h2) {}; 26 | \node[op, below=2.5pt of h2] (h3) {}; 27 | \node[op, below=2.5pt of h3] (h4) {}; 28 | \node[op, above=2.5pt of h2] (h1) {}; 29 | 30 | \node[textonly, above=2.5pt of h1] (h) {{\LARGE$\vect{h}$}}; 31 | \node[textonly, below=4.5pt of h4] (hidden) {{\large Hidden layer}}; 32 | 33 | % output layer 34 | \node[op, right=60pt of h2] (y1) {}; 35 | \node[op, right=60pt of h3] (y2) {}; 36 | 37 | \node[textonly, above=2.5pt of y1] (y) {{\LARGE$\hat{\vect{y}}$}}; 38 | \node[textonly, below=4.5pt of y2] (output) {{\large Output layer}}; 39 | 40 | % edges input layer to hidden 41 | \draw[line width=0.5mm] (x1) -- (hidden); 42 | \draw[line width=0.5mm] (x10) -- (h); 43 | 44 | % edges hidden to output 45 | \draw [line width=0.5mm] (h1) -- (output); 46 | \draw [line width=0.5mm] (h4) -- (y); 47 | 48 | \end{tikzpicture} 49 | } % scalebox 50 | \end{figure} 51 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/ReLU.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.0}{ 5 | \begin{tikzpicture} 6 | \begin{axis}% 7 | [ 8 | grid=major, 9 | xmin=-6, 10 | xmax=6, 11 | axis x line=bottom, 12 | ytick={0}, 13 | ymax=10, 14 | axis y line=middle, 15 | ] 16 | \addplot% 17 | [ orange!180, 18 | ultra thick, 19 | % blue,% 20 | mark=none, 21 | samples=100, 22 | domain=-6:6, 23 | ] 24 | (x,{max(x,0)}); 25 | \end{axis} 26 | \node[textonly] (relu) at (8.95,2.8) {{\Large$g(x) = max\{0,x\}$}}; 27 | \end{tikzpicture} 28 | } % scalebox 29 | \end{figure} -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/Sigmoid.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.0}{ 5 | \begin{tikzpicture} 6 | \begin{axis}% 7 | [ 8 | grid=major, 9 | xmin=-6, 10 | xmax=6, 11 | axis x line=bottom, 12 | ytick={0,.5,1}, 13 | ymax=1, 14 | axis y line=middle, 15 | ] 16 | \addplot% 17 | [ orange!180, 18 | ultra thick, 19 | % blue,% 20 | mark=none, 21 | samples=100, 22 | domain=-6:6, 23 | ] 24 | (x,{1/(1+exp(-x))}); 25 | \end{axis} 26 | \node[textonly] (sigmoid) at (8.75,2.8) {{\Large$\sigma(x) = \frac{1}{1 + e^{-x}}$}}; 27 | \end{tikzpicture} 28 | } % scalebox 29 | \end{figure} -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/Softmax.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.3}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % nodes 10 | \node[textonly] (logits) {$\begin{bmatrix}3.82\\5.35\\1.44\\-1.26\\2.71 \\1.98\end{bmatrix}$}; 11 | \node[textonly, right=60pt of logits] (softmax) {$\begin{bmatrix}0.16115195\\0.74422819\\0.01491471\\0.00100235\\0.05310907 \\0.02559374\end{bmatrix}$}; 12 | \node[textonly, below=15pt of logits] (inv1) {}; 13 | \node[textonly, right=10pt of inv1] (softmax_eq) {{\Large$softmax(x) = \frac{e^{x}}{\sum e^{x}}$}}; 14 | 15 | 16 | 17 | % edges 18 | \path[tedge] (logits) edge node[above=1pt] {{\Large softmax}} (softmax); 19 | \end{tikzpicture} 20 | } % scalebox 21 | \end{figure} 22 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/b1_path2_grad.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.7}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % multiplication 10 | \node[op] (z1) {$z_1$}; 11 | \node[op, above left=25pt and 20pt of z1] (b1) {$b_1$}; 12 | 13 | % exp 14 | \node[op, right=25pt of z1] (exp1) {$h_1$}; 15 | \node[op, right=25pt of exp1] (H) {$H$}; 16 | \node[op, right=35pt of H] (div1) {$\hat{y}_1$}; 17 | 18 | % log 19 | \node[op, right=25pt of div1] (log1) {$\log$}; 20 | \node[op, right=25pt of log1] (mult5) {$*$}; 21 | \node[placeholder, below left=25pt and 10pt of mult5] (y1) {$y_1$}; 22 | \node[op, right=25pt of mult5] (sum6) {$+$}; 23 | \node[op, right=25pt of sum6] (minus1) {$*-1$}; 24 | \node[textonly, below left=55pt and 10pt of sum6] (dots) {{\LARGE$\dots$}}; 25 | 26 | %gradients 1 27 | \node[gradient, above=10pt of sum6] (dsum6) {$-1$}; 28 | \node[gradient, above=10pt of mult5] (dmult5) {$1$}; 29 | \node[gradient, above=10pt of log1] (dlog1) {$y_1$}; 30 | \node[gradient, above=10pt of div1] (ddiv1) {$\frac{H}{h_1}$}; 31 | \node[gradient, above=10pt of H] (dH) {$-\frac{h_1}{H^2}$}; 32 | \node[gradient, above=10pt of exp1] (dexp1) {$1$}; 33 | \node[gradient, above=10pt of z1] (dz1) {$h_1$}; 34 | \node[gradient, above=10pt of b1] (db1) {$1$}; 35 | 36 | %gradients 2 37 | \node[gradient2, above left=30pt and 10pt of dsum6] (dLdmult5) {$-1$}; 38 | \node[gradient2, left=25pt of dLdmult5] (dLlog1) {$-y_1$}; 39 | \node[gradient2, left=25pt of dLlog1] (dLdiv1) {$-y_1\frac{H}{h_1}$}; 40 | \node[gradient2, left=25pt of dLdiv1] (dLdH) {$\frac{y_1}{H}$}; 41 | \node[gradient2, left=25pt of dLdH] (dLdexp1) {$\frac{y_1}{H}$}; 42 | \node[gradient2, left=25pt of dLdexp1] (dLdz1) {$y_1\frac{h_1}{H}$}; 43 | \node[gradient2, above=35pt of db1] (dLdb1) {$y_1\frac{h_1}{H}$}; 44 | 45 | %edges 46 | \path[tedge] (b1) -- (z1); 47 | \path[tedge] (z1) -- (exp1); 48 | \path[tedge] (exp1) -- (H); 49 | \path[tedge] (H) -- (div1); 50 | 51 | \path[tedge] (div1) -- (log1); 52 | \path[tedge] (log1) -- (mult5); 53 | \path[tedge] (y1) -- (mult5); 54 | \path[tedge] (mult5) -- (sum6); 55 | \path[tedge] (dots) -- (sum6); 56 | \path[tedge] (sum6) -- (minus1); 57 | 58 | %edges gradient 1 59 | \path[tedge] (b1) -- (db1); 60 | \path[tedge] (z1) -- (dz1); 61 | \path[tedge] (exp1) -- (dexp1); 62 | \path[tedge] (div1) -- (ddiv1); 63 | \path[tedge] (H) -- (dH); 64 | \path[tedge] (log1) -- (dlog1); 65 | \path[tedge] (mult5) -- (dmult5); 66 | \path[tedge] (sum6) -- (dsum6); 67 | 68 | %edges gradient 2 69 | \path[tedge] (dsum6) -- (dLdmult5); 70 | \path[tedge] (dmult5) -- (dLdmult5); 71 | \path[tedge] (dLdmult5) -- (dLlog1); 72 | \path[tedge] (dlog1) -- (dLlog1); 73 | \path[tedge] (ddiv1) -- (dLdiv1); 74 | \path[tedge] (dLlog1) -- (dLdiv1); 75 | \path[tedge] (dexp1) -- (dLdexp1); 76 | \path[tedge] (dH) -- (dLdH); 77 | \path[tedge] (dLdiv1) -- (dLdH); 78 | \path[tedge] (dLdH) -- (dLdexp1); 79 | \path[tedge] (dz1) -- (dLdz1); 80 | \path[tedge] (dLdexp1) -- (dLdz1); 81 | \path[tedge] (db1) -- (dLdb1); 82 | \path[tedge] (dLdz1) -- (dLdb1); 83 | 84 | 85 | \end{tikzpicture} 86 | } % scalebox 87 | \end{figure} 88 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/batch_example_values.tex: -------------------------------------------------------------------------------- 1 | {\large\textbf{batch\_size = 3} 2 | }\begin{figure}[ht!] 3 | \centering 4 | 5 | \scalebox{1.3}{ 6 | \begin{tikzpicture}[auto] 7 | 8 | % operations ============================= 9 | 10 | % nodes 11 | \node[textonly] (x1) {$\begin{bmatrix}0.2\\0.7\end{bmatrix}$}; 12 | \node[textonly, below=30pt of x1] (y1) {$\begin{bmatrix}1\\0\end{bmatrix}$}; 13 | \node[textonly, right=10pt of x1] (x2) {$\begin{bmatrix}0.8\\0.1\end{bmatrix}$}; 14 | \node[textonly, below=30pt of x2] (y2) {$\begin{bmatrix}0\\1\end{bmatrix}$}; 15 | \node[textonly, right=10pt of x2] (x3) {$\begin{bmatrix}0.3\\0.5\end{bmatrix}$}; 16 | \node[textonly, below=30pt of x3] (y3) {$\begin{bmatrix}1\\0\end{bmatrix}$}; 17 | 18 | 19 | \node[textonly, above=1pt of x1] (x1name) {$\vect{x}_1$}; 20 | \node[textonly, above=1pt of y1] (y1name) {$\vect{y}_1$}; 21 | \node[textonly, above=1pt of x2] (x2name) {$\vect{x}_2$}; 22 | \node[textonly, above=1pt of y2] (y2name) {$\vect{y}_2$}; 23 | \node[textonly, above=1pt of x3] (x3name) {$\vect{x}_3$}; 24 | \node[textonly, above=1pt of y3] (y3name) {$\vect{y}_3$}; 25 | 26 | 27 | \end{tikzpicture} 28 | } % scalebox 29 | \end{figure} -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/batch_graph.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.8}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | \begin{scope}[xshift=0cm,yshift=0cm] 10 | \begin{scope}[xshift=0cm,yshift=0cm] 11 | \node[placeholder] (x1) at (1,3.5) {$\begin{bmatrix}0.3\\0.5\end{bmatrix}$}; 12 | \end{scope} 13 | \begin{scope}[xshift=-0.6cm,yshift=-0.6cm] 14 | \node[placeholder] (x2) at (1,3.5) {$\begin{bmatrix}0.8\\0.1\end{bmatrix}$}; 15 | \end{scope} 16 | \begin{scope}[xshift=-1.2cm,yshift=-1.2cm] 17 | \node[placeholder] (x3) at (1,3.5) {$\begin{bmatrix}0.2\\0.7\end{bmatrix}$}; 18 | \end{scope} 19 | \end{scope} 20 | 21 | \begin{scope}[xshift=0cm,yshift=0cm] 22 | \begin{scope}[xshift=0cm,yshift=0cm] 23 | \node[placeholder] (y1) at (1,1) {$\begin{bmatrix}1\\0\end{bmatrix}$}; 24 | \end{scope} 25 | \begin{scope}[xshift=-0.6cm,yshift=-0.6cm] 26 | \node[placeholder] (y2) at (1,1) {$\begin{bmatrix}0\\1\end{bmatrix}$}; 27 | \end{scope} 28 | \begin{scope}[xshift=-1.2cm,yshift=-1.2cm] 29 | \node[placeholder] (y3) at (1,1) {$\begin{bmatrix}1\\0\end{bmatrix}$}; 30 | \end{scope} 31 | \end{scope} 32 | 33 | \begin{scope}[xshift=0cm,yshift=0cm] 34 | \begin{scope}[xshift=0cm,yshift=0cm] 35 | \node[op] (df1) at (7,1) {\large{L}}; 36 | \end{scope} 37 | \begin{scope}[xshift=-0.4cm,yshift=-0.4cm] 38 | \node[op] (df2) at (7,1) {\large{L}}; 39 | \end{scope} 40 | \begin{scope}[xshift=-0.8cm,yshift=-0.8cm] 41 | \node[op] (df3) at (7,1) {\large{L}}; 42 | \end{scope} 43 | \end{scope} 44 | 45 | 46 | \begin{scope}[xshift=0cm,yshift=0cm] 47 | \begin{scope}[xshift=0cm,yshift=0cm] 48 | \node[gradient2] (grad1) at (12,1) {$-0.26$}; 49 | \end{scope} 50 | \begin{scope}[xshift=-0.6cm,yshift=-0.6cm] 51 | \node[gradient2] (grad2) at (12,1) {$0.54$}; 52 | \end{scope} 53 | \begin{scope}[xshift=-1.2cm,yshift=-1.2cm] 54 | \node[gradient2] (grad3) at (12,1) {$-0.19$}; 55 | \end{scope} 56 | \end{scope} 57 | 58 | 59 | \node[textonly, right=10pt of x2] (inv1) {}; 60 | \node[textonly, right=10pt of y2] (inv2) {}; 61 | \node[textonly, left=10pt of df2] (inv3) {}; 62 | \node[textonly, right=10pt of df2] (inv4) {}; 63 | \node[textonly, left=10pt of grad2] (inv5) {}; 64 | 65 | %edges 66 | \path[tedge, orange!120, line width=1.5mm] (inv1) -- (inv3); 67 | \path[tedge, orange!120, line width=1.5mm] (inv2) -- (inv3); 68 | \path[tedge, green2!120, line width=1.5mm] (inv4) -- (inv5); 69 | 70 | \end{tikzpicture} 71 | } % scalebox 72 | \end{figure} -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/chain_rule_nodes.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.8}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | \node[op] (nt) {$n_t$}; 9 | \node[op, above left=50pt of nt] (a) {$n^{a}_{t-1}$}; 10 | \node[op, below left=40pt of nt] (b) {$n^{b}_{t-1}$}; 11 | \node[op, right=40pt of nt] (ntp) {$n_{t+1}$}; 12 | \node[textonly, right=20pt of ntp] (ntpp) {$\dots$}; 13 | \node[gradient, above=15pt of a] (da) {$\frac{\partial n_{t}}{\partial n^{a}_{t-1}}$}; 14 | \node[gradient, above=15pt of nt] (dnt) {$\frac{\partial n_{t+1}}{\partial n_{t}}$}; 15 | \node[gradient2, above=15pt of ntp] (dntp) {$\frac{\partial L}{\partial n_{t+1}}$}; 16 | \node[gradient2, above=15pt of dnt] (ddnt) {$\frac{\partial L}{\partial n_{t}}$}; 17 | \node[gradient2, above left=50pt of ddnt] (dda) {$\frac{\partial L}{\partial n^{a}_{t-1}}$}; 18 | 19 | % edges ============================= 20 | \path[tedge] (a) -- (nt); 21 | \path[tedge] (b) -- (nt); 22 | \path[tedge] (nt) -- (ntp); 23 | \path[tedge] (nt) -- (dnt); 24 | \path[tedge] (ntp) -- (ntpp); 25 | \path[tedge] (ntp) -- (dntp); 26 | \path[tedge] (a) -- (da); 27 | \path[tedge] (dnt) -- (ddnt); 28 | \path[tedge] (dntp) -- (ddnt); 29 | \path[tedge] (da) -- (dda); 30 | \path[tedge] (ddnt) -- (dda); 31 | 32 | 33 | \end{tikzpicture} 34 | } % scalebox 35 | \end{figure} 36 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/div.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.2}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | \node[op] (times) {$div$}; 9 | \node[op, above left=20pt of times] (a) {$a$}; 10 | \node[op, below left=20pt of times] (b) {$b$}; 11 | \node[gradient, above=15pt of a] (da) {$\frac{\partial f}{\partial a}$}; 12 | \node[gradient, below=15pt of b] (db) {$\frac{\partial f}{\partial b}$}; 13 | \node[textonly, right=0.1pt of da] {$=\frac{1}{b}$}; 14 | \node[textonly, right=0.1pt of db] {$=\frac{-a}{b^{2}}$}; 15 | \node[textonly, right=0.1pt of times] {$=f(a,b) =\frac{a}{b}$}; 16 | 17 | % edges 18 | \path[tedge] (a) -- (times); 19 | \path[tedge] (b) -- (times); 20 | \path[tedge] (a) -- (da); 21 | \path[tedge] (b) -- (db); 22 | 23 | 24 | \end{tikzpicture} 25 | } % scalebox 26 | \end{figure} 27 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/examples_values.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.3}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % nodes 10 | \node[textonly] (W) {$\begin{bmatrix}0.65 & 1.19\\0.69 & -0.92\end{bmatrix}$}; 11 | \node[textonly, right=40pt of W] (x) {$\begin{bmatrix}0.2\\0.7\end{bmatrix}$}; 12 | \node[textonly, below=30pt of W] (b) {$\begin{bmatrix}0\\0\end{bmatrix}$}; 13 | \node[textonly, below=30pt of x] (y) {$\begin{bmatrix}1\\0\end{bmatrix}$}; 14 | \node[textonly, left=1pt of W] (Wname) {$\vect{W}=$}; 15 | \node[textonly, left=1pt of x] (xname) {$\vect{x}=$}; 16 | \node[textonly, left=1pt of b] (bname) {$\vect{b}=$}; 17 | \node[textonly, left=1pt of y] (yname) {$\vect{y}=$}; 18 | 19 | 20 | \end{tikzpicture} 21 | } % scalebox 22 | \end{figure} 23 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/exp.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.5}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | \node[op] (times) {$exp$}; 9 | \node[op, left=20pt of times] (a) {$a$}; 10 | \node[gradient, above=30pt of a] (da) {$\frac{df}{da}$}; 11 | \node[textonly, right=0.1pt of da] {$=e^{a}$}; 12 | \node[textonly, right=0.1pt of times] {$=f(a) = e^{a}$}; 13 | 14 | % edges 15 | \path[tedge] (a) -- (times); 16 | \path[tedge] (a) -- (da); 17 | 18 | \end{tikzpicture} 19 | } % scalebox 20 | \end{figure} 21 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/expanded_graph_0.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.6}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % input x and W 10 | \node[op] (w11) {$w_{11}$}; 11 | \node[placeholder, below=10pt of w11] (x1) {$x_{1}$}; 12 | \node[op, below=20pt of x1] (w12) {$w_{12}$}; 13 | \node[placeholder, below=10pt of w12] (x2) {$x_{2}$}; 14 | 15 | \node[op, below=20pt of x2] (w21) {$w_{21}$}; 16 | \node[placeholder, below=10pt of w21] (x11) {$x_{1}$}; 17 | \node[op, below=20pt of x11] (w22) {$w_{22}$}; 18 | \node[placeholder, below=10pt of w22] (x22) {$x_{2}$}; 19 | 20 | % multiplication 21 | \node[op, below right=1pt and 20pt of w11] (mult1) {$*$}; 22 | \node[op, below right=1pt and 20pt of w12] (mult2) {$*$}; 23 | \node[op, below right=1pt and 20pt of w21] (mult3) {$*$}; 24 | \node[op, below right=1pt and 20pt of w22] (mult4) {$*$}; 25 | 26 | % sum 27 | \node[op, below right=25pt and 20pt of mult1] (sum1) {$+$}; 28 | \node[op, below right=25pt and 20pt of mult3] (sum2) {$+$}; 29 | \node[op, right=25pt of sum1] (sum3) {$z_1$}; 30 | \node[op, right=25pt of sum2] (sum4) {$z_2$}; 31 | \node[op, above left=25pt and 10pt of sum3] (b1) {$b_1$}; 32 | \node[op, below left=25pt and 10pt of sum4] (b2) {$b_2$}; 33 | 34 | % exp 35 | \node[op, right=25pt of sum3] (exp1) {$h_1$}; 36 | \node[op, right=25pt of sum4] (exp2) {$h_2$}; 37 | \node[op, below right=65pt and 15pt of exp1] (sum5) {$H$}; 38 | \node[op, right=35pt of exp1] (div1) {$\hat{y}_1$}; 39 | \node[op, right=35pt of exp2] (div2) {$\hat{y}_2$}; 40 | 41 | % log 42 | \node[op, right=25pt of div1] (log1) {$\log$}; 43 | \node[op, right=25pt of div2] (log2) {$\log$}; 44 | \node[op, right=25pt of log1] (mult5) {$*$}; 45 | \node[op, right=25pt of log2] (mult6) {$*$}; 46 | \node[placeholder, above left=25pt and 10pt of mult5] (y1) {$y_1$}; 47 | \node[placeholder, below left=25pt and 10pt of mult6] (y2) {$y_2$}; 48 | \node[op, below right=65pt and 15pt of mult5] (sum6) {$+$}; 49 | \node[op, right=25pt of sum6] (minus1) {$*-1$}; 50 | 51 | 52 | 53 | %edges 54 | \path[tedge] (w11) -- (mult1); 55 | \path[tedge] (x1) -- (mult1); 56 | \path[tedge] (w12) -- (mult2); 57 | \path[tedge] (x2) -- (mult2); 58 | \path[tedge] (w21) -- (mult3); 59 | \path[tedge] (x11) -- (mult3); 60 | \path[tedge] (w22) -- (mult4); 61 | \path[tedge] (x22) -- (mult4); 62 | 63 | \path[tedge] (mult1) -- (sum1); 64 | \path[tedge] (mult2) -- (sum1); 65 | \path[tedge] (mult3) -- (sum2); 66 | \path[tedge] (mult4) -- (sum2); 67 | \path[tedge] (sum1) -- (sum3); 68 | \path[tedge] (b1) -- (sum3); 69 | \path[tedge] (sum2) -- (sum4); 70 | \path[tedge] (b2) -- (sum4); 71 | 72 | \path[tedge] (sum3) -- (exp1); 73 | \path[tedge] (sum4) -- (exp2); 74 | \path[tedge] (exp1) -- (sum5); 75 | \path[tedge] (exp2) -- (sum5); 76 | \path[tedge] (exp1) -- (div1); 77 | \path[tedge] (exp2) -- (div2); 78 | \path[tedge] (sum5) -- (div1); 79 | \path[tedge] (sum5) -- (div2); 80 | 81 | 82 | \path[tedge] (div1) -- (log1); 83 | \path[tedge] (div2) -- (log2); 84 | \path[tedge] (log1) -- (mult5); 85 | \path[tedge] (y1) -- (mult5); 86 | \path[tedge] (log2) -- (mult6); 87 | \path[tedge] (y2) -- (mult6); 88 | \path[tedge] (mult5) -- (sum6); 89 | \path[tedge] (mult6) -- (sum6); 90 | \path[tedge] (sum6) -- (minus1); 91 | 92 | \end{tikzpicture} 93 | } % scalebox 94 | \end{figure} 95 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/fashionMNIST.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.05}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % nodes 10 | \node (shirt) 11 | {\includegraphics[width=.15\textwidth]{images/shirt.png}}; 12 | \node[textonly, below=1pt of shirt] (dimension0) {{\small$28\times 28$}}; 13 | \node[textonly, above right= 10pt and 90pt of shirt] (vector) {$\begin{bmatrix}0.34\\ \vdots \\0.06\end{bmatrix}$}; 14 | \node[textonly, above=1pt of vector] (x) {$\vect{x}$}; 15 | \node[textonly, below=1pt of vector] (dimension1) {{\small$784\times 1$}}; 16 | 17 | \node[textonly, below=30pt of vector] (y) {$y=1$}; 18 | 19 | \node[textonly, below=30pt of y] (one-hot) {$\begin{bmatrix}1\\ \vdots \\0\end{bmatrix}$}; 20 | 21 | \node[textonly, above=1pt of one-hot] (yvector) {$\vect{y}$}; 22 | \node[textonly, below=1pt of one-hot] (dimension2) {{\small$10\times 1$}}; 23 | 24 | 25 | 26 | % edges 27 | \path[tedge, orange!120, line width=1mm] (shirt) -- (vector); 28 | \path[tedge, orange!120, line width=1mm] (shirt) -- (y); 29 | \path[tedge, orange!120, line width=1mm] (shirt) -- (one-hot); 30 | 31 | 32 | 33 | \end{tikzpicture} 34 | } % scalebox 35 | \end{figure} 36 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/feature_map.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.7}{ 5 | \begin{tikzpicture}[scale=1.4,every node/.style={minimum size=1cm}, on grid] 6 | \draw[fill=cyan,opacity=1.2] (0,0) rectangle (3,3); 7 | \draw[draw=base03,thick] (0,0) grid (3,3); 8 | \node (00) at (0.5,2.5) {\large 12.0}; 9 | \node (01) at (1.5,2.5) {\large 12.0}; 10 | \node (02) at (2.5,2.5) {\large 17.0}; 11 | \node (10) at (0.5,1.5) {\large 10.0}; 12 | \node (11) at (1.5,1.5) {\large 17.0}; 13 | \node (12) at (2.5,1.5) {\large 19.0}; 14 | \node (20) at (0.5,0.5) {\large 9.0}; 15 | \node (21) at (1.5,0.5) {\large 6.0}; 16 | \node (22) at (2.5,0.5) {\large 14.0}; 17 | \end{tikzpicture} 18 | } % scalebox 19 | \end{figure} 20 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/log.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.5}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | \node[op] (times) {$\log$}; 9 | \node[op, left=20pt of times] (a) {$a$}; 10 | \node[gradient, above=30pt of a] (da) {$\frac{df}{da}$}; 11 | \node[textonly, right=0.1pt of da] {$=\frac{1}{a}$}; 12 | \node[textonly, right=0.1pt of times] {$=f(a)=\log(a)$}; 13 | 14 | % edges 15 | \path[tedge] (a) -- (times); 16 | \path[tedge] (a) -- (da); 17 | 18 | \end{tikzpicture} 19 | } % scalebox 20 | \end{figure} 21 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/minus1.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.5}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | \node[op] (times) {$*-1$}; 9 | \node[op, left=20pt of times] (a) {$a$}; 10 | \node[gradient, above=30pt of a] (da) {$\frac{df}{da}$}; 11 | \node[textonly, right=0.1pt of da] {$=-1$}; 12 | \node[textonly, right=0.1pt of times] {$=f(a) =-a$}; 13 | 14 | % edges 15 | \path[tedge] (a) -- (times); 16 | \path[tedge] (a) -- (da); 17 | 18 | \end{tikzpicture} 19 | } % scalebox 20 | \end{figure} 21 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/mult.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.2}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | \node[op] (times) {$\times$}; 9 | \node[op, above left=20pt of times] (a) {$a$}; 10 | \node[op, below left=20pt of times] (b) {$b$}; 11 | \node[gradient, above=15pt of a] (da) {$\frac{\partial f}{\partial a}$}; 12 | \node[gradient, below=15pt of b] (db) {$\frac{\partial f}{\partial b}$}; 13 | \node[textonly, right=0.1pt of da] {$=b$}; 14 | \node[textonly, right=0.1pt of db] {$=a$}; 15 | \node[textonly, right=0.1pt of times] {$=f(a,b) =a*b$}; 16 | 17 | % edges 18 | \path[tedge] (a) -- (times); 19 | \path[tedge] (b) -- (times); 20 | \path[tedge] (a) -- (da); 21 | \path[tedge] (b) -- (db); 22 | 23 | 24 | \end{tikzpicture} 25 | } % scalebox 26 | \end{figure} 27 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/multiple_paths.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.2}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | \node[op] (div) {$div$}; 9 | \node[textonly, right=0.1pt of div] {$=f(x,y)=\frac{x}{y}=\frac{a*c}{a+b}$}; 10 | \node[op, above left=20pt of div] (mult) {$*$}; 11 | \node[op, below left=20pt of div] (plus) {$+$}; 12 | \node[op, below=20pt of plus] (b2) {$b$}; 13 | \node[op, above=20pt of mult] (b1) {$c$}; 14 | \node[op, left=55pt of div] (a) {$a$}; 15 | \node[textonly, above right=5pt and 5pt of div] (inv1) {$\frac{\partial f}{\partial x} \frac{\partial x}{\partial a}$}; 16 | \node[textonly, above left=2pt and 2pt of a] (inv2) {}; 17 | \node[textonly, below right=5pt and 5pt of div] (inv3) {$\frac{\partial f}{\partial y} \frac{\partial y}{\partial a}$}; 18 | \node[textonly, below left=2pt and 2pt of a] (inv4) {}; 19 | 20 | 21 | % edges 22 | \path[tedge] (a) -- (mult); 23 | \path[tedge] (b1) -- (mult); 24 | \path[tedge] (a) -- (plus); 25 | \path[tedge] (b2) -- (plus); 26 | \path[tedge] (plus) -- (div); 27 | \path[tedge] (mult) -- (div); 28 | \path[tedge, nephritis!60, line width=1mm] (inv1) to [out=120,in=80] (inv2); 29 | \path[tedge, nephritis!60, line width=1mm] (inv3) to [out=-120,in=-80] (inv4); 30 | 31 | 32 | 33 | \end{tikzpicture} 34 | } % scalebox 35 | \end{figure} 36 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/perceptron.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.15}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | \node[op] (x2) {$x_2$}; 9 | \node[op, above=40pt of x2] (x1) {$x_1$}; 10 | \node[op, below=40pt of x2] (x3) {$x_3$}; 11 | \node[op, right=60pt of x2] (vk) {$v$}; 12 | \node[op, right=40pt of vk] (yk) {$\hat{y}$}; 13 | \node[textonly, below right=20pt of x3] (Synaptic) {Synaptic link}; 14 | \node[textonly, below right=50pt of vk] (Activation) {Activation link}; 15 | \node[textonly, above right=28pt and -46pt of yk] (f) {$\hat{y} = f(\vect{x};\vect{\theta})= g\left(\sum_{i=1}^{3} \theta_ix_i\right)$}; 16 | 17 | 18 | % edges 19 | \path[tedge] (x1) edge node[above=1.8pt] {$\theta_{1}$} (vk); 20 | \path[tedge] (x2) edge node[above=0.2pt] {$\theta_{2}$} (vk); 21 | \path[tedge] (x3) edge node[above=3.8pt] {$\theta_{3}$} (vk); 22 | \path[tedge] (vk) edge node[above=1pt] {{\Large$g$}} (yk) ; 23 | 24 | % info edges 25 | \draw[orange!120, line width=1mm] (Synaptic) to [out=150,in=0] (x3); 26 | \draw[orange!120, line width=1mm] (Synaptic) to [out=150,in=-100] (vk); 27 | 28 | \draw[orange!120, line width=1mm] (Activation) to [out=170,in=-40] (vk); 29 | \draw[orange!120, line width=1mm] (Activation) to [out=170,in=-100] (yk); 30 | 31 | 32 | 33 | \end{tikzpicture} 34 | } % scalebox 35 | \end{figure} 36 | -------------------------------------------------------------------------------- /NeuralNetworks/src/TikzFiles/soma.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.2}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | \node[op] (times) {$+$}; 9 | \node[op, above left=20pt of times] (a) {$a$}; 10 | \node[op, below left=20pt of times] (b) {$b$}; 11 | \node[gradient, above=15pt of a] (da) {$\frac{\partial f}{\partial a}$}; 12 | \node[gradient, below=15pt of b] (db) {$\frac{\partial f}{\partial b}$}; 13 | \node[textonly, right=0.1pt of da] {$=1$}; 14 | \node[textonly, right=0.1pt of db] {$=1$}; 15 | \node[textonly, right=0.1pt of times] {$=f(a,b) = a+b$}; 16 | 17 | % edges 18 | \path[tedge] (a) -- (times); 19 | \path[tedge] (b) -- (times); 20 | \path[tedge] (a) -- (da); 21 | \path[tedge] (b) -- (db); 22 | 23 | 24 | \end{tikzpicture} 25 | } % scalebox 26 | \end{figure} 27 | -------------------------------------------------------------------------------- /NeuralNetworks/src/all_imports.tex: -------------------------------------------------------------------------------- 1 | \usepackage{lmodern} 2 | \usepackage[utf8]{inputenc} 3 | \usepackage[T1]{fontenc} 4 | \usepackage{appendixnumberbeamer} 5 | \usepackage{hyperref} 6 | \usepackage{booktabs} 7 | \usepackage{bm} 8 | \usepackage[scale=2]{ccicons} 9 | \usepackage[outputdir=build]{minted} 10 | \usepackage{pgfplots} 11 | \usepackage{array,colortbl,xcolor} 12 | \usepgfplotslibrary{dateplot} 13 | \usepackage{setspace} 14 | \usepackage{etoolbox} 15 | \usepackage{xspace} 16 | \usepackage{tikz} 17 | \usetikzlibrary{shapes,arrows,positioning,fit,backgrounds} 18 | \usepackage{tkz-euclide} 19 | 20 | \AtBeginEnvironment{quote}{\singlespacing} 21 | -------------------------------------------------------------------------------- /NeuralNetworks/src/all_new_commands.tex: -------------------------------------------------------------------------------- 1 | \newcommand{\themename}{\textbf{\textsc{metropolis}}\xspace} 2 | \newcommand{\vect}[1]{\bm{#1}} 3 | \newcommand{\myprime}[1]{{#1}^{\prime}} 4 | \newcommand{\grad}[2]{\nabla_{#1} {#2}} 5 | \newcommand{\dotp}[2]{{#1}^{\top}{#2}} 6 | \newcommand{\dotpPright}[2]{{#1}^{\top}\left({#2}\right)} 7 | \newcommand{\outerp}[2]{\left({#1}\right){#2}^{\top}} 8 | \newcommand{\Jacobian}[2]{\frac{\partial #1}{\partial #2}} 9 | \newcommand{\Vocab}{\mathbb{V}} 10 | \DeclareMathOperator*{\argmin}{arg\,min} 11 | \DeclareMathOperator*{\argmax}{arg\,max} 12 | \DeclareMathOperator{\E}{\mathbb{E}} -------------------------------------------------------------------------------- /NeuralNetworks/src/definitions/colors.tex: -------------------------------------------------------------------------------- 1 | \definecolor{blue}{RGB}{159, 192, 176} 2 | \definecolor{blue2}{RGB}{38,139,210} 3 | \definecolor{green}{RGB}{160, 227, 127} 4 | \definecolor{green2}{RGB}{132, 164, 76} 5 | \definecolor{orange}{RGB}{243, 188, 125} 6 | \definecolor{red}{RGB}{253, 123, 84} 7 | \definecolor{nephritis}{RGB}{39, 174, 96} 8 | \definecolor{emerald}{RGB}{46, 204, 113} 9 | \definecolor{turquoise}{RGB}{39, 174, 96} 10 | \definecolor{green-sea}{RGB}{22, 160, 133} 11 | \definecolor{base02}{RGB}{7,54,66} 12 | \definecolor{base03}{RGB}{0,43,54} 13 | \definecolor{cyan}{RGB}{42,161,152} 14 | -------------------------------------------------------------------------------- /NeuralNetworks/src/definitions/styles.tex: -------------------------------------------------------------------------------- 1 | % Tikzstyles for Computation Graphs 2 | 3 | % nodes 4 | \tikzstyle{noop} = [circle, draw=none, fill=red, minimum size = 10pt] 5 | \tikzstyle{op} = [circle, draw=red, line width=1.5pt, fill=red!70, text=black, text centered, font=\bf \normalsize, minimum size = 25pt] 6 | \tikzstyle{op2} = [circle, draw=orange, line width=1.5pt, fill=orange!70, text=black, text centered, font=\bf \normalsize, minimum size = 25pt] 7 | \tikzstyle{op3} = [circle, draw=orange, line width=1.5pt, fill=orange!70, text=black, text centered, font=\bf \scriptsize, minimum size = 7pt] 8 | \tikzstyle{placeholder} = [circle, draw=red, line width=1.5pt, fill=red!30, text=black, text centered, font=\bf \normalsize, minimum size = 25pt] 9 | \tikzstyle{state} = [circle, draw=blue, line width=1.5pt, fill=blue!70, text=black, text centered, font=\bf \normalsize, minimum size = 25pt] 10 | \tikzstyle{gradient} = [circle, draw=nephritis, line width=1.5pt, fill=nephritis!60, text=black, text centered, font=\bf \normalsize, minimum size = 25pt] 11 | \tikzstyle{gradient2} = [circle, draw=green2, line width=1.5pt, fill=green2!60, text=black, text centered, font=\bf \normalsize, minimum size = 25pt] 12 | \tikzstyle{textonly} = [draw=none, fill=none, text centered, font=\bf \normalsize] 13 | 14 | % edges 15 | % \tikzstyle{tedge} = [draw, thick, >=stealth, ->] 16 | \tikzstyle{tedge} = [draw, thick, >=latex, ->] 17 | \tikzstyle{tedge_dashed} = [draw, thick, >=latex, ->, dashed] 18 | 19 | % namedscope 20 | \tikzstyle{namedscope} = [circle, draw=orange, line width=1.5pt, fill=orange!60, align=center, inner sep=0pt] 21 | 22 | % \tikzstyle{container} = [draw=none, rectangle, dotted, inner ysep=1.5em] 23 | % \tikzstyle{novertex} = [draw=none, fill=none, text centered] 24 | % \tikzstyle{predicate} = [ellipse, draw, thick, text centered, rounded corners, minimum size=30pt] 25 | % \tikzstyle{aux} = [rectangle, draw, thick, text centered, rounded corners, minimum size=30pt] 26 | % \tikzstyle{ledge} = [draw, dashed, thick, >=stealth, ->] 27 | % \tikzstyle{pedge} = [draw, thick, >=stealth, ->] 28 | 29 | -------------------------------------------------------------------------------- /NeuralNetworks/src/header.tex: -------------------------------------------------------------------------------- 1 | \title{Primeiros passos de Deep Learning em Python} 2 | \date{\today} 3 | 4 | \author{ 5 | Antonio Abello\\ 6 | \url{https://github.com/Abello966}\\\vspace{0.4 cm} 7 | \and\\ 8 | Felipe Salvatore\\ 9 | \url{https://felipessalvatore.github.io/} 10 | \vspace{0.4 cm} 11 | } 12 | 13 | \institute{\textbf{IME-USP}: Instituto de Matemática e Estatística, Universidade de São Paulo} 14 | -------------------------------------------------------------------------------- /NeuralNetworks/src/images/Vd-Blur1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/NeuralNetworks/src/images/Vd-Blur1.png -------------------------------------------------------------------------------- /NeuralNetworks/src/images/Vd-Edge3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/NeuralNetworks/src/images/Vd-Edge3.png -------------------------------------------------------------------------------- /NeuralNetworks/src/images/Vd-Orig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/NeuralNetworks/src/images/Vd-Orig.png -------------------------------------------------------------------------------- /NeuralNetworks/src/images/Vd-Sharp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/NeuralNetworks/src/images/Vd-Sharp.png -------------------------------------------------------------------------------- /NeuralNetworks/src/images/shirt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/NeuralNetworks/src/images/shirt.png -------------------------------------------------------------------------------- /NeuralNetworks/src/main.tex: -------------------------------------------------------------------------------- 1 | \documentclass[10pt]{beamer} 2 | \usetheme{metropolis} 3 | % all imports 4 | \input{all_imports} 5 | 6 | \AtBeginEnvironment{quote}{\singlespacing} 7 | 8 | % new commands 9 | \input{all_new_commands} 10 | 11 | % definitions 12 | \input{definitions/colors} 13 | \input{definitions/styles} 14 | 15 | \input{header} 16 | 17 | \begin{document} 18 | \nocite{DeepLearningbook} 19 | \nocite{xiao2017/online} 20 | \maketitle 21 | 22 | \section{Function} 23 | 24 | \begin{frame}[fragile]{Revisão: função sigmoide} 25 | \input{TikzFiles/Sigmoid} 26 | \end{frame} 27 | 28 | \begin{frame}[fragile]{ReLU: Rectified Linear Units} 29 | \input{TikzFiles/ReLU} 30 | \end{frame} 31 | 32 | \begin{frame}[fragile]{Revisão: função softmax} 33 | \input{TikzFiles/Softmax} 34 | \end{frame} 35 | 36 | \begin{frame}{Revisão: entropia} 37 | \input{TikzFiles/Entropy1} 38 | \end{frame} 39 | 40 | \begin{frame}{Revisão: entropia} 41 | \input{TikzFiles/Entropy2} 42 | \end{frame} 43 | 44 | \begin{frame}{Revisão: divergência Kullback-Leibler} 45 | \input{TikzFiles/KullbackLeibler} 46 | \end{frame} 47 | 48 | 49 | \section{NN} 50 | 51 | \begin{frame}[fragile]{Perceptron} 52 | \input{TikzFiles/perceptron} 53 | \end{frame} 54 | 55 | \begin{frame}[fragile]{Rede neural: versão antiga} 56 | \input{TikzFiles/OldNN1} 57 | \end{frame} 58 | 59 | \begin{frame}[fragile]{Rede neural: versão antiga} 60 | \input{TikzFiles/OldNN2} 61 | \end{frame} 62 | 63 | \begin{frame}[fragile]{Rede neural: versão antiga} 64 | \begin{center} 65 | \input{TikzFiles/OldNN3} 66 | \end{center} 67 | \end{frame} 68 | 69 | \begin{frame}{Rede neural} 70 | \input{TikzFiles/NN} 71 | \end{frame} 72 | 73 | \begin{frame}{Rede neural profunda} 74 | \input{TikzFiles/DeepNN} 75 | \end{frame} 76 | 77 | 78 | \begin{frame}{Classificação com uma rede neural} 79 | \input{TikzFiles/DFNclassification} 80 | \end{frame} 81 | 82 | \section{Computational Graph} 83 | 84 | \begin{frame}[fragile]{Grafo de computação} 85 | \input{TikzFiles/Compgraph1} 86 | \end{frame} 87 | 88 | \begin{frame}[fragile]{Grafo de computação} 89 | \input{TikzFiles/Compgraph2} 90 | \end{frame} 91 | 92 | 93 | \begin{frame}[fragile]{Grafo de computação} 94 | \input{TikzFiles/Compgraph3} 95 | \end{frame} 96 | 97 | \begin{frame}[fragile]{Grafo de computação} 98 | \input{TikzFiles/Compgraph4} 99 | \end{frame} 100 | 101 | \section{Example with images} 102 | 103 | 104 | \begin{frame}{Fashion MNIST} 105 | \input{TikzFiles/fashionMNIST} 106 | \end{frame} 107 | 108 | \begin{frame}{Fashion MNIST} 109 | \input{TikzFiles/Kernel_image_pro} 110 | \end{frame} 111 | 112 | 113 | \section{Dropout} 114 | 115 | 116 | \begin{frame}[fragile]{Dropout} 117 | \input{TikzFiles/Dropout1} 118 | \end{frame} 119 | 120 | \begin{frame}[fragile]{Dropout} 121 | \input{TikzFiles/Dropout2} 122 | \end{frame} 123 | 124 | \section{Back Propagation} 125 | 126 | \begin{frame}{Operações simples: soma} 127 | \input{TikzFiles/soma} 128 | \end{frame} 129 | 130 | \begin{frame}{Operações simples: multiplicação} 131 | \input{TikzFiles/mult} 132 | \end{frame} 133 | 134 | \begin{frame}{Operações simples: divisão} 135 | \input{TikzFiles/div} 136 | \end{frame} 137 | 138 | \begin{frame}{Operações simples: negativo} 139 | \input{TikzFiles/minus1} 140 | \end{frame} 141 | 142 | \begin{frame}{Operações simples: exponenciação} 143 | \input{TikzFiles/exp} 144 | \end{frame} 145 | 146 | \begin{frame}{Operações simples: logarítimo} 147 | \input{TikzFiles/log} 148 | \end{frame} 149 | 150 | \begin{frame}{Aplicando a regra da cadeia} 151 | \input{TikzFiles/chain_rule_nodes} 152 | \end{frame} 153 | 154 | 155 | \begin{frame}{Exemplo} 156 | \input{TikzFiles/multiple_paths} 157 | \end{frame} 158 | 159 | \begin{frame}{Grafo de $L(\hat{\vect{y}}, \vect{y})$} 160 | \input{TikzFiles/expanded_graph_0} 161 | \end{frame} 162 | 163 | \begin{frame}{Derivada parcial de L com respeito a $b_1$: 2} 164 | \input{TikzFiles/b1_path2_grad} 165 | \end{frame} 166 | 167 | \section{Values} 168 | 169 | 170 | \begin{frame}{Exemplo} 171 | \input{TikzFiles/examples_values} 172 | \end{frame} 173 | 174 | \begin{frame}{Calculando em Lote} 175 | \input{TikzFiles/batch_example_values} 176 | \end{frame} 177 | 178 | 179 | \begin{frame}{Calulando em lote} 180 | \input{TikzFiles/batch_graph} 181 | \end{frame} 182 | 183 | \section{Matrix} 184 | 185 | \begin{frame}{Exemplo de imagem} 186 | \input{TikzFiles/5x5} 187 | \end{frame} 188 | 189 | \begin{frame}{Exemplo de filtro} 190 | \input{TikzFiles/3x3} 191 | \end{frame} 192 | 193 | \begin{frame}{Feature map} 194 | \input{TikzFiles/feature_map} 195 | \end{frame} 196 | 197 | \begin{frame}[allowframebreaks]{References} 198 | 199 | \bibliography{my_references} 200 | \bibliographystyle{abbrv} 201 | 202 | \end{frame} 203 | 204 | \end{document} 205 | -------------------------------------------------------------------------------- /NeuralNetworks/src/my_references.bib: -------------------------------------------------------------------------------- 1 | % deep learning 2 | 3 | @book{DeepLearningbook, 4 | author = "Ian Goodfellow and Yoshua Bengio and Aaron Courville", 5 | title = "Deep Learning", 6 | year = "2017", 7 | publisher = "MIT Press", 8 | } 9 | 10 | @online{xiao2017/online, 11 | author = {Han Xiao and Kashif Rasul and Roland Vollgraf}, 12 | title = {Fashion-MNIST: a Novel Image Dataset for Benchmarking Machine Learning Algorithms}, 13 | date = {2017-08-28}, 14 | year = {2017}, 15 | eprintclass = {cs.LG}, 16 | eprinttype = {arXiv}, 17 | eprint = {cs.LG/1708.07747}, 18 | } 19 | 20 | @misc{Dumoulin16, 21 | author = "Vincent Dumoulin and Francesco Visin", 22 | year = "2016", 23 | title = "A guide to convolution arithmetic for deep learning", 24 | url = "https://arxiv.org/abs/1603.07285" 25 | } 26 | 27 | @book{MostafaLD2012, 28 | author = {Abu-Mostafa, Yaser S. and Magdon-Ismail, Malik and Lin, Hsuan-Tien}, 29 | title = {Learning From Data}, 30 | year = {2012}, 31 | isbn = {1600490069, 9781600490064}, 32 | publisher = {AMLBook}, 33 | } 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /NeuralNetworks/src/pdf/NN.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/NeuralNetworks/src/pdf/NN.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TikzTemplates 2 | 3 | Different examples of figures using the Tikz package. 4 | 5 | ## In the folder "NeuralNetwork": 6 | A beamer presentation with Tikz images of: 7 | 8 | - **neural networks** 9 | - **computational graphs** 10 | - **activation functions** 11 | - **KL divergence** 12 | - **dropout** 13 | - **back propagation** 14 | - **two examples with images** 15 | 16 | ## In the folder "RNN": 17 | A beamer presentation with Tikz images of: 18 | 19 | - **Recurrent neural networks** 20 | - **Language model** 21 | - **back propagation through time** 22 | - **LSTM** 23 | -------------------------------------------------------------------------------- /RL/LICENSE: -------------------------------------------------------------------------------- 1 | CC0 1.0 Universal 2 | 3 | Statement of Purpose 4 | 5 | The laws of most jurisdictions throughout the world automatically confer 6 | exclusive Copyright and Related Rights (defined below) upon the creator and 7 | subsequent owner(s) (each and all, an "owner") of an original work of 8 | authorship and/or a database (each, a "Work"). 9 | 10 | Certain owners wish to permanently relinquish those rights to a Work for the 11 | purpose of contributing to a commons of creative, cultural and scientific 12 | works ("Commons") that the public can reliably and without fear of later 13 | claims of infringement build upon, modify, incorporate in other works, reuse 14 | and redistribute as freely as possible in any form whatsoever and for any 15 | purposes, including without limitation commercial purposes. These owners may 16 | contribute to the Commons to promote the ideal of a free culture and the 17 | further production of creative, cultural and scientific works, or to gain 18 | reputation or greater distribution for their Work in part through the use and 19 | efforts of others. 20 | 21 | For these and/or other purposes and motivations, and without any expectation 22 | of additional consideration or compensation, the person associating CC0 with a 23 | Work (the "Affirmer"), to the extent that he or she is an owner of Copyright 24 | and Related Rights in the Work, voluntarily elects to apply CC0 to the Work 25 | and publicly distribute the Work under its terms, with knowledge of his or her 26 | Copyright and Related Rights in the Work and the meaning and intended legal 27 | effect of CC0 on those rights. 28 | 29 | 1. Copyright and Related Rights. A Work made available under CC0 may be 30 | protected by copyright and related or neighboring rights ("Copyright and 31 | Related Rights"). Copyright and Related Rights include, but are not limited 32 | to, the following: 33 | 34 | i. the right to reproduce, adapt, distribute, perform, display, communicate, 35 | and translate a Work; 36 | 37 | ii. moral rights retained by the original author(s) and/or performer(s); 38 | 39 | iii. publicity and privacy rights pertaining to a person's image or likeness 40 | depicted in a Work; 41 | 42 | iv. rights protecting against unfair competition in regards to a Work, 43 | subject to the limitations in paragraph 4(a), below; 44 | 45 | v. rights protecting the extraction, dissemination, use and reuse of data in 46 | a Work; 47 | 48 | vi. database rights (such as those arising under Directive 96/9/EC of the 49 | European Parliament and of the Council of 11 March 1996 on the legal 50 | protection of databases, and under any national implementation thereof, 51 | including any amended or successor version of such directive); and 52 | 53 | vii. other similar, equivalent or corresponding rights throughout the world 54 | based on applicable law or treaty, and any national implementations thereof. 55 | 56 | 2. Waiver. To the greatest extent permitted by, but not in contravention of, 57 | applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and 58 | unconditionally waives, abandons, and surrenders all of Affirmer's Copyright 59 | and Related Rights and associated claims and causes of action, whether now 60 | known or unknown (including existing as well as future claims and causes of 61 | action), in the Work (i) in all territories worldwide, (ii) for the maximum 62 | duration provided by applicable law or treaty (including future time 63 | extensions), (iii) in any current or future medium and for any number of 64 | copies, and (iv) for any purpose whatsoever, including without limitation 65 | commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes 66 | the Waiver for the benefit of each member of the public at large and to the 67 | detriment of Affirmer's heirs and successors, fully intending that such Waiver 68 | shall not be subject to revocation, rescission, cancellation, termination, or 69 | any other legal or equitable action to disrupt the quiet enjoyment of the Work 70 | by the public as contemplated by Affirmer's express Statement of Purpose. 71 | 72 | 3. Public License Fallback. Should any part of the Waiver for any reason be 73 | judged legally invalid or ineffective under applicable law, then the Waiver 74 | shall be preserved to the maximum extent permitted taking into account 75 | Affirmer's express Statement of Purpose. In addition, to the extent the Waiver 76 | is so judged Affirmer hereby grants to each affected person a royalty-free, 77 | non transferable, non sublicensable, non exclusive, irrevocable and 78 | unconditional license to exercise Affirmer's Copyright and Related Rights in 79 | the Work (i) in all territories worldwide, (ii) for the maximum duration 80 | provided by applicable law or treaty (including future time extensions), (iii) 81 | in any current or future medium and for any number of copies, and (iv) for any 82 | purpose whatsoever, including without limitation commercial, advertising or 83 | promotional purposes (the "License"). The License shall be deemed effective as 84 | of the date CC0 was applied by Affirmer to the Work. Should any part of the 85 | License for any reason be judged legally invalid or ineffective under 86 | applicable law, such partial invalidity or ineffectiveness shall not 87 | invalidate the remainder of the License, and in such case Affirmer hereby 88 | affirms that he or she will not (i) exercise any of his or her remaining 89 | Copyright and Related Rights in the Work or (ii) assert any associated claims 90 | and causes of action with respect to the Work, in either case contrary to 91 | Affirmer's express Statement of Purpose. 92 | 93 | 4. Limitations and Disclaimers. 94 | 95 | a. No trademark or patent rights held by Affirmer are waived, abandoned, 96 | surrendered, licensed or otherwise affected by this document. 97 | 98 | b. Affirmer offers the Work as-is and makes no representations or warranties 99 | of any kind concerning the Work, express, implied, statutory or otherwise, 100 | including without limitation warranties of title, merchantability, fitness 101 | for a particular purpose, non infringement, or the absence of latent or 102 | other defects, accuracy, or the present or absence of errors, whether or not 103 | discoverable, all to the greatest extent permissible under applicable law. 104 | 105 | c. Affirmer disclaims responsibility for clearing rights of other persons 106 | that may apply to the Work or any use thereof, including without limitation 107 | any person's Copyright and Related Rights in the Work. Further, Affirmer 108 | disclaims responsibility for obtaining any necessary consents, permissions 109 | or other rights required for any use of the Work. 110 | 111 | d. Affirmer understands and acknowledges that Creative Commons is not a 112 | party to this document and has no duty or obligation with respect to this 113 | CC0 or use of the Work. 114 | 115 | For more information, please see 116 | 117 | -------------------------------------------------------------------------------- /RL/README.md: -------------------------------------------------------------------------------- 1 | # Reinforcement learning presentation 2 | 3 | ![alt text](images/cc-logo.png "CC") 4 | 5 | 6 | Licensed under [creative commons](https://github.com/LIAMF-USP/TikzTemplates/blob/master/RL/LICENSE) 7 | 8 | ## Usage 9 | 10 | You can find the pdf of the presentation in the folder /src/pdf. But if you want to compile (**for Ubuntu users**) the latex file just run: 11 | 12 | ``` 13 | $ bash install.sh 14 | $ cd src/ 15 | $ make 16 | ``` 17 | 18 | -------------------------------------------------------------------------------- /RL/images/cc-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/RL/images/cc-logo.png -------------------------------------------------------------------------------- /RL/install.sh: -------------------------------------------------------------------------------- 1 | sudo apt-get install texlive-latex-base 2 | sudo apt-get install latex-beamer 3 | sudo apt-get install texlive-latex-extra 4 | sudo apt-get install texlive-fonts-extra 5 | -------------------------------------------------------------------------------- /RL/src/Makefile: -------------------------------------------------------------------------------- 1 | BASE_NAME := main 2 | BUILD_DIR := build 3 | PDF_NAME := RLpresentation.pdf 4 | 5 | PDFLATEX_OPTIONS = -halt-on-error -aux-directory=$(BUILD_DIR) -output-directory=$(BUILD_DIR) --shell-escape 6 | LATEX := latex 7 | PDFLATEX = pdflatex $(PDFLATEX_OPTIONS) 8 | BIBTEX := bibtex 9 | 10 | pdf: $(BASE_NAME).pdf 11 | 12 | $(BASE_NAME).pdf: $(BASE_NAME).tex 13 | mkdir -p $(BUILD_DIR) 14 | $(PDFLATEX) $< 15 | $(BIBTEX) $(BUILD_DIR)/$(BASE_NAME) 16 | $(PDFLATEX) $< 17 | $(PDFLATEX) $< 18 | $(PDFLATEX) $< 19 | cp $(BUILD_DIR)/$(BASE_NAME).pdf $(PDF_NAME) 20 | 21 | clean: 22 | rm -rf build $(PDF_NAME) 23 | -------------------------------------------------------------------------------- /RL/src/all_imports.tex: -------------------------------------------------------------------------------- 1 | \usepackage[utf8]{inputenc} 2 | \usepackage[T1]{fontenc} 3 | \usepackage{lmodern} 4 | \usepackage{appendixnumberbeamer} 5 | \usepackage{hyperref} 6 | \usepackage{booktabs} 7 | \usepackage{bm} 8 | \usepackage[scale=2]{ccicons} 9 | \usepackage[outputdir=build]{minted} 10 | \usepackage{pgfplots} 11 | \usepackage{array,colortbl,xcolor} 12 | \usepgfplotslibrary{dateplot} 13 | \usepackage{setspace} 14 | \usepackage{etoolbox} 15 | \usepackage{xspace} 16 | \usepackage{tikz} 17 | \usetikzlibrary{shapes,arrows,positioning,fit,backgrounds} 18 | \usepackage{tkz-euclide} 19 | \usepackage{soul} 20 | \usepackage{ragged2e} 21 | -------------------------------------------------------------------------------- /RL/src/all_new_commands.tex: -------------------------------------------------------------------------------- 1 | \newcommand{\themename}{\textbf{\textsc{metropolis}}\xspace} 2 | \newcommand{\vect}[1]{\bm{#1}} 3 | \newcommand{\myprime}[1]{{#1}^{\prime}} 4 | \newcommand{\grad}[2]{\nabla_{#1} {#2}} 5 | \newcommand{\dotp}[2]{{#1}^{\top}{#2}} 6 | \newcommand{\dotpPright}[2]{{#1}^{\top}\left({#2}\right)} 7 | \newcommand{\outerp}[2]{\left({#1}\right){#2}^{\top}} 8 | \newcommand{\Jacobian}[2]{\frac{\partial #1}{\partial #2}} 9 | \newcommand{\Vocab}{\mathbb{V}} 10 | \DeclareMathOperator*{\argmin}{arg\,min} 11 | 12 | % Quote with author reference at the end 13 | \let\oldquote\quote 14 | \let\endoldquote\endquote 15 | \renewenvironment{quote}[2][] 16 | {\if\relax\detokenize{#1}\relax 17 | \def\quoteauthor{#2}% 18 | \else 19 | \def\quoteauthor{#2~---~#1}% 20 | \fi 21 | \oldquote} 22 | {\par\nobreak\smallskip\hfill(\quoteauthor)% 23 | \endoldquote\addvspace{\bigskipamount}} 24 | %----------------------------------------- 25 | -------------------------------------------------------------------------------- /RL/src/definitions/colors.tex: -------------------------------------------------------------------------------- 1 | \definecolor{blue}{RGB}{159, 192, 176} 2 | \definecolor{green}{RGB}{160, 227, 127} 3 | \definecolor{orange}{RGB}{243, 188, 125} 4 | \definecolor{red}{RGB}{253, 123, 84} 5 | \definecolor{nephritis}{RGB}{39, 174, 96} 6 | \definecolor{emerald}{RGB}{46, 204, 113} 7 | \definecolor{turquoise}{RGB}{39, 174, 96} 8 | \definecolor{green-sea}{RGB}{22, 160, 133} -------------------------------------------------------------------------------- /RL/src/definitions/styles.tex: -------------------------------------------------------------------------------- 1 | % Tikzstyles for Computation Graphs 2 | 3 | % nodes 4 | \tikzstyle{noop} = [circle, draw=none, fill=red, minimum size = 10pt] 5 | \tikzstyle{op} = [circle, draw=red, line width=1.5pt, fill=red!70, text=black, text centered, font=\bf \normalsize, minimum size = 25pt] 6 | \tikzstyle{state} = [circle, draw=blue, line width=1.5pt, fill=blue!70, text=black, text centered, font=\bf \normalsize, minimum size = 25pt] 7 | % \tikzstyle{gradient} = [circle, draw=green, line width=1.5pt, fill=green!60, text=black, text centered, font=\bf \normalsize, minimum size = 25pt] 8 | \tikzstyle{gradient} = [circle, draw=nephritis, line width=1.5pt, fill=nephritis!60, text=black, text centered, font=\bf \normalsize, minimum size = 25pt] 9 | \tikzstyle{textonly} = [draw=none, fill=none, text centered, font=\bf \normalsize] 10 | \tikzstyle{boxtextonly} = [draw=none, fill=none, align=center, font=\bf \normalsize] 11 | 12 | % edges 13 | % \tikzstyle{tedge} = [draw, thick, >=stealth, ->] 14 | \tikzstyle{tedge} = [draw, thick, >=latex, ->] 15 | 16 | % namedscope 17 | \tikzstyle{namedscope} = [circle, draw=orange, line width=1.5pt, fill=orange!60, align=center, inner sep=0pt] 18 | 19 | % \tikzstyle{container} = [draw=none, rectangle, dotted, inner ysep=1.5em] 20 | % \tikzstyle{novertex} = [draw=none, fill=none, text centered] 21 | % \tikzstyle{predicate} = [ellipse, draw, thick, text centered, rounded corners, minimum size=30pt] 22 | % \tikzstyle{aux} = [rectangle, draw, thick, text centered, rounded corners, minimum size=30pt] 23 | % \tikzstyle{ledge} = [draw, dashed, thick, >=stealth, ->] 24 | % \tikzstyle{pedge} = [draw, thick, >=stealth, ->] 25 | 26 | -------------------------------------------------------------------------------- /RL/src/header.tex: -------------------------------------------------------------------------------- 1 | \title{MAC0425 - Inteligência Artificial} % antigo IA na escola 2 | \date{\today} 3 | 4 | \author{ 5 | Felipe Salvatore\\ 6 | \url{https://felipessalvatore.github.io/} 7 | \vspace{0.1 cm} 8 | \and\\ 9 | Paula Moraes\\ 10 | \url{https://www.linkedin.com/in/paula-moraes-137a2ab9/}\vspace{0.1 cm} 11 | \and\\ 12 | Thiago Lira\\ 13 | \url{https://github.com/ThiagoLira}\\\vspace{0.1 cm} 14 | } 15 | 16 | \institute{\textbf{IME-USP}: Institute of Mathematics and Statistics, University of São Paulo} 17 | 18 | \titlegraphic{ 19 | \hspace{9cm} 20 | \includegraphics[scale=0.2]{images/liamflogo.png} 21 | } 22 | 23 | -------------------------------------------------------------------------------- /RL/src/images/agent.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/RL/src/images/agent.jpg -------------------------------------------------------------------------------- /RL/src/images/enduro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/RL/src/images/enduro.png -------------------------------------------------------------------------------- /RL/src/images/frame1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/RL/src/images/frame1.png -------------------------------------------------------------------------------- /RL/src/images/frame2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/RL/src/images/frame2.png -------------------------------------------------------------------------------- /RL/src/images/frame3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/RL/src/images/frame3.png -------------------------------------------------------------------------------- /RL/src/images/liamflogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/RL/src/images/liamflogo.png -------------------------------------------------------------------------------- /RL/src/images/robo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/RL/src/images/robo.jpg -------------------------------------------------------------------------------- /RL/src/main.tex: -------------------------------------------------------------------------------- 1 | \documentclass[10pt]{beamer} 2 | \usetheme{metropolis} 3 | % all imports 4 | \input{all_imports} 5 | 6 | \AtBeginEnvironment{quote}{\singlespacing} 7 | 8 | % new commands 9 | \input{all_new_commands} 10 | 11 | % definitions 12 | \input{definitions/colors} 13 | \input{definitions/styles} 14 | 15 | \input{header} 16 | 17 | \begin{document} 18 | \nocite{Sutton98a} 19 | 20 | \maketitle 21 | 22 | 23 | 24 | \begin{frame}{Artificial Intelligence} 25 | 26 | \begin{figure}[h] 27 | \includegraphics[width=5cm]{images/robo.jpg} 28 | \end{figure} 29 | \end{frame} 30 | 31 | 32 | \begin{frame}{Reinforcement Learning schema} 33 | \input{tikzfiles/Basic_RL} 34 | \end{frame} 35 | 36 | \begin{frame}[fragile]{Q-learning} 37 | \input{tikzfiles/Tabular_RL} 38 | \end{frame} 39 | 40 | \begin{frame}[fragile]{RL and feature engineering} 41 | \input{tikzfiles/RL_hand} 42 | \end{frame} 43 | 44 | \begin{frame}[fragile]{Deep Q-learning} 45 | \input{tikzfiles/RL_deep} 46 | \end{frame} 47 | 48 | \begin{frame}[fragile]{Deep Q-learning} 49 | \input{tikzfiles/Enduro} 50 | \end{frame} 51 | 52 | 53 | \begin{frame}[allowframebreaks]{Referências} 54 | 55 | \bibliography{my_references} 56 | \bibliographystyle{abbrv} 57 | 58 | \end{frame} 59 | 60 | 61 | 62 | 63 | \end{document} -------------------------------------------------------------------------------- /RL/src/my_references.bib: -------------------------------------------------------------------------------- 1 | % RL 2 | 3 | @Book{Sutton98a, 4 | Title = {Reinforcement Learning : An Introduction}, 5 | Author = {Richard S. Sutton and Andrew G. Barto}, 6 | Publisher = {MIT Press}, 7 | Year = {1998}, 8 | } 9 | 10 | % machine learning 11 | 12 | @book{DeepLearningbook, 13 | author = "Ian Goodfellow and Yoshua Bengio and Aaron Courville", 14 | title = "Deep Learning", 15 | year = "2017", 16 | publisher = "MIT Press", 17 | } 18 | 19 | @book{learningfromdata, 20 | title = {Learning From Data: A short course}, 21 | author = {Yaser S. Abu-Mostafa, Malik Magdon-Ismail, Hsuan-Tien Lin}, 22 | publisher = {AMLBook.com}, 23 | isbn = {1600490069, 978-1600490064}, 24 | year = {2012}, 25 | series = {}, 26 | edition = {1}, 27 | volume = {}, 28 | url = {http://gen.lib.rus.ec/book/index.php?md5=BCF7C1FF782654437CA474770AB041D5} 29 | } 30 | -------------------------------------------------------------------------------- /RL/src/pdf/RLpresentation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/RL/src/pdf/RLpresentation.pdf -------------------------------------------------------------------------------- /RL/src/tikzfiles/Basic_RL.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.12}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % nodes ============================= 8 | \node (agent) {\includegraphics[width=.15\textwidth]{images/agent.jpg}}; 9 | \node[state, right=70pt of agent] (env) {\Large{Environment}}; 10 | \node[textonly, above left=4.5pt and -30.0pt of env] (inv1) {}; 11 | \node[textonly, above right=0.5pt and -30.5pt of agent] (inv2) {}; 12 | \node[textonly, below left=4.5pt and -30.0pt of env] (inv3) {}; 13 | \node[textonly, below right=0.5pt and -30.5pt of agent] (inv4) {}; 14 | \node[textonly, below=-3.8pt of agent] (label) {Agent}; 15 | 16 | 17 | 18 | % edges ============================= 19 | 20 | \path[tedge, nephritis!60, line width=1mm] (inv2) edge [out=80,in=120] node[above right] {action} (inv1); 21 | \path[tedge, nephritis!60, line width=1mm] (inv3) edge [out=-120,in=-80] node[below right] {state} (inv4); 22 | \path[tedge, nephritis!60, line width=1mm] (env) edge node[above] {reward} (agent); 23 | 24 | \end{tikzpicture} 25 | } % scalebox 26 | \end{figure} 27 | -------------------------------------------------------------------------------- /RL/src/tikzfiles/Enduro.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.8}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | \begin{scope}[xshift=0cm,yshift=0cm] 10 | \begin{scope}[xshift=0cm,yshift=0cm] 11 | \node (x1) at (1,1) {\includegraphics[width=.35\textwidth]{images/enduro.png}}; 12 | \end{scope} 13 | \begin{scope}[xshift=-0.6cm,yshift=-0.6cm] 14 | \node (x2) at (1,1) {\includegraphics[width=.35\textwidth]{images/enduro.png}}; 15 | \end{scope} 16 | \begin{scope}[xshift=-1.2cm,yshift=-1.2cm] 17 | \node (x3) at (1,1) {\includegraphics[width=.35\textwidth]{images/enduro.png}}; 18 | \end{scope} 19 | \end{scope} 20 | 21 | 22 | \node[textonly, right=10pt of x2] (inv1) {}; 23 | \node[op, right=60pt of x2] (f) {{\LARGE$f$}}; 24 | \node[textonly, right=2pt of f] (inv2) {}; 25 | \node[textonly, right=30pt of inv2] (result) {{\LARGE$\begin{bmatrix}Q(s,a_1)\\ \vdots \\Q(s,a_n)\end{bmatrix}$}}; 26 | 27 | 28 | 29 | %edges 30 | \path[tedge, orange!120, line width=1.5mm] (inv1) -- (f); 31 | \path[tedge, orange!120, line width=1.5mm] (inv2) -- (result); 32 | 33 | \end{tikzpicture} 34 | } % scalebox 35 | \end{figure} -------------------------------------------------------------------------------- /RL/src/tikzfiles/RL_deep.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.8}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | \begin{scope}[xshift=0cm,yshift=0cm] 10 | \begin{scope}[xshift=0cm,yshift=0cm] 11 | \node (x1) at (1,1) {\includegraphics[width=.35\textwidth]{images/frame1.png}}; 12 | \end{scope} 13 | \begin{scope}[xshift=-0.6cm,yshift=-0.6cm] 14 | \node (x2) at (1,1) {\includegraphics[width=.35\textwidth]{images/frame2.png}}; 15 | \end{scope} 16 | \begin{scope}[xshift=-1.2cm,yshift=-1.2cm] 17 | \node (x3) at (1,1) {\includegraphics[width=.35\textwidth]{images/frame1.png}}; 18 | \end{scope} 19 | \end{scope} 20 | 21 | 22 | \node[textonly, right=10pt of x2] (inv1) {}; 23 | \node[op, right=60pt of x2] (f) {{\LARGE$f$}}; 24 | \node[textonly, right=2pt of f] (inv2) {}; 25 | \node[textonly, right=30pt of inv2] (result) {{\LARGE$\begin{bmatrix}Q(s,a_1)\\ \vdots \\Q(s,a_n)\end{bmatrix}$}}; 26 | 27 | 28 | 29 | %edges 30 | \path[tedge, orange!120, line width=1.5mm] (inv1) -- (f); 31 | \path[tedge, orange!120, line width=1.5mm] (inv2) -- (result); 32 | 33 | \end{tikzpicture} 34 | } % scalebox 35 | \end{figure} -------------------------------------------------------------------------------- /RL/src/tikzfiles/RL_hand.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.65}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | \begin{scope}[xshift=0cm,yshift=0cm] 10 | \begin{scope}[xshift=0cm,yshift=0cm] 11 | \node (x1) at (2,1.5) {\includegraphics[width=.25\textwidth]{images/frame1.png}}; 12 | \end{scope} 13 | \begin{scope}[xshift=-0.6cm,yshift=-0.6cm] 14 | \node (x2) at (2,1.5) {\includegraphics[width=.25\textwidth]{images/frame2.png}}; 15 | \end{scope} 16 | \begin{scope}[xshift=-1.2cm,yshift=-1.2cm] 17 | \node (x3) at (2,1.5) {\includegraphics[width=.25\textwidth]{images/frame1.png}}; 18 | \end{scope} 19 | \end{scope} 20 | 21 | \node[op] (h2) at (7,1) {{\LARGE$\begin{bmatrix}1.8\\1.7\\1.6\end{bmatrix}$}}; 22 | 23 | \node[textonly, right=10pt of h2] (inv1) {}; 24 | \node[op, right=60pt of h2] (f) {{\LARGE$f$}}; 25 | \node[textonly, right=2pt of f] (inv2) {}; 26 | 27 | \node[textonly, right=8pt of x2] (inv3) {}; 28 | \node[textonly, right=55pt of inv3] (inv4) {}; 29 | 30 | 31 | \node[textonly, right=30pt of inv2] (result) {{\LARGE$\begin{bmatrix}Q(s,a_1)\\ \vdots \\Q(s,a_n)\end{bmatrix}$}}; 32 | 33 | 34 | 35 | %edges 36 | \path[tedge, orange!120, line width=1.5mm] (inv1) -- (f); 37 | \path[tedge, orange!120, line width=1.5mm] (inv2) -- (result); 38 | \path[tedge, orange!120, line width=1.5mm] (inv3) -- (inv4); 39 | 40 | %info 41 | 42 | \node[textonly, above=85pt of h2] (inv5) {\LARGE{The pong game can have $256^{84\times84\times3}$ different states.}}; 43 | 44 | \end{tikzpicture} 45 | } % scalebox 46 | \end{figure} 47 | -------------------------------------------------------------------------------- /RL/src/tikzfiles/Tabular_RL.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | \scalebox{0.78}{ 4 | \begin{tikzpicture} 5 | % 3x3 grid 6 | \draw[opacity=0.4] (0,0) rectangle (3,3); 7 | \draw[draw=black,thick] (0,0) grid (3,3); 8 | \node (00) at (0.5,2.5) {\Large -1}; 9 | \node (01) at (1.5,2.5) {\Large -1}; 10 | \node (02) at (2.5,2.5) {\Large -1}; 11 | \node (10) at (0.5,1.5) {\Large -1}; 12 | \node (11) at (1.5,1.5) {\Large -8}; 13 | \node (12) at (2.5,1.5) {\Large -1}; 14 | \node (20) at (0.5,0.5) {\Large -1}; 15 | \node (21) at (1.5,0.5) {\Large -8}; 16 | \node (22) at (2.5,0.5) {\Large 10}; 17 | 18 | 19 | \node[textonly, left=60pt of 20] (inv1) {}; 20 | \node[textonly, left=2pt of 20] (inv2) {}; 21 | 22 | \node[boxtextonly, below=10pt of 21] (label1) {states and\\rewards}; 23 | \path[tedge, nephritis!60, line width=1mm] (inv1) -- (inv2); 24 | 25 | % 3x3 actions 26 | \node[textonly, right=50pt of 12] (inv3) {}; 27 | \node[textonly, right=30pt of inv3] (inv4) {}; 28 | \node[textonly, left=30pt of inv3] (inv5) {}; 29 | \node[textonly, above=30pt of inv3] (inv6) {}; 30 | \node[textonly, below=30pt of inv3] (inv7) {}; 31 | \node[textonly, right=45pt of label1] (label2) {actions}; 32 | \path[tedge, orange!120, line width=1mm] (inv3) -- (inv4); 33 | \path[tedge, orange!120, line width=1mm] (inv3) -- (inv5); 34 | \path[tedge, orange!120, line width=1mm] (inv3) -- (inv6); 35 | \path[tedge, orange!120, line width=1mm] (inv3) -- (inv7); 36 | 37 | % Q table 38 | \node[textonly, right=5pt of inv4] (table) {$\begin{bmatrix}Q(1,\uparrow) & Q(1,\downarrow) & Q(1,\leftarrow) & Q(1,\rightarrow) \\ \vdots & \vdots & \vdots & \vdots \\Q(9,\uparrow) & Q(9,\downarrow) & Q(9,\leftarrow) & Q(9,\rightarrow)\end{bmatrix}$}; 39 | \node[textonly, right=80pt of label2] (label3) {Q-table}; 40 | 41 | 42 | \end{tikzpicture} 43 | } % scalebox 44 | \end{figure} 45 | -------------------------------------------------------------------------------- /RNN/LICENSE: -------------------------------------------------------------------------------- 1 | CC0 1.0 Universal 2 | 3 | Statement of Purpose 4 | 5 | The laws of most jurisdictions throughout the world automatically confer 6 | exclusive Copyright and Related Rights (defined below) upon the creator and 7 | subsequent owner(s) (each and all, an "owner") of an original work of 8 | authorship and/or a database (each, a "Work"). 9 | 10 | Certain owners wish to permanently relinquish those rights to a Work for the 11 | purpose of contributing to a commons of creative, cultural and scientific 12 | works ("Commons") that the public can reliably and without fear of later 13 | claims of infringement build upon, modify, incorporate in other works, reuse 14 | and redistribute as freely as possible in any form whatsoever and for any 15 | purposes, including without limitation commercial purposes. These owners may 16 | contribute to the Commons to promote the ideal of a free culture and the 17 | further production of creative, cultural and scientific works, or to gain 18 | reputation or greater distribution for their Work in part through the use and 19 | efforts of others. 20 | 21 | For these and/or other purposes and motivations, and without any expectation 22 | of additional consideration or compensation, the person associating CC0 with a 23 | Work (the "Affirmer"), to the extent that he or she is an owner of Copyright 24 | and Related Rights in the Work, voluntarily elects to apply CC0 to the Work 25 | and publicly distribute the Work under its terms, with knowledge of his or her 26 | Copyright and Related Rights in the Work and the meaning and intended legal 27 | effect of CC0 on those rights. 28 | 29 | 1. Copyright and Related Rights. A Work made available under CC0 may be 30 | protected by copyright and related or neighboring rights ("Copyright and 31 | Related Rights"). Copyright and Related Rights include, but are not limited 32 | to, the following: 33 | 34 | i. the right to reproduce, adapt, distribute, perform, display, communicate, 35 | and translate a Work; 36 | 37 | ii. moral rights retained by the original author(s) and/or performer(s); 38 | 39 | iii. publicity and privacy rights pertaining to a person's image or likeness 40 | depicted in a Work; 41 | 42 | iv. rights protecting against unfair competition in regards to a Work, 43 | subject to the limitations in paragraph 4(a), below; 44 | 45 | v. rights protecting the extraction, dissemination, use and reuse of data in 46 | a Work; 47 | 48 | vi. database rights (such as those arising under Directive 96/9/EC of the 49 | European Parliament and of the Council of 11 March 1996 on the legal 50 | protection of databases, and under any national implementation thereof, 51 | including any amended or successor version of such directive); and 52 | 53 | vii. other similar, equivalent or corresponding rights throughout the world 54 | based on applicable law or treaty, and any national implementations thereof. 55 | 56 | 2. Waiver. To the greatest extent permitted by, but not in contravention of, 57 | applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and 58 | unconditionally waives, abandons, and surrenders all of Affirmer's Copyright 59 | and Related Rights and associated claims and causes of action, whether now 60 | known or unknown (including existing as well as future claims and causes of 61 | action), in the Work (i) in all territories worldwide, (ii) for the maximum 62 | duration provided by applicable law or treaty (including future time 63 | extensions), (iii) in any current or future medium and for any number of 64 | copies, and (iv) for any purpose whatsoever, including without limitation 65 | commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes 66 | the Waiver for the benefit of each member of the public at large and to the 67 | detriment of Affirmer's heirs and successors, fully intending that such Waiver 68 | shall not be subject to revocation, rescission, cancellation, termination, or 69 | any other legal or equitable action to disrupt the quiet enjoyment of the Work 70 | by the public as contemplated by Affirmer's express Statement of Purpose. 71 | 72 | 3. Public License Fallback. Should any part of the Waiver for any reason be 73 | judged legally invalid or ineffective under applicable law, then the Waiver 74 | shall be preserved to the maximum extent permitted taking into account 75 | Affirmer's express Statement of Purpose. In addition, to the extent the Waiver 76 | is so judged Affirmer hereby grants to each affected person a royalty-free, 77 | non transferable, non sublicensable, non exclusive, irrevocable and 78 | unconditional license to exercise Affirmer's Copyright and Related Rights in 79 | the Work (i) in all territories worldwide, (ii) for the maximum duration 80 | provided by applicable law or treaty (including future time extensions), (iii) 81 | in any current or future medium and for any number of copies, and (iv) for any 82 | purpose whatsoever, including without limitation commercial, advertising or 83 | promotional purposes (the "License"). The License shall be deemed effective as 84 | of the date CC0 was applied by Affirmer to the Work. Should any part of the 85 | License for any reason be judged legally invalid or ineffective under 86 | applicable law, such partial invalidity or ineffectiveness shall not 87 | invalidate the remainder of the License, and in such case Affirmer hereby 88 | affirms that he or she will not (i) exercise any of his or her remaining 89 | Copyright and Related Rights in the Work or (ii) assert any associated claims 90 | and causes of action with respect to the Work, in either case contrary to 91 | Affirmer's express Statement of Purpose. 92 | 93 | 4. Limitations and Disclaimers. 94 | 95 | a. No trademark or patent rights held by Affirmer are waived, abandoned, 96 | surrendered, licensed or otherwise affected by this document. 97 | 98 | b. Affirmer offers the Work as-is and makes no representations or warranties 99 | of any kind concerning the Work, express, implied, statutory or otherwise, 100 | including without limitation warranties of title, merchantability, fitness 101 | for a particular purpose, non infringement, or the absence of latent or 102 | other defects, accuracy, or the present or absence of errors, whether or not 103 | discoverable, all to the greatest extent permissible under applicable law. 104 | 105 | c. Affirmer disclaims responsibility for clearing rights of other persons 106 | that may apply to the Work or any use thereof, including without limitation 107 | any person's Copyright and Related Rights in the Work. Further, Affirmer 108 | disclaims responsibility for obtaining any necessary consents, permissions 109 | or other rights required for any use of the Work. 110 | 111 | d. Affirmer understands and acknowledges that Creative Commons is not a 112 | party to this document and has no duty or obligation with respect to this 113 | CC0 or use of the Work. 114 | 115 | For more information, please see 116 | 117 | -------------------------------------------------------------------------------- /RNN/README.md: -------------------------------------------------------------------------------- 1 | # RNNpresentation: A presentation about Recurrent Neural Network. 2 | 3 | ![alt text](gifs/cc-logo.png "CC") 4 | 5 | 6 | Licensed under [creative commons](https://github.com/LIAMF-USP/TikzTemplates/blob/master/RNN/LICENSE) 7 | 8 | 9 | ## Usage 10 | 11 | You can find the pdf of the presentation in the folder /src/pdf. But if you want to compile (**for Ubuntu users**) the latex file just run: 12 | 13 | ``` 14 | $ bash install.sh 15 | $ cd src/ 16 | $ make 17 | ``` 18 | -------------------------------------------------------------------------------- /RNN/gifs/cc-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/RNN/gifs/cc-logo.png -------------------------------------------------------------------------------- /RNN/install.sh: -------------------------------------------------------------------------------- 1 | sudo apt-get install texlive-latex-base 2 | sudo apt-get install latex-beamer 3 | sudo apt-get install texlive-latex-extra 4 | sudo apt-get install texlive-fonts-extra 5 | -------------------------------------------------------------------------------- /RNN/src/Makefile: -------------------------------------------------------------------------------- 1 | BASE_NAME := main 2 | BUILD_DIR := build 3 | PDF_NAME := RNNpresentation.pdf 4 | 5 | PDFLATEX_OPTIONS = -halt-on-error -aux-directory=$(BUILD_DIR) -output-directory=$(BUILD_DIR) --shell-escape 6 | LATEX := latex 7 | PDFLATEX = pdflatex $(PDFLATEX_OPTIONS) 8 | BIBTEX := bibtex 9 | 10 | pdf: $(BASE_NAME).pdf 11 | 12 | $(BASE_NAME).pdf: $(BASE_NAME).tex 13 | mkdir -p $(BUILD_DIR) 14 | $(PDFLATEX) $< 15 | $(BIBTEX) $(BUILD_DIR)/$(BASE_NAME) 16 | $(PDFLATEX) $< 17 | $(PDFLATEX) $< 18 | $(PDFLATEX) $< 19 | cp $(BUILD_DIR)/$(BASE_NAME).pdf $(PDF_NAME) 20 | 21 | clean: 22 | rm -rf build $(PDF_NAME) 23 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/Add_op_simplified.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.2}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % nodes 10 | \node[op] (W) {$\vect{U}$}; 11 | \node[textonly, below=20pt of W] (inv1) {}; 12 | \node[noop, right=30pt of W] (noop-right) {}; 13 | \node[op, above right=10pt and 3pt of noop-right] (plus) {$+$}; 14 | \node[op, below=30pt of noop-right] (x) {$\vect{x}$}; 15 | \node[noop, above=10pt of W] (noop-left) {}; 16 | \node[op, above=10pt of noop-left] (U) {$\vect{W}$}; 17 | \node[state, left=30pt of noop-left] (h) {$\vect{h}$}; 18 | \node[textonly, above right=2pt of plus] (name) {{\LARGE$add(\vect{W},\vect{U})$}}; 19 | 20 | 21 | %% namedscope operation 22 | \begin{scope}[on background layer] 23 | \coordinate (p1) at (U.north west); 24 | \coordinate (p2) at (plus.east); 25 | \coordinate (p3) at (W.south west); 26 | \tkzCircumCenter(p1,p2,p3) 27 | \tkzGetPoint{O} 28 | \tkzDrawCircle[draw=orange, line width=1.5pt, fill=orange!60](O,p1) 29 | \end{scope} 30 | 31 | % edges 32 | \path[tedge] (W) -- (noop-right); 33 | \path[tedge] (x) -- (noop-right); 34 | \path[tedge] (noop-right) -- (plus); 35 | \path[tedge] (U) -- (noop-left); 36 | \path[tedge] (noop-left) -- (plus); 37 | \path[tedge] (h) -- (noop-left); 38 | 39 | 40 | 41 | 42 | \end{tikzpicture} 43 | } % scalebox 44 | \end{figure} 45 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/BackPropScalar.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.5}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | \node[op] (y) {y}; 9 | \node[op, above=30pt of y] (z) {z}; 10 | \node[op, below=30pt of y] (x) {x}; 11 | 12 | % gradients ============================= 13 | \visible<2->{\node[gradient, right=50pt of z] (delzdely) {$\frac{dz}{dy}$};} 14 | \visible<2->{\node[textonly, right=0.1pt of delzdely] {$=\frac{1}{x^{2}}$};} 15 | \visible<3->{\node[gradient, right=50pt of y] (delydelx) {$\frac{dy}{dx}$};} 16 | \visible<3->{\node[textonly, right=0.1pt of delydelx] {$=2x$};} 17 | \visible<4->{\node[gradient, right=80pt of x] (delzdelx) {$\frac{dz}{dx}$};} 18 | \visible<4->{\node[textonly, right=0.1pt of delzdelx] {$=\frac{2}{x}$};} 19 | 20 | 21 | % edges 22 | \path[tedge] (x) -- (y); 23 | \path[tedge] (y) -- (z); 24 | \visible<2->{\path[tedge] (z) -- (delzdely);} 25 | \visible<3->{\path[tedge] (y) -- (delydelx);} 26 | \visible<4->{\path[tedge] (x) -- (delzdelx);} 27 | \visible<4->{\path[tedge] (delydelx) -- (delzdelx);} 28 | \visible<4->{\path[tedge] (delzdely) to [bend right, out=-310, in=100, distance=40pt] (delzdelx);} 29 | 30 | 31 | % \visible<2->{\node[gradient, left=20pt of V] (grad-V) {$\nabla_{\textbf{V}}\textbf{L}$};} 32 | 33 | 34 | \end{tikzpicture} 35 | } % scalebox 36 | \end{figure} 37 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/BackPropVector.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.5}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | \node[op] (y) {$\vect{y}$}; 9 | \node[op, above=30pt of y] (z) {$z$}; 10 | \node[op, below=30pt of y] (x) {$\vect{x}$}; 11 | 12 | % gradients ============================= 13 | \visible<2->{\node[gradient, right=50pt of z] (delzdely) {$\grad{\vect{y}}{z}$};} 14 | \visible<2->{\node[textonly, right=0.1pt of delzdely] {$=\vect{b}$};} 15 | \visible<3->{\node[gradient, right=50pt of y] (delydelx) {$\Jacobian{\vect{y}}{\vect{x}}$};} 16 | \visible<3->{\node[textonly, right=0.1pt of delydelx] {$=\vect{W}$};} 17 | \visible<4->{\node[gradient, right=80pt of x] (delzdelx) {$\grad{\vect{x}}{z}$};} 18 | \visible<4->{\node[textonly, right=0.1pt of delzdelx] {$=\dotp{\vect{W}}{\vect{b}}$};} 19 | 20 | 21 | % edges 22 | \path[tedge] (x) -- (y); 23 | \path[tedge] (y) -- (z); 24 | \visible<2->{\path[tedge] (z) -- (delzdely);} 25 | \visible<3->{\path[tedge] (y) -- (delydelx);} 26 | \visible<4->{\path[tedge] (x) -- (delzdelx);} 27 | \visible<4->{\path[tedge] (delydelx) -- (delzdelx);} 28 | \visible<4->{\path[tedge] (delzdely) to [bend right, out=-310, in=100, distance=40pt] (delzdelx);} 29 | 30 | 31 | % \visible<2->{\node[gradient, left=20pt of V] (grad-V) {$\nabla_{\textbf{V}}\textbf{L}$};} 32 | 33 | 34 | \end{tikzpicture} 35 | } % scalebox 36 | \end{figure} 37 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/Compgraph1.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.3}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % nodes 10 | \node[op] (W1) {$\vect{W}$}; 11 | \node[textonly, below=20pt of W1] (inv1) {}; 12 | \node[op, below=40pt of W1] (x1) {$\vect{x}$}; 13 | \node[op, right=30.5pt of inv1] (v1) {matmul}; 14 | \node[op, right=120pt of W1] (W2) {$\vect{W}$}; 15 | \node[textonly, below=20pt of W2] (inv2) {}; 16 | \node[op, below=40pt of W2] (x2) {$\vect{x}$}; 17 | \node[op, right=30.5pt of inv2] (v2) {$\vect{v}$}; 18 | \node[textonly, left=1.5pt of v2] (matmtul) {matmul}; 19 | \node[textonly, left=40pt of inv2] (inv3) {}; 20 | \node[textonly, below=50.5pt of inv3] (result) {{\large $\vect{v} = \vect{W} \vect{x} $}}; 21 | 22 | % edges 23 | \path[tedge] (W1) -- (v1); 24 | \path[tedge] (x1) -- (v1); 25 | \path[tedge] (W2) -- (v2); 26 | \path[tedge] (x2) -- (v2); 27 | 28 | \end{tikzpicture} 29 | } % scalebox 30 | \end{figure} 31 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/Compgraph2.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.15}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % nodes 10 | \node[op] (W1) {$\vect{W}_{1}$}; 11 | \node[textonly, below=40pt of W1] (inv1) {}; 12 | \node[op, below=20pt of inv1] (x) {$\vect{x}$}; 13 | \node[op, right=30.5pt of inv1] (v) {$\vect{v}$}; 14 | \node[textonly, left=1.5pt of v] (matmtul1) {matmul}; 15 | \node[op, right=35pt of v] (h) {$\vect{h}$}; 16 | \node[op, right=110pt of W1] (W2) {$\vect{W}_{2}$}; 17 | \node[op, right=35pt of h] (z) {$\vect{z}$}; 18 | \node[op, right=55pt of z] (y) {$\hat{\vect{y}}$}; 19 | \node[textonly, above left=1.5pt of z] (matmtul2) {matmul}; 20 | 21 | 22 | % edges 23 | \path[tedge] (W1) -- (v); 24 | \path[tedge] (x) -- (v); 25 | \path[tedge] (v) edge node[above=1pt] {{\Large$\sigma$}} (h); 26 | \path[tedge] (z) edge node[above=1pt] {{\Large softmax}} (y); 27 | \path[tedge] (W2) -- (z); 28 | \path[tedge] (h) -- (z); 29 | 30 | 31 | \end{tikzpicture} 32 | } % scalebox 33 | \end{figure} 34 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/Compgraph3.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.2}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % nodes on the left 10 | \node[op] (W1) {$\vect{W}_{1}$}; 11 | \node[textonly, below=20pt of W1] (inv1) {}; 12 | \node[op, right=30pt of inv1] (v) {$\vect{v}$}; 13 | \node[op, below right=30.5pt of v] (x) {$\vect{x}$}; 14 | \node[op, above=30.5pt of v] (hprime) {$\vect{h}^{\prime}$}; 15 | \node[textonly, above right=2pt of hprime] (h) {{\LARGE$\vect{h}$}}; 16 | 17 | 18 | %% namedscope in the left 19 | \begin{scope}[on background layer] 20 | \coordinate (p1) at (hprime.north); 21 | \coordinate (p2) at (v.south east); 22 | \coordinate (p3) at (W1.west); 23 | \tkzCircumCenter(p1,p2,p3) 24 | \tkzGetPoint{O} 25 | \tkzDrawCircle[draw=orange, line width=1.5pt, fill=orange!60](O,p1) 26 | \end{scope} 27 | 28 | % edges on the left 29 | \path[tedge] (W1) -- (v); 30 | \path[tedge] (x) -- (v); 31 | \path[tedge] (v) -- (hprime); 32 | 33 | % nodes on the right 34 | \node[op, right=30pt of x] (hh) {$\vect{h}$}; 35 | \node[op, above right=30.5pt of hh] (z) {$\vect{z}$}; 36 | \node[op, above=30.5pt of z] (yprime) {$\vect{y}^{\prime}$}; 37 | \node[textonly, right=30pt of z] (inv2) {}; 38 | \node[op, above=20pt of inv2] (W2) {$\vect{W}_{2}$}; 39 | \node[textonly, above left=1pt of yprime] (yhat) {{\LARGE$\hat{\vect{y}}$}}; 40 | 41 | 42 | %% namedscope in the right 43 | \begin{scope}[on background layer] 44 | \coordinate (p1) at (yprime.north); 45 | \coordinate (p2) at (W2.north east); 46 | \coordinate (p3) at (z.south west); 47 | \tkzCircumCenter(p1,p2,p3) 48 | \tkzGetPoint{O} 49 | \tkzDrawCircle[draw=orange, line width=1.5pt, fill=orange!60](O,p1) 50 | \end{scope} 51 | 52 | 53 | 54 | % edges on the right 55 | \path[tedge] (W2) -- (z); 56 | \path[tedge] (hh) -- (z); 57 | \path[tedge] (z) -- (yprime); 58 | 59 | 60 | \end{tikzpicture} 61 | } % scalebox 62 | \end{figure} 63 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/Compgraph4.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.5}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | \node[op] (h) {$\vect{h}$}; 9 | \node[op, above=30pt of h] (y) {$\hat{\vect{y}}$}; 10 | \node[op, below=30pt of h] (x) {$\vect{x}$}; 11 | 12 | 13 | % edges 14 | \path[tedge] (x) -- (h); 15 | \path[tedge] (h) -- (y); 16 | 17 | \end{tikzpicture} 18 | } % scalebox 19 | \end{figure} 20 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/Entropy1.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.3}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % nodes 10 | \node[textonly] (pprob) {$\begin{bmatrix}0.8\\0.2\end{bmatrix}$}; 11 | \node[textonly, right=40pt of pprob] (qprob) {$\begin{bmatrix}0.5\\0.5\end{bmatrix}$}; 12 | \node[textonly, above=1pt of pprob] (p) {$\vect{p}$}; 13 | \node[textonly, above=1pt of qprob] (q) {$\vect{q}$}; 14 | 15 | 16 | \node[textonly, below=20pt of pprob] (Hp) {$H(\vect{p}) = 0.72$}; 17 | \node[textonly, below=20pt of qprob] (Hq) {$H(\vect{q}) = 1$}; 18 | \node[textonly, below=30pt of Hp] (inv1) {}; 19 | \node[textonly, right=-40pt of inv1] (Hquation) {{\Large$H(\vect{p}) = \sum_{i} \vect{p}_i\log\frac{1}{\vect{p}_i}$}}; 20 | 21 | 22 | \end{tikzpicture} 23 | } % scalebox 24 | \end{figure} 25 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/Entropy2.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.0}{ 5 | \begin{tikzpicture} 6 | \begin{axis}% 7 | [ 8 | grid=major, 9 | xmin=0, 10 | xmax=1, 11 | axis x line=bottom, 12 | ytick={0,.5,1}, 13 | ymax=1.1, 14 | axis y line=middle, 15 | xlabel= $p$, 16 | ylabel= $H(\vect{p})$, 17 | ] 18 | \addplot% 19 | [ orange!180, 20 | ultra thick, 21 | % blue,% 22 | mark=none, 23 | samples=200, 24 | domain=0.0001:0.9999, 25 | ] 26 | (x,{(x*log2(1/x)) + ((1-x)*log2(1/(1-x)))}); 27 | \end{axis} 28 | \node[textonly] (pprob) at (8.75,2.8) {{\Large$\begin{bmatrix}p\\1-p\end{bmatrix}$}}; 29 | \node[textonly, above=1pt of pprob] (p) {{\Large$\vect{p}$}}; 30 | \end{tikzpicture} 31 | } % scalebox 32 | \end{figure} -------------------------------------------------------------------------------- /RNN/src/TikzFiles/KullbackLeibler.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.3}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % nodes 10 | \node[textonly] (p1prob) {$\begin{bmatrix}0.8\\0.2\end{bmatrix}$}; 11 | \node[textonly, right=30pt of p1prob] (q1prob) {$\begin{bmatrix}0.5\\0.5\end{bmatrix}$}; 12 | \node[textonly, above=1pt of p1prob] (p1) {$\vect{p}$}; 13 | \node[textonly, above=1pt of q1prob] (q1) {$\vect{q}$}; 14 | \node[textonly, right=20pt of q1prob] (p2prob) {$\begin{bmatrix}0.8\\0.2\end{bmatrix}$}; 15 | \node[textonly, right=30pt of p2prob] (q2prob) {$\begin{bmatrix}0.88\\0.12\end{bmatrix}$}; 16 | \node[textonly, above=1pt of p2prob] (p2) {$\vect{p}^{\prime}$}; 17 | \node[textonly, above=1pt of q2prob] (q2) {$\vect{q}^{\prime}$}; 18 | 19 | 20 | \node[textonly, below right=20pt and -15pt of p1prob] (Dkl1) {$D_{KL}(\vect{p}||\vect{q}) = 0.28$}; 21 | \node[textonly, below right=20pt and -15pt of p2prob] (Dkl2) {$D_{KL}(\vect{p}^{\prime}||\vect{q}^{\prime}) = 0.04$}; 22 | \node[textonly, below=20pt of Dkl1] (inv1) {}; 23 | \node[textonly, right=-40pt of inv1] (Dklequation) {{\Large$D_{KL}(\vect{p}||\vect{q}) = \sum_{i} \vect{p}_i\log\frac{\vect{p}_i}{\vect{q}_i}$}}; 24 | 25 | 26 | 27 | % edges 28 | \draw[orange!120, line width=1mm] (Dkl1) to [out=150,in=-90] (p1prob); 29 | \draw[orange!120, line width=1mm] (Dkl1) to [out=150,in=-100] (q1prob); 30 | 31 | \draw[orange!120, line width=1mm] (Dkl2) to [out=150,in=-90] (p2prob); 32 | \draw[orange!120, line width=1mm] (Dkl2) to [out=150,in=-100] (q2prob); 33 | 34 | \end{tikzpicture} 35 | } % scalebox 36 | \end{figure} 37 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/LSTM_cell.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.75}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % RNN state cell ============================= 8 | \node[state] (h) {$\vect{h}$}; 9 | \node[op, above right=25pt and 10pt of h] (add1) {$add(\vect{W}_{f},\vect{U}_{f})$}; 10 | \node[op,right=25pt of add1] (add2) {$add(\vect{W}_{i},\vect{U}_{i})$}; 11 | \node[op,right=25pt of add2] (add3) {$add(\vect{W}_{\tilde{c}},\vect{U}_{\tilde{c}})$}; 12 | \node[op,right=25pt of add3] (add4) {$add(\vect{W}_{o},\vect{U}_{o})$}; 13 | \node[op,above=20pt of add1] (f) {$\vect{f}$}; 14 | \node[op,above=20pt of add2] (i) {$\vect{i}$}; 15 | \node[op,above=20pt of add3] (tildec) {$\vect{\tilde{c}}$}; 16 | \node[op,above=20pt of add4] (o) {$\vect{o}$}; 17 | \node[op,above=20pt of f] (haddamar1) {$\circ$}; 18 | \node[state,above left=20pt and 20pt of haddamar1] (C) {$\vect{C}$}; 19 | \node[op,above right=20pt and 20pt of i] (haddamar2) {$\circ$}; 20 | \node[state,above left=20pt and 20pt of haddamar2] (Cprime) {$\vect{C}^{\prime}$}; 21 | \node[op, below right=3pt and 70pt of Cprime] (tanh) {$tanh$}; 22 | \node[state, right=50pt of o] (hprime) {$\vect{h}^{\prime}$}; 23 | \node[textonly,right=180pt of h] (inv1) {}; 24 | \node[op, below=30pt of inv1] (x) {$\vect{x}$}; 25 | \node[textonly, below=2pt of Cprime] (name1) {$+$}; 26 | \node[textonly, below=2pt of hprime] (name2) {$\circ$}; 27 | 28 | 29 | 30 | 31 | %% namedscope 32 | \node[draw=orange, fit= (C) (h) (hprime), line width=1.5pt, fill=orange!60, fill opacity=0.2] {}; 33 | 34 | 35 | 36 | 37 | % edges 38 | \path[tedge] (x) to (add1); 39 | \path[tedge] (x)--(add2); 40 | \path[tedge] (x)--(add3); 41 | \path[tedge] (x)--(add4); 42 | \path[tedge] (h)--(add1); 43 | \path[tedge] (h) to [in=280, distance=5pt] (add2); 44 | \path[tedge] (h)to [in=280, distance=5pt](add3); 45 | \path[tedge] (h)to [in=280, distance=5pt](add4); 46 | \path[tedge] (add1) edge node[below right= -7pt] {$\;\; \Large{\sigma}$} (f); 47 | \path[tedge] (add2) edge node[below right= -7pt] {$\;\; \Large{\sigma}$} (i); 48 | \path[tedge] (add3) edge node[below right= -7pt] {$\;\; \Large{tanh}$} (tildec); 49 | \path[tedge] (add4) edge node[below right= -7pt] {$\;\; \Large{\sigma}$} (o); 50 | \path[tedge] (f)--(haddamar1); 51 | \path[tedge] (haddamar1)--(Cprime); 52 | \path[tedge] (C)--(haddamar1); 53 | \path[tedge] (i)--(haddamar2); 54 | \path[tedge] (tildec)--(haddamar2); 55 | \path[tedge] (Cprime)--(tanh); 56 | \path[tedge] (haddamar2)--(Cprime); 57 | \path[tedge] (tanh)--(hprime); 58 | \path[tedge] (tanh)--(hprime); 59 | \path[tedge] (o)--(hprime); 60 | 61 | \end{tikzpicture} 62 | } % scalebox 63 | \end{figure} 64 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/LSTM_simplified.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.40}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % RNN state cell ============================= 8 | \node[state] (h) {$\vect{h}$}; 9 | \node[op, below=30pt of h] (x) {$\vect{x}$}; 10 | \node[state, above left=10pt and 10pt of h] (C) {$\vect{C}$}; 11 | \node[textonly, above right=5pt and 5pt of h] (inv1) {}; 12 | \node[op, above=50pt of h] (yhat) {$\hat{\vect{y}}$}; 13 | \node[textonly, right=55pt of C] (inv2) {}; 14 | \node[textonly, right=30pt of h] (inv3) {}; 15 | 16 | 17 | 18 | %% namedscope LSTM cell 19 | \begin{scope}[on background layer] 20 | \coordinate (p1) at (inv1.north); 21 | \coordinate (p2) at (h.south east); 22 | \coordinate (p3) at (C.north west); 23 | \tkzCircumCenter(p1,p2,p3) 24 | \tkzGetPoint{O} 25 | \tkzDrawCircle[draw=orange, line width=1.5pt, fill=orange!60](O,p1) 26 | \end{scope} 27 | 28 | 29 | % edges 30 | \path[tedge] (x) -- (h) ; 31 | \path[tedge] (h) -- (yhat); 32 | \path[tedge] (h) -- (inv3); 33 | \path[tedge] (C) -- (inv2); 34 | 35 | 36 | \end{tikzpicture} 37 | } % scalebox 38 | \end{figure} 39 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/LSTM_unfolded.tex: -------------------------------------------------------------------------------- 1 | % RNN STATE CELL ==================================== 2 | \newcommand{\rnnSimple}[4]{ 3 | 4 | % operations 5 | \node[state, minimum size=30pt,#4] (h#3) {$\vect{h}^{#1}$}; 6 | \node[state, minimum size=30pt,above left=10pt and 10pt of h#3] (C#3) {$\vect{C}^{#1}$}; 7 | \node[textonly, above right=5pt and 5pt of h#3] (inv#3) {}; 8 | \node[op, minimum size=40pt,below=30pt of h#3] (x#3) {$\vect{x}^{#1}$}; 9 | \node[op, minimum size=40pt, above=50pt of h#3] (yhat#3) {$\hat{\vect{y}}^{#1}$}; 10 | 11 | 12 | %% namedscope LSTM cell 13 | \begin{scope}[on background layer] 14 | \coordinate (p1) at (inv#3.north); 15 | \coordinate (p2) at (h#3.south east); 16 | \coordinate (p3) at (C#3.north west); 17 | \tkzCircumCenter(p1,p2,p3) 18 | \tkzGetPoint{O} 19 | \tkzDrawCircle[draw=orange, line width=1.5pt, fill=orange!60](O,p1) 20 | \end{scope} 21 | 22 | 23 | % edges 24 | \path[tedge] (x#3) -- (h#3); 25 | \path[tedge] (h#3)-- (yhat#3); 26 | } 27 | 28 | \begin{figure}[ht!] 29 | \hspace*{-1.0cm} 30 | \scalebox{0.9}{ 31 | \begin{tikzpicture}[auto] 32 | 33 | % timestep 1 34 | \rnnSimple{(1)}{(0)}{t1}{} 35 | 36 | % % timestep 0 37 | \node[state, minimum size=30pt,left=50pt of ht1] (ht0) {$\vect{h}^{(0)}$}; 38 | \node[state, minimum size=30pt,left=17pt of Ct1] (Ct0) {$\vect{C}^{(0)}$}; 39 | 40 | % % timestep 2 41 | \rnnSimple{(2)}{(1)}{t2}{right=50pt of ht1}; 42 | 43 | 44 | % % timestep 2 45 | \rnnSimple{(3)}{(1)}{t3}{right=50pt of ht2}; 46 | 47 | 48 | % % state transfers 49 | \path[tedge] (ht0) -- (ht1); 50 | \path[tedge] (ht1) -- (ht2); 51 | \path[tedge] (ht2) -- (ht3); 52 | \path[tedge] (Ct0) -- (Ct1); 53 | \path[tedge] (Ct1) -- (Ct2); 54 | \path[tedge] (Ct2) -- (Ct3); 55 | 56 | 57 | 58 | \end{tikzpicture} 59 | }%\scalebox 60 | \end{figure} 61 | 62 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/LanguageModelExpanded.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.62}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | 8 | % RNN state cell ============================= 9 | \node[state] (hprime) {$\vect{h}^{\prime}$}; 10 | \node[op, below=15pt of hprime] (a) {$\vect{a}$}; 11 | 12 | \node[op, right=25pt of a] (b) {$\vect{b}$}; 13 | \node[noop, below left=10pt and 10pt of a] (noop-left) {}; 14 | \node[state, below left=12pt and 0.1pt of noop-left] (h) {$\vect{h}$}; 15 | \node[op, above left=8pt and 15pt of noop-left] (W) {$\vect{W}$}; 16 | 17 | \node[noop, below right=10pt and 10pt of a] (noop-right) {}; 18 | \node[op, below right=12pt and 0.05pt of noop-right] (U) {$\vect{U}$}; 19 | 20 | 21 | % Input layer ============================= 22 | \node[op, below=75pt of a] (e) {$\vect{e}$}; 23 | \node[op, below left=10pt and 10pt of e] (x) {$\vect{x}$}; 24 | \node[op, below right=10pt and 10pt of e] (E) {$\vect{E}$}; 25 | 26 | %% namedscope 27 | \begin{scope}[on background layer] 28 | \coordinate (p1) at (hprime.north); 29 | \coordinate (p2) at (U.south east); 30 | \coordinate (p3) at (h.south west); 31 | \tkzCircumCenter(p1,p2,p3) 32 | \tkzGetPoint{O} 33 | \tkzDrawCircle[draw=orange, line width=1.5pt, fill=orange!60](O,p1) 34 | \end{scope} 35 | 36 | % edges 37 | 38 | \path[tedge] (a) edge node[below right= -7pt] {$\;\; \LARGE{\sigma}$} (hprime); 39 | \path[tedge] (b) -- (a); 40 | \path[tedge] (noop-left) -- (a); 41 | \path[tedge] (noop-right) -- (a); 42 | \path[tedge] (W) -- (noop-left); 43 | \path[tedge] (h.north) to [bend left, out=70, distance=5pt] (noop-left.west); 44 | \path[tedge] (U.north) to [bend right, out=-50, distance=5pt] (noop-right.east); 45 | \path[tedge] (x) -- (e); 46 | \path[tedge] (E) -- (e); 47 | \path[tedge] (e) -- (noop-right); 48 | 49 | % RNN output cell ============================= 50 | 51 | % operations 52 | \node[noop, above=25pt of hprime] (noop-center) {}; 53 | \node[op, above=50pt of hprime] (o) {$\vect{o}$}; 54 | \node[op, right=15pt of o] (c) {$\vect{c}$}; 55 | \node[op, above=15pt of o] (yhat) {$\hat{\textbf{y}}$}; 56 | \node[op, below left=1pt and 10pt of o] (V) {$\vect{V}$}; 57 | 58 | % paths 59 | \path[tedge] (hprime) -- (noop-center); 60 | \path[tedge] (o) edge node[below right= -10pt] {$\;\;$softmax} (yhat); 61 | \path[tedge] (c) -- (o); 62 | \path[tedge] (V) -- (noop-center); 63 | \path[tedge] (noop-center) -- (o); 64 | 65 | % namedscope 66 | \begin{scope}[on background layer] 67 | \coordinate (p4) at (yhat.north); 68 | \coordinate (p5) at (V.south west); 69 | \coordinate (p6) at (c.east); 70 | \tkzCircumCenter(p4,p5,p6) 71 | \tkzGetPoint{O} 72 | \tkzDrawCircle[draw=orange, line width=1.5pt, fill=orange!60](O,p4) 73 | \end{scope} 74 | 75 | %% namedscope 76 | \begin{scope}[on background layer] 77 | \coordinate (p7) at (e.north); 78 | \coordinate (p8) at (E.east); 79 | \coordinate (p9) at (x.west); 80 | \tkzCircumCenter(p7,p8,p9) 81 | \tkzGetPoint{O} 82 | \tkzDrawCircle[draw=orange, line width=1.5pt, fill=orange!60](O,p7) 83 | \end{scope} 84 | 85 | %% Info 86 | \node[textonly, below right=20pt and 1pt of E] (inv1) {}; 87 | \node[textonly, above right=20pt and 1pt of E] (inv2) {}; 88 | \node[textonly, right=70pt of E] (embedding) {Embedding layer}; 89 | 90 | 91 | % % info edges 92 | \draw[orange!120, line width=1mm] (embedding) to [out=-180,in=0] (inv1); 93 | \draw[orange!120, line width=1mm] (embedding) to [out=-180,in=0] (inv2); 94 | 95 | \end{tikzpicture} 96 | } % scalebox 97 | \end{figure} 98 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/LanguageModelSimplified.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.40}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % RNN state cell ============================= 8 | \node[state] (h) {$\vect{h}$}; 9 | \node[op, below=30pt of h] (e) {$\vect{e}$}; 10 | \node[op, above=30pt of h] (yhat) {$\hat{\vect{y}}$}; 11 | 12 | 13 | 14 | % edges 15 | \path[tedge] (e) edge node[below right= -4pt] {$\vect{U}$} (h) ; 16 | \path[tedge] (h) edge [out=-400,in=-320,looseness=8, distance=125pt] node[above right] {$\vect{W}$} (h); 17 | \path[tedge] (h) edge node[below right = -4pt] {$\vect{V}$} (yhat); 18 | 19 | 20 | \end{tikzpicture} 21 | } % scalebox 22 | \end{figure} 23 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/LanguageModelUnfolded.tex: -------------------------------------------------------------------------------- 1 | % RNN STATE CELL ==================================== 2 | \newcommand{\rnnSimple}[4]{ 3 | 4 | % operations 5 | \node[state, minimum size=40pt,#4] (h#3) {$\vect{h}^{#1}$}; 6 | \node[op, minimum size=40pt, above=30pt of h#3] (yhat#3){$\hat{\vect{y}}^{#1}$}; 7 | \node[op, minimum size=40pt,below=30pt of h#3] (e#3) {$\vect{e}^{#1}$}; 8 | \node[textonly, below=0.1pt of e#3] {{\Large#2}}; 9 | 10 | % edges 11 | \path[tedge] (e#3) edge node[below right= -4pt] {$\vect{U}$} (h#3); 12 | \path[tedge] (h#3) edge node[below right = -4pt] {$\vect{V}$} (yhat#3); 13 | } 14 | 15 | \begin{figure}[ht!] 16 | \hspace*{-1.0cm} 17 | \scalebox{0.8}{ 18 | \begin{tikzpicture}[auto] 19 | 20 | % timestep 1 21 | \rnnSimple{(1)}{Yes}{t1}{} 22 | 23 | % % timestep 0 24 | \node[state, minimum size=40pt,left=50pt of ht1] (ht0) {$\vect{h}^{(0)}$}; 25 | 26 | % % timestep 2 27 | \rnnSimple{(2)}{here}{t2}{right=50pt of ht1}; 28 | 29 | 30 | % % timestep 2 31 | \rnnSimple{(3)}{we}{t3}{right=50pt of ht2}; 32 | 33 | 34 | % % state transfers 35 | \path[tedge] (ht0) edge node[above right = 2pt] {$\vect{W}$} (ht1); 36 | \path[tedge] (ht1) edge node[above right = 2pt] {$\vect{W}$} (ht2); 37 | \path[tedge] (ht2) edge node[above right = 2pt] {$\vect{W}$} (ht3); 38 | 39 | % text 40 | \node[textonly, above=40pt of yhatt2] (result) {{\Large $P(x^{(4)}| \text{Yes, here, we})$}}; 41 | 42 | % Arrow to result 43 | % \path[tedge] (yhatt3) edge node[bend right, out=-50, distance=25pt] (result); 44 | \draw[->, line width=1mm] [bend right, out=-50, distance=25pt](yhatt3.north) to (result.east); 45 | % \path[tedge] (yhatt3.north) to [bend right, out=-50, distance=25pt] (result.east); 46 | 47 | 48 | \end{tikzpicture} 49 | }%\scalebox 50 | \end{figure} 51 | 52 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/OldNN1.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.7}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % input layer 10 | \node[op] (x5) {$x_5$}; 11 | \node[op, above=2.5pt of x5] (x4) {$x_4$}; 12 | \node[op, above=2.5pt of x4] (x3) {$x_3$}; 13 | \node[op, above=2.5pt of x3] (x2) {$x_2$}; 14 | \node[op, above=2.5pt of x2] (x1) {$x_1$}; 15 | \node[op, below=2.5pt of x5] (x6) {$x_6$}; 16 | \node[op, below=2.5pt of x6] (x7) {$x_7$}; 17 | \node[op, below=2.5pt of x7] (x8) {$x_8$}; 18 | \node[op, below=2.5pt of x8] (x9) {$x_9$}; 19 | \node[op, below=2.5pt of x9] (x10) {$x_{10}$}; 20 | 21 | % hidden layer 22 | \node[op, right=130pt of x5] (v2) {$v_2$}; 23 | \node[op, below=2.5pt of v2] (v3) {$v_3$}; 24 | \node[op, below=2.5pt of v3] (v4) {$v_4$}; 25 | \node[op, above=2.5pt of v2] (v1) {$v_1$}; 26 | 27 | \node[op, right=40pt of v2] (h2) {$h_2$}; 28 | \node[op, below=2.5pt of h2] (h3) {$h_3$}; 29 | \node[op, below=2.5pt of h3] (h4) {$h_4$}; 30 | \node[op, above=2.5pt of h2] (h1) {$h_1$}; 31 | 32 | 33 | % output layer 34 | \node[op, right=60pt of h2] (z1) {$z_1$}; 35 | \node[op, right=60pt of h3] (z2) {$z_2$}; 36 | 37 | \node[op, right=50pt of z1] (y1) {$\hat{y}_1$}; 38 | \node[op, right=50pt of z2] (y2) {$\hat{y}_2$}; 39 | 40 | 41 | % edges input layer to hidden 42 | \path[tedge] (x1) -- (v1); 43 | \path[tedge] (x1) -- (v2); 44 | \path[tedge] (x1) -- (v3); 45 | \path[tedge] (x1) -- (v4); 46 | 47 | \path[tedge] (x2) -- (v1); 48 | \path[tedge] (x2) -- (v2); 49 | \path[tedge] (x2) -- (v3); 50 | \path[tedge] (x2) -- (v4); 51 | 52 | \path[tedge] (x3) -- (v1); 53 | \path[tedge] (x3) -- (v2); 54 | \path[tedge] (x3) -- (v3); 55 | \path[tedge] (x3) -- (v4); 56 | 57 | \path[tedge] (x4) -- (v1); 58 | \path[tedge] (x4) -- (v2); 59 | \path[tedge] (x4) -- (v3); 60 | \path[tedge] (x4) -- (v4); 61 | 62 | \path[tedge] (x5) -- (v1); 63 | \path[tedge] (x5) -- (v2); 64 | \path[tedge] (x5) -- (v3); 65 | \path[tedge] (x5) -- (v4); 66 | 67 | \path[tedge] (x6) -- (v1); 68 | \path[tedge] (x6) -- (v2); 69 | \path[tedge] (x6) -- (v3); 70 | \path[tedge] (x6) -- (v4); 71 | 72 | \path[tedge] (x7) -- (v1); 73 | \path[tedge] (x7) -- (v2); 74 | \path[tedge] (x7) -- (v3); 75 | \path[tedge] (x7) -- (v4); 76 | 77 | \path[tedge] (x8) -- (v1); 78 | \path[tedge] (x8) -- (v2); 79 | \path[tedge] (x8) -- (v3); 80 | \path[tedge] (x8) -- (v4); 81 | 82 | \path[tedge] (x9) -- (v1); 83 | \path[tedge] (x9) -- (v2); 84 | \path[tedge] (x9) -- (v3); 85 | \path[tedge] (x9) -- (v4); 86 | 87 | \path[tedge] (x10) -- (v1); 88 | \path[tedge] (x10) -- (v2); 89 | \path[tedge] (x10) -- (v3); 90 | \path[tedge] (x10) -- (v4); 91 | 92 | % edges hidden to hidden 93 | \path[tedge] (v1) edge node[above=1pt] {{\Large$\sigma$}} (h1) ; 94 | \path[tedge] (v2) edge node[above=1pt] {{\Large$\sigma$}} (h2) ; 95 | \path[tedge] (v3) edge node[above=1pt] {{\Large$\sigma$}} (h3) ; 96 | \path[tedge] (v4) edge node[above=1pt] {{\Large$\sigma$}} (h4) ; 97 | 98 | % edges hidden to output 99 | \path[tedge] (h1) -- (z1); 100 | \path[tedge] (h1) -- (z2); 101 | 102 | \path[tedge] (h2) -- (z1); 103 | \path[tedge] (h2) -- (z2); 104 | 105 | \path[tedge] (h3) -- (z1); 106 | \path[tedge] (h3) -- (z2); 107 | 108 | \path[tedge] (h4) -- (z1); 109 | \path[tedge] (h4) -- (z2); 110 | 111 | % edges output to output 112 | \path[tedge] (z1) edge node[above=1pt] {{\Large softmax}} (y1) ; 113 | \path[tedge] (z2) edge node[above=1pt] {{\Large softmax}} (y2) ; 114 | 115 | 116 | 117 | 118 | \end{tikzpicture} 119 | } % scalebox 120 | \end{figure} 121 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/OldNN2.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.7}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % input layer 10 | \node[op] (x5) {}; 11 | \node[op, above=2.5pt of x5] (x4) {}; 12 | \node[op, above=2.5pt of x4] (x3) {}; 13 | \node[op, above=2.5pt of x3] (x2) {}; 14 | \node[op, above=2.5pt of x2] (x1) {}; 15 | \node[op, below=2.5pt of x5] (x6) {}; 16 | \node[op, below=2.5pt of x6] (x7) {}; 17 | \node[op, below=2.5pt of x7] (x8) {}; 18 | \node[op, below=2.5pt of x8] (x9) {}; 19 | \node[op, below=2.5pt of x9] (x10) {}; 20 | 21 | \node[textonly, above=2.5pt of x1] (x) {{\LARGE$\vect{x}$}}; 22 | \node[textonly, below=4.5pt of x10] (input) {{\large Input layer}}; 23 | 24 | % hidden layer 25 | \node[op, right=130pt of x5] (h2) {}; 26 | \node[op, below=2.5pt of h2] (h3) {}; 27 | \node[op, below=2.5pt of h3] (h4) {}; 28 | \node[op, above=2.5pt of h2] (h1) {}; 29 | 30 | \node[textonly, above=2.5pt of h1] (h) {{\LARGE$\vect{h}$}}; 31 | \node[textonly, below=4.5pt of h4] (hidden) {{\large Hidden layer}}; 32 | 33 | % output layer 34 | \node[op, right=60pt of h2] (y1) {}; 35 | \node[op, right=60pt of h3] (y2) {}; 36 | 37 | \node[textonly, above=2.5pt of y1] (y) {{\LARGE$\hat{\vect{y}}$}}; 38 | \node[textonly, below=4.5pt of y2] (output) {{\large Output layer}}; 39 | 40 | % edges input layer to hidden 41 | \path[tedge] (x1) -- (h1); 42 | \path[tedge] (x1) -- (h2); 43 | \path[tedge] (x1) -- (h3); 44 | \path[tedge] (x1) -- (h4); 45 | 46 | \path[tedge] (x2) -- (h1); 47 | \path[tedge] (x2) -- (h2); 48 | \path[tedge] (x2) -- (h3); 49 | \path[tedge] (x2) -- (h4); 50 | 51 | \path[tedge] (x3) -- (h1); 52 | \path[tedge] (x3) -- (h2); 53 | \path[tedge] (x3) -- (h3); 54 | \path[tedge] (x3) -- (h4); 55 | 56 | \path[tedge] (x4) -- (h1); 57 | \path[tedge] (x4) -- (h2); 58 | \path[tedge] (x4) -- (h3); 59 | \path[tedge] (x4) -- (h4); 60 | 61 | \path[tedge] (x5) -- (h1); 62 | \path[tedge] (x5) -- (h2); 63 | \path[tedge] (x5) -- (h3); 64 | \path[tedge] (x5) -- (h4); 65 | 66 | \path[tedge] (x6) -- (h1); 67 | \path[tedge] (x6) -- (h2); 68 | \path[tedge] (x6) -- (h3); 69 | \path[tedge] (x6) -- (h4); 70 | 71 | \path[tedge] (x7) -- (h1); 72 | \path[tedge] (x7) -- (h2); 73 | \path[tedge] (x7) -- (h3); 74 | \path[tedge] (x7) -- (h4); 75 | 76 | \path[tedge] (x8) -- (h1); 77 | \path[tedge] (x8) -- (h2); 78 | \path[tedge] (x8) -- (h3); 79 | \path[tedge] (x8) -- (h4); 80 | 81 | \path[tedge] (x9) -- (h1); 82 | \path[tedge] (x9) -- (h2); 83 | \path[tedge] (x9) -- (h3); 84 | \path[tedge] (x9) -- (h4); 85 | 86 | \path[tedge] (x10) -- (h1); 87 | \path[tedge] (x10) -- (h2); 88 | \path[tedge] (x10) -- (h3); 89 | \path[tedge] (x10) -- (h4); 90 | 91 | % edges hidden to output 92 | \path[tedge] (h1) -- (y1); 93 | \path[tedge] (h1) -- (y2); 94 | 95 | \path[tedge] (h2) -- (y1); 96 | \path[tedge] (h2) -- (y2); 97 | 98 | \path[tedge] (h3) -- (y1); 99 | \path[tedge] (h3) -- (y2); 100 | 101 | \path[tedge] (h4) -- (y1); 102 | \path[tedge] (h4) -- (y2); 103 | 104 | 105 | 106 | \end{tikzpicture} 107 | } % scalebox 108 | \end{figure} 109 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/OldNN3.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.7}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % input layer 10 | \node[op] (x5) {}; 11 | \node[op, above=2.5pt of x5] (x4) {}; 12 | \node[op, above=2.5pt of x4] (x3) {}; 13 | \node[op, above=2.5pt of x3] (x2) {}; 14 | \node[op, above=2.5pt of x2] (x1) {}; 15 | \node[op, below=2.5pt of x5] (x6) {}; 16 | \node[op, below=2.5pt of x6] (x7) {}; 17 | \node[op, below=2.5pt of x7] (x8) {}; 18 | \node[op, below=2.5pt of x8] (x9) {}; 19 | \node[op, below=2.5pt of x9] (x10) {}; 20 | 21 | \node[textonly, above=2.5pt of x1] (x) {{\LARGE$\vect{x}$}}; 22 | \node[textonly, below=4.5pt of x10] (input) {{\large Input layer}}; 23 | 24 | % hidden layer 25 | \node[op, right=130pt of x5] (h2) {}; 26 | \node[op, below=2.5pt of h2] (h3) {}; 27 | \node[op, below=2.5pt of h3] (h4) {}; 28 | \node[op, above=2.5pt of h2] (h1) {}; 29 | 30 | \node[textonly, above=2.5pt of h1] (h) {{\LARGE$\vect{h}$}}; 31 | \node[textonly, below=4.5pt of h4] (hidden) {{\large Hidden layer}}; 32 | 33 | % output layer 34 | \node[op, right=60pt of h2] (y1) {}; 35 | \node[op, right=60pt of h3] (y2) {}; 36 | 37 | \node[textonly, above=2.5pt of y1] (y) {{\LARGE$\hat{\vect{y}}$}}; 38 | \node[textonly, below=4.5pt of y2] (output) {{\large Output layer}}; 39 | 40 | % edges input layer to hidden 41 | \draw[line width=0.5mm] (x1) -- (hidden); 42 | \draw[line width=0.5mm] (x10) -- (h); 43 | 44 | % edges hidden to output 45 | \draw [line width=0.5mm] (h1) -- (output); 46 | \draw [line width=0.5mm] (h4) -- (y); 47 | 48 | \end{tikzpicture} 49 | } % scalebox 50 | \end{figure} 51 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/RNNGraphExpanded.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.75}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % RNN state cell ============================= 8 | \node[state] (hprime) {$\vect{h}^{\prime}$}; 9 | \node[op, below=15pt of hprime] (a) {$\vect{a}$}; 10 | 11 | \node[op, right=25pt of a] (b) {$\vect{b}$}; 12 | \node[noop, below left=10pt and 10pt of a] (noop-left) {}; 13 | \node[state, below left=12pt and 0.1pt of noop-left] (h) {$\vect{h}$}; 14 | \node[op, above left=8pt and 15pt of noop-left] (W) {$\vect{W}$}; 15 | 16 | \node[noop, below right=10pt and 10pt of a] (noop-right) {}; 17 | \node[op, below right=12pt and 0.05pt of noop-right] (U) {$\vect{U}$}; 18 | 19 | 20 | % outer operations 21 | \node[op, below=75pt of a] (x) {$\vect{x}$}; 22 | 23 | %% namedscope 24 | \begin{scope}[on background layer] 25 | \coordinate (p1) at (hprime.north); 26 | \coordinate (p2) at (U.south east); 27 | \coordinate (p3) at (h.south west); 28 | \tkzCircumCenter(p1,p2,p3) 29 | \tkzGetPoint{O} 30 | \tkzDrawCircle[draw=orange, line width=1.5pt, fill=orange!60](O,p1) 31 | \end{scope} 32 | 33 | % edges 34 | 35 | \path[tedge] (a) edge node[below right= -7pt] {$\;\; \Large{\sigma}$} (hprime); 36 | \path[tedge] (b) -- (a); 37 | \path[tedge] (noop-left) -- (a); 38 | \path[tedge] (noop-right) -- (a); 39 | \path[tedge] (W) -- (noop-left); 40 | \path[tedge] (h.north) to [bend left, out=70, distance=5pt] (noop-left.west); 41 | \path[tedge] (U.north) to [bend right, out=-50, distance=5pt] (noop-right.east); 42 | \path[tedge] (x) -- (noop-right); 43 | 44 | % RNN output cell ============================= 45 | 46 | % operations 47 | \node[noop, above=25pt of hprime] (noop-center) {}; 48 | \node[op, above=50pt of hprime] (o) {$\vect{o}$}; 49 | \node[op, right=15pt of o] (c) {$\vect{c}$}; 50 | \node[op, above=15pt of o] (yhat) {$\hat{\textbf{y}}$}; 51 | \node[op, below left=1pt and 10pt of o] (V) {$\vect{V}$}; 52 | 53 | % paths 54 | \path[tedge] (hprime) -- (noop-center); 55 | \path[tedge] (o) edge node[below right= -10pt] {$\;\;$softmax} (yhat); 56 | \path[tedge] (c) -- (o); 57 | \path[tedge] (V) -- (noop-center); 58 | \path[tedge] (noop-center) -- (o); 59 | 60 | % namedscope 61 | \begin{scope}[on background layer] 62 | \coordinate (p4) at (yhat.north); 63 | \coordinate (p5) at (V.south west); 64 | \coordinate (p6) at (c.east); 65 | \tkzCircumCenter(p4,p5,p6) 66 | \tkzGetPoint{O} 67 | \tkzDrawCircle[draw=orange, line width=1.5pt, fill=orange!60](O,p4) 68 | \end{scope} 69 | 70 | \end{tikzpicture} 71 | } % scalebox 72 | \end{figure} 73 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/RNNSimplified.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.40}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % RNN state cell ============================= 8 | \node[state] (h) {$\vect{h}$}; 9 | \node[op, below=30pt of h] (x) {$\vect{x}$}; 10 | \node[op, above=30pt of h] (yhat) {$\hat{\vect{y}}$}; 11 | 12 | 13 | 14 | % edges 15 | \path[tedge] (x) edge node[below right= -4pt] {$\vect{U}$} (h) ; 16 | \path[tedge] (h) edge [out=-400,in=-320,looseness=8, distance=125pt] node[above right] {$\vect{W}$} (h); 17 | \path[tedge] (h) edge node[below right = -4pt] {$\vect{V}$} (yhat); 18 | 19 | 20 | \end{tikzpicture} 21 | } % scalebox 22 | \end{figure} 23 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/RNNSimplifiedUnfolded.tex: -------------------------------------------------------------------------------- 1 | % RNN STATE CELL ==================================== 2 | \newcommand{\rnnSimple}[4]{ 3 | 4 | % operations 5 | \node[state, minimum size=40pt,#4] (h#3) {$\vect{h}^{#1}$}; 6 | \node[op, minimum size=40pt,below=30pt of h#3] (x#3) {$\vect{x}^{#1}$}; 7 | \node[op, minimum size=40pt, above=30pt of h#3] (yhat#3) {$\hat{\vect{y}}^{#1}$}; 8 | 9 | % edges 10 | \path[tedge] (x#3) edge node[below right= -4pt] {$\vect{U}$} (h#3); 11 | \path[tedge] (h#3) edge node[below right = -4pt] {$\vect{V}$} (yhat#3); 12 | } 13 | 14 | \begin{figure}[ht!] 15 | \hspace*{-1.0cm} 16 | \scalebox{0.9}{ 17 | \begin{tikzpicture}[auto] 18 | 19 | % timestep 1 20 | \rnnSimple{(1)}{(0)}{t1}{} 21 | 22 | % % timestep 0 23 | \node[state, minimum size=40pt,left=50pt of ht1] (ht0) {$\vect{h}^{(0)}$}; 24 | 25 | % % timestep 2 26 | \rnnSimple{(2)}{(1)}{t2}{right=50pt of ht1}; 27 | 28 | 29 | % % timestep 2 30 | \rnnSimple{(3)}{(1)}{t3}{right=50pt of ht2}; 31 | 32 | 33 | % % state transfers 34 | \path[tedge] (ht0) edge node[above right = 2pt] {$\vect{W}$} (ht1); 35 | \path[tedge] (ht1) edge node[above right = 2pt] {$\vect{W}$} (ht2); 36 | \path[tedge] (ht2) edge node[above right = 2pt] {$\vect{W}$} (ht3); 37 | 38 | \end{tikzpicture} 39 | }%\scalebox 40 | \end{figure} 41 | 42 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/Sigmoid.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.0}{ 5 | \begin{tikzpicture} 6 | \begin{axis}% 7 | [ 8 | grid=major, 9 | xmin=-6, 10 | xmax=6, 11 | axis x line=bottom, 12 | ytick={0,.5,1}, 13 | ymax=1, 14 | axis y line=middle, 15 | ] 16 | \addplot% 17 | [ orange!180, 18 | ultra thick, 19 | % blue,% 20 | mark=none, 21 | samples=100, 22 | domain=-6:6, 23 | ] 24 | (x,{1/(1+exp(-x))}); 25 | \end{axis} 26 | \node[textonly] (sigmoid) at (8.75,2.8) {{\Large$\sigma(x) = \frac{1}{1 + e^{-x}}$}}; 27 | \end{tikzpicture} 28 | } % scalebox 29 | \end{figure} -------------------------------------------------------------------------------- /RNN/src/TikzFiles/Softmax.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.3}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | 9 | % nodes 10 | \node[textonly] (logits) {$\begin{bmatrix}3.82\\5.35\\1.44\\-1.26\\2.71 \\1.98\end{bmatrix}$}; 11 | \node[textonly, right=60pt of logits] (softmax) {$\begin{bmatrix}0.16115195\\0.74422819\\0.01491471\\0.00100235\\0.05310907 \\0.02559374\end{bmatrix}$}; 12 | \node[textonly, below=15pt of logits] (inv1) {}; 13 | \node[textonly, right=10pt of inv1] (softmax_eq) {{\Large$softmax(x) = \frac{e^{x}}{\sum e^{x}}$}}; 14 | 15 | 16 | 17 | % edges 18 | \path[tedge] (logits) edge node[above=1pt] {{\Large softmax}} (softmax); 19 | \end{tikzpicture} 20 | } % scalebox 21 | \end{figure} 22 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/perceptron.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{1.2}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | % operations ============================= 8 | \node[op] (x2) {$x_2$}; 9 | \node[op, above=40pt of x2] (x1) {$x_1$}; 10 | \node[op, below=40pt of x2] (x3) {$x_3$}; 11 | \node[op, right=60pt of x2] (vk) {$v_k$}; 12 | \node[op, right=40pt of vk] (yk) {$\hat{y}_k$}; 13 | \node[textonly, below right=20pt of x3] (Synaptic) {Synaptic link}; 14 | \node[textonly, below right=50pt of vk] (Activation) {Activation link}; 15 | 16 | 17 | % edges 18 | \path[tedge] (x1) edge node[above=1.8pt] {$\vect{W}_{k,1}$} (vk); 19 | \path[tedge] (x2) edge node[above=0.2pt] {$\vect{W}_{k,2}$} (vk); 20 | \path[tedge] (x3) edge node[above=3.8pt] {$\vect{W}_{k,3}$} (vk); 21 | \path[tedge] (vk) edge node[above=1pt] {{\Large$f$}} (yk) ; 22 | 23 | % info edges 24 | \draw[orange!120, line width=1mm] (Synaptic) to [out=150,in=0] (x3); 25 | \draw[orange!120, line width=1mm] (Synaptic) to [out=150,in=-100] (vk); 26 | 27 | \draw[orange!120, line width=1mm] (Activation) to [out=170,in=-40] (vk); 28 | \draw[orange!120, line width=1mm] (Activation) to [out=170,in=-100] (yk); 29 | 30 | 31 | 32 | \end{tikzpicture} 33 | } % scalebox 34 | \end{figure} 35 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/rnn-backprop-through-time.tex: -------------------------------------------------------------------------------- 1 | \newcommand{\rnnstatecell}[4]{ 2 | 3 | % operations 4 | \node[state, minimum size=40pt,#4] (hprime#3) {$\vect{h}^{#1}$}; 5 | \node[op, minimum size=40pt,below=15pt of hprime#3] (a#3) {$\vect{a}^{#1}$}; 6 | 7 | \node[noop, below left=10pt and 10pt of a#3] (noop-left#3) {}; 8 | \node[state, minimum size=40pt, below left=12pt and 0.1pt of noop-left#3] (h#3) {$\vect{h}^{#2}$}; 9 | \node[op, above left=8pt and 15pt of noop-left#3] (W#3) {$\vect{W}$}; 10 | 11 | \node[noop, below right=10pt and 10pt of a#3] (noop-right#3) {}; 12 | \node[op, below right=12pt and 0.05pt of noop-right#3] (U#3) {$\vect{U}$}; 13 | 14 | % outer operations 15 | \node[op, minimum size=40pt, below=75pt of a#3] (x#3) {$\vect{x}^{#1}$}; 16 | 17 | %% namedscope 18 | \begin{scope}[on background layer] 19 | \coordinate (p1) at (hprime#3.north); 20 | \coordinate (p2) at (U#3.south east); 21 | \coordinate (p3) at (h#3.south west); 22 | \tkzCircumCenter(p1,p2,p3) 23 | \tkzGetPoint{O} 24 | \tkzDrawCircle[draw=orange,line width=2pt, fill=orange!60](O,p1) 25 | \end{scope} 26 | 27 | % edges 28 | \path[tedge] (a#3) -- (hprime#3); 29 | \path[tedge] (noop-left#3) -- (a#3); 30 | \path[tedge] (noop-right#3) -- (a#3); 31 | \path[tedge] (W#3) -- (noop-left#3); 32 | \path[tedge] (h#3.north) to [bend left, out=70, distance=5pt] (noop-left#3.west); 33 | \path[tedge] (U#3.north) to [bend right, out=-50, distance=5pt] (noop-right#3.east); 34 | \path[tedge] (x#3) -- (noop-right#3); 35 | } 36 | 37 | \begin{figure} 38 | \centering 39 | 40 | \scalebox{0.42}{ 41 | \begin{tikzpicture}[auto] 42 | 43 | % previous cell 44 | \rnnstatecell{(\tau-1)}{(\tau-2)}{prev}{} 45 | 46 | % past cells 47 | \node[textonly, left=60pt of Wprev] (dots) {{\Huge $\cdots$}}; 48 | 49 | % past edge 50 | \path[tedge] (dots) to [out=10, in=-160] (hprev.west); 51 | 52 | 53 | % next cell 54 | \rnnstatecell{(\tau)}{(\tau-1)}{next}{right=230pt of hprimeprev} 55 | 56 | % state transfer 57 | \path[tedge] (hprimeprev.east) to [out=10, in=-160] (hnext.west); 58 | 59 | % loss 60 | \node[op, minimum size=40pt, above right=80pt and 40pt of hprimenext] (L) {$L^{(\tau)}$}; 61 | \node[textonly, above=80pt of hprimenext] (ppp) {{\Huge $\cdots$}}; 62 | 63 | % loss edges 64 | \path[tedge] (hprimenext.north) to [bend left, out=-110, in=100, distance=20pt] (ppp.west); 65 | \path[tedge] (ppp) -- (L); 66 | 67 | % gradients from time step tau 68 | \visible<2->{\node[gradient, above right=1pt and 70pt of hprimenext] (grad-hprime) {$\grad{\vect{h}^{(\tau)}}{L^{(\tau)}}$};} 69 | \visible<3->{\node[textonly, right=0.1pt of grad-hprime] {$=\dotpPright{\vect{V}}{\hat{\vect{y}}^{(\tau)} - \vect{y}^{(\tau)}}$};} 70 | 71 | 72 | \visible<4->{\node[gradient, right=65pt of anext] (grad-a) {$\grad{\vect{a}^{(\tau)}}{L^{(\tau)}}$};} 73 | \visible<5->{\node[textonly, right=0.1pt of grad-a] {$=\left(\grad{\vect{h}^{(\tau)}}{L^{(\tau)}}\right)\circ\vect{h}^{(\tau)}\circ(1-\vect{h}^{(\tau)})$};} 74 | 75 | 76 | \visible<6->{\node[gradient, below right=0.1pt and 40pt of Unext] (grad-U) {$\grad{\vect{U}^{(\tau)}}{L^{(\tau)}}$};} 77 | \visible<7->{\node[textonly, right=0.1pt of grad-U] {$=\outerp{\grad{\vect{a}^{(\tau)}}{L^{(\tau)}}}{\vect{x}^{(\tau)}}$};} 78 | 79 | 80 | \visible<8->{\node[gradient, above left=70pt and 10pt of Wnext] (grad-W) {$\grad{\vect{W}^{(\tau)}}{L^{(\tau)}}$};} 81 | \visible<9->{\node[textonly, left=0.1pt of grad-W] {$\outerp{\grad{\vect{a^{(\tau)}}}{L^{(\tau)}}}{\vect{h}^{(\tau-1)}}=$};} 82 | 83 | 84 | % gradients from time step tau -1 85 | \visible<10->{\node[gradient, above left=60pt and 10pt of hprimeprev] (grad-hprimeprev) {$\grad{\vect{h}^{(\tau-1)}}{L^{(\tau)}}$};} 86 | \visible<11->{\node[textonly, left=0.1pt of grad-hprimeprev] {$\dotpPright{\vect{W}}{\grad{\vect{a}^{(\tau)}}{L^{(\tau)}}}=$};} 87 | 88 | 89 | \visible<12->{\node[gradient, below left=55pt and -20pt of hnext] (grad-a-prev) {$\grad{\vect{a}^{(\tau-1)}}{L^{(\tau)}}$};} 90 | \visible<13->{\node[textonly, right=0.1pt of grad-a-prev] {$=\left(\grad{\vect{h}^{(\tau-1)}}{L^{(\tau)}}\right)\circ\vect{h}^{(\tau-1)}\circ(1-\vect{h}^{(\tau-1)})$};} 91 | 92 | 93 | \visible<14->{\node[gradient, below left=20pt and 10pt of grad-a-prev] (grad-U-prev) {$\grad{\vect{U}^{(\tau-1)}}{L^{(\tau)}}$};} 94 | \visible<15->{\node[textonly, left=0.1pt of grad-U-prev] {$\outerp{\grad{\vect{a}^{(\tau-1)}}{L^{(\tau)}}}{\vect{x}^{(\tau-1)}}=$};} 95 | 96 | 97 | \visible<16->{\node[gradient, above left=70pt and 10pt of Wprev] (grad-W-prev) {$\grad{\vect{W}^{(\tau-1)}}{L^{(\tau)}}$};} 98 | \visible<17->{\node[textonly, left=0.1pt of grad-W-prev] {$\outerp{\grad{\vect{a^{(\tau-1)}}}{L^{(\tau)}}}{\vect{h}^{(\tau-2)}}=$};} 99 | 100 | \visible<18->{\node[gradient, below left=20pt and 10pt of hprev] (grad-hprev) {$\grad{\vect{h}^{(\tau-2)}}{L^{(\tau)}}$};} 101 | \visible<19->{\node[textonly, left=0.1pt of grad-hprev] {$\dotpPright{\vect{W}}{\grad{\vect{a}^{(\tau-1)}}{L^{(\tau)}}}=$};} 102 | 103 | 104 | 105 | % gradient's edges 106 | \visible<2->{\path[tedge] (hprimenext) -- (grad-hprime);} 107 | \visible<4->{\path[tedge] (anext) -- (grad-a);} 108 | \visible<6->{\path[tedge] (Unext) -- (grad-U);} 109 | \visible<8->{\path[tedge] (Wnext) -- (grad-W);} 110 | \visible<10->{\path[tedge] (hprimeprev) -- (grad-hprimeprev);} 111 | \visible<12->{\path[tedge] (aprev.east) to [out=10, in=-160] (grad-a-prev);} 112 | \visible<14->{\path[tedge] (Uprev) -- (grad-U-prev);} 113 | \visible<16->{\path[tedge] (Wprev) -- (grad-W-prev);} 114 | \visible<18->{\path[tedge] (hprev) -- (grad-hprev);} 115 | 116 | 117 | \end{tikzpicture} 118 | }%\scalebox 119 | \end{figure} 120 | 121 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/rnn-backprop.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[ht!] 2 | \centering 3 | 4 | \scalebox{0.71}{ 5 | \begin{tikzpicture}[auto] 6 | 7 | 8 | % RNN state cell ============================= 9 | \node[state] (hprime) {$\myprime{\vect{h}}$}; 10 | \node[op, below=15pt of hprime] (a) {$\vect{a}$}; 11 | 12 | \node[noop, below left=10pt and 10pt of a] (noop-left) {}; 13 | \node[state, below left=12pt and 0.1pt of noop-left] (h) {$\vect{h}$}; 14 | \node[op, above left=8pt and 15pt of noop-left] (W) {$\vect{W}$}; 15 | 16 | \node[noop, below right=10pt and 10pt of a] (noop-right) {}; 17 | \node[op, below right=12pt and 0.05pt of noop-right] (U) {$\vect{U}$}; 18 | 19 | % gradients 20 | % $\grad{\myprime{\vect{h}}}{L}$ 21 | % $\outerp{\grad{\vect{a}}{L}}{\vect{x}}=$ 22 | 23 | \visible<6->{\node[gradient, right=50pt of hprime] (grad-hprime) {$\grad{\myprime{\vect{h}}}{L}$};} 24 | \visible<7->{\node[textonly, right=0.1pt of grad-hprime] {$=\dotpPright{\vect{V}}{\grad{\vect{o}}{L}}$};} 25 | 26 | \visible<8->{\node[gradient, right=65pt of a] (grad-a) {$\grad{\vect{a}}{L}$};} 27 | \visible<9->{\node[textonly, right=0.1pt of grad-a] {$=\left(\grad{\myprime{\vect{h}}}{L}\right)\circ\myprime{\vect{h}}\circ(1-\myprime{\vect{h}})$};} 28 | 29 | \visible<10->{\node[gradient, right=40pt of U] (grad-U) {$\grad{\vect{U}}{L}$};} 30 | \visible<11->{\node[textonly, right=0.1pt of grad-U] {$=\outerp{\grad{\vect{a}}{L}}{\vect{x}}$};} 31 | 32 | \visible<12->{\node[gradient, left=30pt of W] (grad-W) {$\grad{\vect{W}}{L}$};} 33 | \visible<13->{\node[textonly, left=0.1pt of grad-W] {$\outerp{\grad{\vect{a}}{L}}{\vect{h}}=$};} 34 | 35 | \visible<14->{\node[gradient, left=30pt of h] (grad-h) {$\grad{\vect{h}}{L}$};} 36 | \visible<15->{\node[textonly, left=0.1pt of grad-h] {$\dotpPright{\vect{W}}{\grad{\vect{a}}{L}}=$};} 37 | 38 | % outer operations 39 | \node[op, below=75pt of a] (x) {$\vect{x}$}; 40 | 41 | %% namedscope 42 | \begin{scope}[on background layer] 43 | \coordinate (p1) at (hprime.north); 44 | \coordinate (p2) at (U.south east); 45 | \coordinate (p3) at (h.south west); 46 | \tkzCircumCenter(p1,p2,p3) 47 | \tkzGetPoint{O} 48 | \tkzDrawCircle[draw=orange, line width=1.5pt, fill=orange!60](O,p1) 49 | \end{scope} 50 | 51 | % edges 52 | \visible<6->{\path[tedge] (hprime) -- (grad-hprime);} 53 | \visible<8->{\path[tedge] (a) -- (grad-a);} 54 | \visible<10->{\path[tedge] (U) -- (grad-U);} 55 | \visible<12->{\path[tedge] (W) -- (grad-W);} 56 | \visible<14->{\path[tedge] (h) -- (grad-h);} 57 | 58 | \path[tedge] (a) -- (hprime); 59 | \path[tedge] (noop-left) -- (a); 60 | \path[tedge] (noop-right) -- (a); 61 | \path[tedge] (W) -- (noop-left); 62 | \path[tedge] (h.north) to [bend left, out=70, distance=5pt] (noop-left.west); 63 | \path[tedge] (U.north) to [bend right, out=-50, distance=5pt] (noop-right.east); 64 | \path[tedge] (x) -- (noop-right); 65 | 66 | % RNN output cell ============================= 67 | 68 | % operations 69 | \node[op, above=50pt of hprime] (o) {$\vect{o}$}; 70 | \node[op, above=15pt of o] (yhat) {$\hat{\vect{y}}$}; 71 | \node[op, below left=1pt and 10pt of o] (V) {$\vect{V}$}; 72 | \node[op, right=50pt of yhat] (L) {$L$}; 73 | \node[op, right=20pt of L] (y) {$\vect{y}$}; 74 | 75 | % gradients 76 | \visible<4->{\node[gradient, left=20pt of V] (grad-V) {$\grad{\vect{V}}{L}$};} 77 | \visible<2->{\node[gradient, right=50pt of o] (grad-o) {$\grad{\vect{o}}{L}$};} 78 | \visible<3->{\node[textonly, right=0.1pt of grad-o] {$=\hat{\vect{y}}-\vect{y}$};} 79 | \visible<5->{\node[textonly, left=0.1pt of grad-V] {$\outerp{\grad{\vect{o}}{L}}{\myprime{\vect{h}}}=$};} 80 | 81 | % paths 82 | \path[tedge] (hprime) -- (o); 83 | \path[tedge] (o) -- (yhat); 84 | \path[tedge] (yhat) -- (L); 85 | \path[tedge] (y) -- (L); 86 | \visible<2->{\path[tedge] (o) -- (grad-o);} 87 | \path[tedge] (V.north) to [bend left, out=90, in=135, distance=10pt] (o.west); 88 | \visible<4->{\path[tedge] (V) -- (grad-V);} 89 | 90 | % namedscope 91 | \begin{scope}[on background layer] 92 | \coordinate (p4) at (yhat.north); 93 | \coordinate (p5) at (V.south west); 94 | \coordinate [right=35pt of o] (p6); 95 | \tkzCircumCenter(p4,p5,p6) 96 | \tkzGetPoint{O} 97 | \tkzDrawCircle[draw=orange, line width=1.5pt, fill=orange!60](O,p4) 98 | \end{scope} 99 | 100 | \end{tikzpicture} 101 | } % scalebox 102 | \end{figure} 103 | -------------------------------------------------------------------------------- /RNN/src/TikzFiles/rnn-time-unfolding.tex: -------------------------------------------------------------------------------- 1 | % RNN STATE CELL ==================================== 2 | \newcommand{\rnnstatecell}[4]{ 3 | 4 | % operations 5 | \node[state, minimum size=40pt,#4] (hprime#3) {$\textbf{h}^{#1}$}; 6 | \node[op, minimum size=40pt,below=15pt of hprime#3] (a#3) {$\textbf{a}^{#1}$}; 7 | 8 | \node[noop, below left=10pt and 10pt of a#3] (noop-left#3) {}; 9 | \node[state, minimum size=40pt, below left=12pt and 0.1pt of noop-left#3] (h#3) {$\textbf{h}^{#2}$}; 10 | \node[op, above left=8pt and 15pt of noop-left#3] (W#3) {W}; 11 | 12 | \node[noop, below right=10pt and 10pt of a#3] (noop-right#3) {}; 13 | \node[op, below right=12pt and 0.05pt of noop-right#3] (U#3) {U}; 14 | 15 | % outer operations 16 | \node[op, minimum size=40pt, below=75pt of a#3] (x#3) {$\textbf{x}^{#1}$}; 17 | 18 | %% namedscope 19 | \begin{scope}[on background layer] 20 | \coordinate (p1#3) at (hprime#3.north); 21 | \coordinate (p2#3) at (U#3.south east); 22 | \coordinate (p3#3) at (h#3.south west); 23 | \tkzCircumCenter(p1#3,p2#3,p3#3) 24 | \tkzGetPoint{O} 25 | \tkzDrawCircle[draw=orange, line width=1.5pt, fill=orange!60](O,p1#3) 26 | \end{scope} 27 | 28 | % edges 29 | \path[tedge] (a#3) -- (hprime#3); 30 | \path[tedge] (noop-left#3) -- (a#3); 31 | \path[tedge] (noop-right#3) -- (a#3); 32 | \path[tedge] (W#3) -- (noop-left#3); 33 | \path[tedge] (h#3.north) to [bend left, out=70, distance=5pt] (noop-left#3.west); 34 | \path[tedge] (U#3.north) to [bend right, out=-50, distance=5pt] (noop-right#3.east); 35 | \path[tedge] (x#3) -- (noop-right#3); 36 | } 37 | 38 | % RNN OUTPUT ==================================== 39 | \newcommand{\rnnoutput}[3]{ 40 | 41 | % operations 42 | \node[op, minimum size=40pt, #3] (o#2) {$\textbf{o}^{#1}$}; 43 | \node[op, minimum size=40pt, above=15pt of o#2] (yhat#2) {$\hat{\textbf{y}}^{#1}$}; 44 | \node[op, below left=1pt and 10pt of o#2] (V#2) {$\textbf{V}$}; 45 | \node[op, minimum size=40pt, left=50pt of yhat#2] (L#2) {$\textbf{L}^{#1}$}; 46 | \node[op, minimum size=40pt, left=20pt of L#2] (y#2) {$\textbf{y}^{#1}$}; 47 | 48 | % paths 49 | \path[tedge] (o#2) -- (yhat#2); 50 | \path[tedge] (yhat#2) -- (L#2); 51 | \path[tedge] (y#2) -- (L#2); 52 | \path[tedge] (V#2.north) to [bend left, out=90, in=135, distance=10pt] (o#2.west); 53 | 54 | % namedscope 55 | \begin{scope}[on background layer] 56 | \coordinate (p1#2) at (yhat#2.north); 57 | \coordinate (p2#2) at (V#2.south west); 58 | \coordinate [right=35pt of o#2] (p3#2); 59 | \tkzCircumCenter(p1#2,p2#2,p3#2) 60 | \tkzGetPoint{O} 61 | \tkzDrawCircle[draw=orange,line width=1.5pt, fill=orange!60](O,p1#2) 62 | \end{scope} 63 | } 64 | 65 | \begin{figure}[ht!] 66 | \hspace*{-1.0cm} 67 | \scalebox{0.425}{ 68 | \begin{tikzpicture}[auto] 69 | 70 | % timestep 1 cell 71 | \rnnstatecell{(1)}{(0)}{t1}{} 72 | 73 | % timestep 2 cell 74 | \rnnstatecell{(2)}{(1)}{t2}{right=140pt of hprimet1}; 75 | 76 | % previous cell 77 | \rnnstatecell{(\tau-1)}{(\tau-2)}{prev}{right=200pt of hprimet2}; 78 | 79 | % next cell 80 | \rnnstatecell{(\tau)}{(\tau-1)}{next}{right=140pt of hprimeprev} 81 | 82 | % state transfers 83 | \path[tedge] (hprimet1.east) to [out=10, in=-160] (ht2.west); 84 | 85 | \coordinate[right=30pt of hprimet2] (hppp); 86 | \path[tedge] (hppp.east) to [out=10, in=-160] (hprev.west); 87 | 88 | \path[tedge] (hprimeprev.east) to [out=10, in=-160] (hnext.west); 89 | 90 | % ... 91 | \node[fill=white, right=70pt of at2] (ppp) {\Huge{$\cdots$}}; 92 | 93 | % output 94 | \rnnoutput{(\tau)}{output}{above=50pt of hprimenext}; 95 | 96 | \path[tedge] (hprimenext) -- (ooutput); 97 | 98 | \end{tikzpicture} 99 | }%\scalebox 100 | \end{figure} 101 | 102 | -------------------------------------------------------------------------------- /RNN/src/all_imports.tex: -------------------------------------------------------------------------------- 1 | \usepackage[utf8]{inputenc} 2 | \usepackage[T1]{fontenc} 3 | \usepackage{lmodern} 4 | \usepackage{appendixnumberbeamer} 5 | \usepackage{hyperref} 6 | \usepackage{booktabs} 7 | \usepackage{bm} 8 | \usepackage[scale=2]{ccicons} 9 | \usepackage[outputdir=build]{minted} 10 | \usepackage{pgfplots} 11 | \usepackage{array,colortbl,xcolor} 12 | \usepgfplotslibrary{dateplot} 13 | \usepackage{setspace} 14 | \usepackage{etoolbox} 15 | \usepackage{xspace} 16 | \usepackage{tikz} 17 | \usetikzlibrary{shapes,arrows,positioning,fit,backgrounds} 18 | \usepackage{tkz-euclide} 19 | 20 | \AtBeginEnvironment{quote}{\singlespacing} -------------------------------------------------------------------------------- /RNN/src/all_new_commands.tex: -------------------------------------------------------------------------------- 1 | \newcommand{\themename}{\textbf{\textsc{metropolis}}\xspace} 2 | \newcommand{\vect}[1]{\bm{#1}} 3 | \newcommand{\myprime}[1]{{#1}^{\prime}} 4 | \newcommand{\grad}[2]{\nabla_{#1} {#2}} 5 | \newcommand{\dotp}[2]{{#1}^{\top}{#2}} 6 | \newcommand{\dotpPright}[2]{{#1}^{\top}\left({#2}\right)} 7 | \newcommand{\outerp}[2]{\left({#1}\right){#2}^{\top}} 8 | \newcommand{\Jacobian}[2]{\frac{\partial #1}{\partial #2}} 9 | \newcommand{\Vocab}{\mathbb{V}} 10 | \DeclareMathOperator*{\argmin}{arg\,min} -------------------------------------------------------------------------------- /RNN/src/definitions/colors.tex: -------------------------------------------------------------------------------- 1 | \definecolor{blue}{RGB}{159, 192, 176} 2 | \definecolor{green}{RGB}{160, 227, 127} 3 | \definecolor{orange}{RGB}{243, 188, 125} 4 | \definecolor{red}{RGB}{253, 123, 84} 5 | \definecolor{nephritis}{RGB}{39, 174, 96} 6 | \definecolor{emerald}{RGB}{46, 204, 113} 7 | \definecolor{turquoise}{RGB}{39, 174, 96} 8 | \definecolor{green-sea}{RGB}{22, 160, 133} -------------------------------------------------------------------------------- /RNN/src/definitions/styles.tex: -------------------------------------------------------------------------------- 1 | % Tikzstyles for Computation Graphs 2 | 3 | % nodes 4 | \tikzstyle{noop} = [circle, draw=none, fill=red, minimum size = 10pt] 5 | \tikzstyle{op} = [circle, draw=red, line width=1.5pt, fill=red!70, text=black, text centered, font=\bf \normalsize, minimum size = 25pt] 6 | \tikzstyle{state} = [circle, draw=blue, line width=1.5pt, fill=blue!70, text=black, text centered, font=\bf \normalsize, minimum size = 25pt] 7 | % \tikzstyle{gradient} = [circle, draw=green, line width=1.5pt, fill=green!60, text=black, text centered, font=\bf \normalsize, minimum size = 25pt] 8 | \tikzstyle{gradient} = [circle, draw=nephritis, line width=1.5pt, fill=nephritis!60, text=black, text centered, font=\bf \normalsize, minimum size = 25pt] 9 | \tikzstyle{textonly} = [draw=none, fill=none, text centered, font=\bf \normalsize] 10 | 11 | % edges 12 | % \tikzstyle{tedge} = [draw, thick, >=stealth, ->] 13 | \tikzstyle{tedge} = [draw, thick, >=latex, ->] 14 | 15 | % namedscope 16 | \tikzstyle{namedscope} = [circle, draw=orange, line width=1.5pt, fill=orange!60, align=center, inner sep=0pt] 17 | 18 | % \tikzstyle{container} = [draw=none, rectangle, dotted, inner ysep=1.5em] 19 | % \tikzstyle{novertex} = [draw=none, fill=none, text centered] 20 | % \tikzstyle{predicate} = [ellipse, draw, thick, text centered, rounded corners, minimum size=30pt] 21 | % \tikzstyle{aux} = [rectangle, draw, thick, text centered, rounded corners, minimum size=30pt] 22 | % \tikzstyle{ledge} = [draw, dashed, thick, >=stealth, ->] 23 | % \tikzstyle{pedge} = [draw, thick, >=stealth, ->] 24 | 25 | -------------------------------------------------------------------------------- /RNN/src/equations.tex: -------------------------------------------------------------------------------- 1 | \begin{frame}{The problem of training RNN} 2 | Let's calculate $\grad{\vect{U}}{L^{(3)}}$: 3 | \begin{align*} 4 | \grad{\vect{U}}{L^{(3)}} &= \sum_{t=1}^{3}\grad{\vect{U}^{(t)}}{L^{(3)}}\\ 5 | &= \grad{\vect{U}^{(1)}}{L^{(3)}} + \grad{\vect{U}^{(2)}}{L^{(3)}} + \grad{\vect{U}^{(3)}}{L^{(3)}} 6 | \end{align*} 7 | \end{frame} 8 | 9 | \begin{frame}{Calculating $\grad{\vect{U}^{(3)}}{L^{(3)}}$ } 10 | \begin{align*} 11 | \grad{\vect{U}^{(3)}}{L^{(3)}} &=\outerp{\grad{\vect{a}^{(3)}}{L^{(3)}}}{\vect{x}^{(3)}}\\ 12 | % 13 | \visible<2->{&=\outerp{\left(\grad{\vect{h}^{(3)}}{L^{(3)}}\right)\circ\vect{h}^{(3)}\circ(1-\vect{h}^{(3)})}{\vect{x}^{(3)}}\\} 14 | % 15 | \visible<3->{&=\outerp{\left(\dotpPright{\vect{V}}{\hat{\vect{y}}^{(3)} - \vect{y}^{(3)}}\right)\circ\vect{h}^{(3)}\circ(1-\vect{h}^{(3)})}{\vect{x}^{(3)}}\\} 16 | \end{align*} 17 | \end{frame} 18 | 19 | 20 | \begin{frame}{Calculating $\grad{\vect{U}^{(2)}}{L^{(3)}}$ } 21 | \footnotesize{ 22 | \begin{align*} 23 | \grad{\vect{U}^{(2)}}{L^{(3)}} &=\outerp{\grad{\vect{a}^{(2)}}{L^{(3)}}}{\vect{x}^{(2)}}\\ 24 | % 25 | \visible<2->{&=\outerp{\left(\grad{\vect{h}^{(2)}}{L^{(3)}}\right)\circ\vect{h}^{(2)}\circ(1-\vect{h}^{(2)})}{\vect{x}^{(2)}}\\} 26 | % 27 | \visible<3->{&=\outerp{\left(\dotpPright{\vect{W}}{\grad{\vect{a}^{(3)}}{L^{(3)}}}\right)\circ\vect{h}^{(2)}\circ(1-\vect{h}^{(2)})}{\vect{x}^{(2)}}\\} 28 | % 29 | \visible<4->{&=\outerp{\left(\dotpPright{\vect{W}}{\left(\grad{\vect{h}^{(3)}}{L^{(3)}}\right)\circ\vect{h}^{(3)}\circ(1-\vect{h}^{(3)})}\right)\circ\vect{h}^{(2)}\circ(1-\vect{h}^{(2)})}{\vect{x}^{(2)}}\\} 30 | % 31 | \visible<5->{&=\outerp{\left(\dotpPright{\vect{W}}{\left(\dotpPright{\vect{V}}{\hat{\vect{y}}^{(3)} - \vect{y}^{(3)}}\right)\circ\vect{h}^{(3)}\circ(1-\vect{h}^{(3)})}\right)\circ\vect{h}^{(2)}\circ(1-\vect{h}^{(2)})}{\vect{x}^{(2)}}\\} 32 | \end{align*} 33 | } 34 | \end{frame} 35 | 36 | \begin{frame}{Calculating $\grad{\vect{U}^{(1)}}{L^{(3)}}$ } 37 | \tiny{ 38 | \begin{align*} 39 | \grad{\vect{U}^{(1)}}{L^{(3)}} &=\outerp{\grad{\vect{a}^{(1)}}{L^{(3)}}}{\vect{x}^{(1)}}\\ 40 | % 41 | \visible<2->{&=\outerp{\left(\grad{\vect{h}^{(1)}}{L^{(3)}}\right)\circ\vect{h}^{(1)}\circ(1-\vect{h}^{(1)})}{\vect{x}^{(1)}}\\} 42 | % 43 | \visible<3->{&=\outerp{\left(\dotpPright{\vect{W}}{\grad{\vect{a}^{(2)}}{L^{(3)}}}\right)\circ\vect{h}^{(1)}\circ(1-\vect{h}^{(1)})}{\vect{x}^{(1)}}\\} 44 | % 45 | \visible<4->{&=\outerp{\left(\dotpPright{\vect{W}}{\left(\grad{\vect{h}^{(2)}}{L^{(3)}}\right)\circ\vect{h}^{(2)}\circ(1-\vect{h}^{(2)})}\right)\circ\vect{h}^{(1)}\circ(1-\vect{h}^{(1)})}{\vect{x}^{(1)}}\\} 46 | % 47 | \visible<5->{&=\outerp{\left(\dotpPright{\vect{W}}{\left(\dotpPright{\vect{W}}{\grad{\vect{a}^{(3)}}{L^{(3)}}}\right)\circ\vect{h}^{(2)}\circ(1-\vect{h}^{(2)})}\right)\circ\vect{h}^{(1)}\circ(1-\vect{h}^{(1)})}{\vect{x}^{(1)}}\\} 48 | % 49 | \visible<6->{&=\outerp{\left(\dotpPright{\vect{W}}{\left(\dotpPright{\vect{W}}{\left(\grad{\vect{h}^{(3)}}{L^{(3)}}\right)\circ\vect{h}^{(3)}\circ(1-\vect{h}^{(3)})}\right)\circ\vect{h}^{(2)}\circ(1-\vect{h}^{(2)})}\right)\circ\vect{h}^{(1)}\circ(1-\vect{h}^{(1)})}{\vect{x}^{(1)}}\\} 50 | % 51 | \visible<7->{&=\outerp{\left(\dotpPright{\vect{W}}{\left(\dotpPright{\vect{W}}{\left(\dotpPright{\vect{V}}{\hat{\vect{y}}^{(3)} - \vect{y}^{(3)}}\right)\circ\vect{h}^{(3)}\circ(1-\vect{h}^{(3)})}\right)\circ\vect{h}^{(2)}\circ(1-\vect{h}^{(2)})}\right)\circ\vect{h}^{(1)}\circ(1-\vect{h}^{(1)})}{\vect{x}^{(1)}}\\} 52 | \end{align*} 53 | } 54 | \end{frame} -------------------------------------------------------------------------------- /RNN/src/header.tex: -------------------------------------------------------------------------------- 1 | \title{An introduction to Recurrent Neural Networks} 2 | \date{\today} 3 | 4 | \author{ 5 | Felipe Salvatore\\ 6 | \url{https://felipessalvatore.github.io/} 7 | \vspace{0.4 cm} 8 | \and\\ 9 | Thiago Bueno\\ 10 | \url{http://thiagopbueno.github.io/}\\\vspace{0.4 cm} 11 | } 12 | 13 | \institute{\textbf{IME-USP}: Institute of Mathematics and Statistics, University of São Paulo} 14 | -------------------------------------------------------------------------------- /RNN/src/main.tex: -------------------------------------------------------------------------------- 1 | \documentclass[10pt]{beamer} 2 | \usetheme{metropolis} 3 | % all imports 4 | \input{all_imports} 5 | 6 | \AtBeginEnvironment{quote}{\singlespacing} 7 | 8 | % new commands 9 | \input{all_new_commands} 10 | 11 | % definitions 12 | \input{definitions/colors} 13 | \input{definitions/styles} 14 | 15 | \input{header} 16 | 17 | \begin{document} 18 | \nocite{DeepLearningbook} 19 | 20 | 21 | \maketitle 22 | 23 | 24 | 25 | \section{RNN} 26 | 27 | \begin{frame}{RNN as a graph} 28 | \input{TikzFiles/RNNGraphExpanded} 29 | \end{frame} 30 | 31 | \begin{frame}{RNN as a graph} 32 | \input{TikzFiles/RNNSimplified} 33 | \end{frame} 34 | 35 | \begin{frame}{Unfolding the graph} 36 | \input{TikzFiles/RNNSimplifiedUnfolded} 37 | \end{frame} 38 | 39 | \begin{frame}{RNN time unfolding} 40 | \input{TikzFiles/rnn-time-unfolding} 41 | \end{frame} 42 | 43 | 44 | \section{BackPropagation} 45 | 46 | \begin{frame}{Chain rule: RNN graph} 47 | \input{TikzFiles/rnn-backprop} 48 | \end{frame} 49 | 50 | \begin{frame}{Chain rule: RNN graph} 51 | \input{TikzFiles/rnn-backprop-through-time} 52 | \end{frame} 53 | 54 | \section{Language model} 55 | 56 | \begin{frame}{The language model: graph} 57 | \input{TikzFiles/LanguageModelExpanded} 58 | \end{frame} 59 | 60 | \begin{frame}{The language model: graph} 61 | \input{TikzFiles/LanguageModelSimplified} 62 | \end{frame} 63 | 64 | \begin{frame}{The Language model: unfolding example} 65 | \input{TikzFiles/LanguageModelUnfolded} 66 | \end{frame} 67 | 68 | \section{LSTM} 69 | 70 | 71 | \begin{frame}{LSTM} 72 | \input{TikzFiles/LSTM_simplified} 73 | \end{frame} 74 | 75 | 76 | \begin{frame}{LSTM: unfolded model} 77 | \input{TikzFiles/LSTM_unfolded} 78 | \end{frame} 79 | 80 | 81 | \begin{frame}{Simplification} 82 | \input{TikzFiles/Add_op_simplified} 83 | \end{frame} 84 | 85 | 86 | \begin{frame}{LSTM: recurrence} 87 | \input{TikzFiles/LSTM_cell} 88 | \end{frame} 89 | 90 | 91 | \begin{frame}[allowframebreaks]{References} 92 | 93 | \bibliography{my_references} 94 | \bibliographystyle{abbrv} 95 | 96 | \end{frame} 97 | 98 | \end{document} 99 | -------------------------------------------------------------------------------- /RNN/src/my_references.bib: -------------------------------------------------------------------------------- 1 | % deep learning 2 | 3 | @book{DeepLearningbook, 4 | author = "Ian Goodfellow and Yoshua Bengio and Aaron Courville", 5 | title = "Deep Learning", 6 | year = "2017", 7 | publisher = "MIT Press", 8 | } 9 | 10 | % language models 11 | 12 | @article{Mikolov11, 13 | author = "T. Mikolov and S. Kombrink and L. Burget and J. Cernocký and S. Khudanpur", 14 | title = "Extensions of recurrent neural network language", 15 | journal = "IEEE", 16 | pages = "5528--5531", 17 | year = "2011", 18 | DOI = "http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=5947611" 19 | } 20 | 21 | -------------------------------------------------------------------------------- /RNN/src/pdf/RNNpresentation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIAMF-USP/TikzTemplates/f467d318892322132599cf64081fb9a044bbd69e/RNN/src/pdf/RNNpresentation.pdf --------------------------------------------------------------------------------