\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{lwebzem56} \pdfinfo{ /Title (neural-networks-for-machine-learning.pdf) /Creator (Cheatography) /Author (lwebzem56) /Subject (Neural Networks for Machine Learning Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{A3A3A3} \definecolor{LightBackground}{HTML}{F3F3F3} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Neural Networks for Machine Learning Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{lwebzem56} via \textcolor{DarkBackground}{\uline{cheatography.com/51511/cs/14084/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}lwebzem56 \\ \uline{cheatography.com/lwebzem56} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 28th December, 2017.\\ Updated 1st January, 2018.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{x{2.38896 cm} x{2.58804 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Neural Networks Types and Main Features}} \tn % Row 0 \SetRowColor{LightBackground} Feedforward neural network & connections between nodes do not have a cycle \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} Multilayer perceptron (MLP) & has at least three layers of nodes \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} Reccurent neural network (RNN) & connections between units have a directed cycle \tn % Row Count 8 (+ 3) % Row 3 \SetRowColor{white} Self-Organising Maps (SOM) & convert input data to low dimensional space \tn % Row Count 11 (+ 3) % Row 4 \SetRowColor{LightBackground} Deep Belief Network (DBN) & has connections between layers but not within layer \tn % Row Count 14 (+ 3) % Row 5 \SetRowColor{white} Convolutional Neural Network (CNN) & has one or more convolutional layers and then followed by one or more fully connected layers \tn % Row Count 19 (+ 5) % Row 6 \SetRowColor{LightBackground} Generative Adversarial Networks (GAN) & system of two neural nets, contesting with each other \tn % Row Count 22 (+ 3) % Row 7 \SetRowColor{white} Spiking Neural Netorks (SNN) & time information is processed in the form of spikes and there is more than one synapse between neurons \tn % Row Count 28 (+ 6) % Row 8 \SetRowColor{LightBackground} Wavelet neural network & use wavelet function as activation function in the neuron \tn % Row Count 31 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.38896 cm} x{2.58804 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Neural Networks Types and Main Features (cont)}} \tn % Row 9 \SetRowColor{LightBackground} Wavelet convolutional neural network & combine wavelet transform and CNN \tn % Row Count 2 (+ 2) % Row 10 \SetRowColor{white} Long short-term memory (LSTM) & type of RNN, model for the short-term memory which can last for a long period of time \tn % Row Count 7 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Building Neural Network with Keras and Python}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{from keras.models import Sequential \newline model = Sequential() \newline from keras.layers import Dense \newline \newline model.add(Dense(units=64, activation='relu', input\_dim=100)) \newline model.add(Dense(units=10, activation='softmax')) \newline \newline model.compile(loss='categorical\_crossentropy', \newline optimizer='sgd', \newline metrics={[}'accuracy'{]}) \newline model.compile(loss=keras.losses.categorical\_crossentropy, \newline \seqsplit{optimizer=keras.optimizers.SGD(lr=0.01}, momentum=0.9, nesterov=True)) \newline \newline model.fit(x\_train, y\_train, epochs=5, batch\_size=32) \newline \newline model.train\_on\_batch(x\_batch, y\_batch) \newline loss\_and\_metrics = model.evaluate(x\_test, y\_test, batch\_size=128) \newline classes = model.predict(x\_test, batch\_size=128)} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{popup="https://keras.io/"\}\}Keras\{\{/popup\}\}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Data Preparation for Input to Neural Network}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{from sklearn import preprocessing \newline \newline def normalize\_data(m, XData): \newline if m == "": \newline m="scaling-no" \newline if m == "scaling-no": \newline return XData \newline if m == "StandardScaler": \newline std\_scale = \seqsplit{preprocessing.StandardScaler().fit(XData)} \newline XData\_new = \seqsplit{std\_scale.transform(XData)} \newline if m == "MinMaxScaler": \newline minmax\_scale = \seqsplit{preprocessing.MinMaxScaler().fit(XData)} \newline XData\_new = \seqsplit{minmax\_scale.transform(XData)} \newline \newline return XData\_new} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Cheat Sheets about Python and Machine Learning}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{popup="http://intelligentonlinetools.com/cheatsheets/python\_data\_manipulation.php"\}\}Quick and Easy Way to get started with common and most used python tasks in data processing\{\{/popup\}\}} \tn % Row Count 4 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{3.53367 cm} x{1.44333 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Neural Network Applications and Most Used Networks}} \tn % Row 0 \SetRowColor{LightBackground} Image classification & CNN \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Image recognition & CNN \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} Time series prediction & RNN, LSTM \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} Text generation & RNN, LSTM \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} Classification & MLP \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} Visualization & SOM \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.09034 cm} x{2.88666 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Neural Net Weight Update Methods}} \tn % Row 0 \SetRowColor{LightBackground} Adam & based on adaptive estimates of lower order moments \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} AdaGrad & Adagrad is an adaptive learning rate method \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} RMSProp & adaptive learning rate method, modification of Adagrad method \tn % Row Count 8 (+ 3) % Row 3 \SetRowColor{white} SGD & Stochastic gradient descent \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} AdaDelta & modification of Adagrad to reduce its aggressive, monotonically decreasing learning rate \tn % Row Count 14 (+ 4) % Row 5 \SetRowColor{white} Newton method & second order method, is not used in deep learning \tn % Row Count 17 (+ 3) % Row 6 \SetRowColor{LightBackground} Momentum & method that helps accelerate SGD in the relevant direction \tn % Row Count 20 (+ 3) % Row 7 \SetRowColor{white} Nesterov accelerated gradient & evaluate the gradient at next position instead of current \tn % Row Count 23 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{References: \newline \{\{popup="https://arxiv.org/pdf/1412.6980.pdf"\}\}ADAM: A METHOD FOR STOCHASTIC OPTIMIZATION\{\{/popup\}\} \newline \{\{popup="http://cs231n.github.io/neural-networks-3/\#sgd"\}\}Convolutional Neural Networks for Visual Recognition.\{\{/popup\}\} \newline \{\{popup="http://ruder.io/optimizing-gradient-descent/index.html\#adadelta"\}\}An overview of gradient descent optimization algorithms\{\{/popup\}\} \newline \{\{popup="https://en.wikipedia.org/wiki/Artificial\_neural\_network"\}\}Wikipedia -Artificial neural network \{\{/popup\}\}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Links}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{popup="http://www.intelligentonlinetools.com/cgi-bin/nn/neural\_networks\_with\_python.cgi"\}\} Neural Networks with Python on the Web \{\{/popup\}\}} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{popup="https://machinelearningmastery.com/time-series-prediction-lstm-recurrent-neural-networks-python-keras/"\}\}Time Series Prediction with LSTM Recurrent Neural Networks in Python with Keras\{\{/popup\}\}} \tn % Row Count 8 (+ 5) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{popup="http://www.nehalemlabs.net/prototype/blog/2013/10/10/implementing-a-recurrent-neural-network-in-python/"\}\}Implementing a recurrent neural network in python\{\{/popup\}\}} \tn % Row Count 12 (+ 4) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{popup="http://intelligentonlinetools.com/blog/2017/06/17/time-series-prediction-with-convolutional-neural-networks-and-keras/"\}\}Time Series Prediction with Convolutional Neural Networks and Keras\{\{/popup\}\}} \tn % Row Count 17 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}