<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Deep Learning on Arshad Siddiqui</title><link>https://arshadhs.github.io/docs/ai/040-deep-learning/</link><description>Recent content in Deep Learning on Arshad Siddiqui</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 22 Apr 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://arshadhs.github.io/docs/ai/040-deep-learning/index.xml" rel="self" type="application/rss+xml"/><item><title>Neural Networks</title><link>https://arshadhs.github.io/docs/ai/040-deep-learning/010-neural-network/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/040-deep-learning/010-neural-network/</guid><description>&lt;h1 id="neural-networks">
 Neural Networks
 
 &lt;a class="anchor" href="#neural-networks">#&lt;/a>
 
&lt;/h1>
&lt;ul>
&lt;li>A &lt;strong>network of artificial neurons&lt;/strong> inspired by how neurons function in the &lt;strong>human brain&lt;/strong>.&lt;/li>
&lt;li>At its core - a &lt;strong>mathematical model&lt;/strong> designed to process and learn from data.&lt;/li>
&lt;li>Neural networks form the &lt;strong>foundation of &lt;a href="https://arshadhs.github.io/docs/ai/deep-learning/">Deep Learning&lt;/a>&lt;/strong> (involves training large and complex networks on vast amounts of data).&lt;/li>
&lt;/ul>
&lt;hr>


&lt;script src="https://arshadhs.github.io/mermaid.min.js">&lt;/script>

 &lt;script>mermaid.initialize({
 "flowchart": {
 "useMaxWidth":true
 },
 "theme": "default"
}
)&lt;/script>




&lt;pre class="mermaid">
flowchart LR
 subgraph subGraph0[&amp;#34;Input Layer&amp;#34;]
 I1((&amp;#34;Input 1&amp;#34;))
 I2((&amp;#34;Input 2&amp;#34;))
 I3((&amp;#34;Input 3&amp;#34;))
 end
 subgraph subGraph1[&amp;#34;Hidden Layer&amp;#34;]
 H1((&amp;#34;Hidden 1&amp;#34;))
 H2((&amp;#34;Hidden 2&amp;#34;))
 H3((&amp;#34;Hidden 3&amp;#34;))
 end
 subgraph subGraph2[&amp;#34;Output Layer&amp;#34;]
 O((&amp;#34;Output&amp;#34;))
 end
 I1 --&amp;gt; H1 &amp;amp; H2 &amp;amp; H3
 I2 --&amp;gt; H1 &amp;amp; H2 &amp;amp; H3
 I3 --&amp;gt; H1 &amp;amp; H2 &amp;amp; H3
 H1 --&amp;gt; O
 H2 --&amp;gt; O
 H3 --&amp;gt; O

 style I1 fill:#C8E6C9
 style I2 fill:#C8E6C9
 style I3 fill:#C8E6C9
 style H1 stroke:#2962FF,fill:#BBDEFB
 style H2 fill:#BBDEFB
 style H3 fill:#BBDEFB
 style O fill:#FFCDD2
 style subGraph0 stroke:none,fill:transparent
 style subGraph1 stroke:none,fill:transparent
 style subGraph2 stroke:none,fill:transparent
&lt;/pre>

&lt;hr>
&lt;h3 id="structure-of-a-neural-network">
 Structure of a Neural Network
 
 &lt;a class="anchor" href="#structure-of-a-neural-network">#&lt;/a>
 
&lt;/h3>
&lt;p>A typical neural network has &lt;strong>three main layers&lt;/strong>:&lt;/p></description></item><item><title>Artificial Neuron and Perceptron</title><link>https://arshadhs.github.io/docs/ai/040-deep-learning/020-perceptron/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/040-deep-learning/020-perceptron/</guid><description>&lt;h1 id="artificial-neuron-and-perceptron">
 Artificial Neuron and Perceptron
 
 &lt;a class="anchor" href="#artificial-neuron-and-perceptron">#&lt;/a>
 
&lt;/h1>
&lt;blockquote class="book-hint info">
&lt;p>knowledge in neural networks is stored in &lt;strong>connection weights&lt;/strong>, and learning means &lt;strong>modifying those weights&lt;/strong>.&lt;/p>
&lt;/blockquote>
&lt;hr>
&lt;h2 id="biological-neuron">
 Biological Neuron
 
 &lt;a class="anchor" href="#biological-neuron">#&lt;/a>
 
&lt;/h2>
&lt;p>A biological neuron is a specialised cell that processes and transmits information through electrical and chemical signals.&lt;/p>
&lt;p>Core components:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Dendrites&lt;/strong>: receive signals from other neurons&lt;/li>
&lt;li>&lt;strong>Cell body (soma)&lt;/strong>: processes incoming signals&lt;/li>
&lt;li>&lt;strong>Axon&lt;/strong>: transmits the output signal&lt;/li>
&lt;li>&lt;strong>Synapses&lt;/strong>: connection points between neurons&lt;/li>
&lt;/ul>
&lt;p>Biological intuition:&lt;/p>
&lt;ul>
&lt;li>many inputs arrive to one neuron&lt;/li>
&lt;li>one neuron can connect out to many neurons&lt;/li>
&lt;li>massive parallelism enables fast perception and recognition&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h2 id="artificial-neuron">
 Artificial Neuron
 
 &lt;a class="anchor" href="#artificial-neuron">#&lt;/a>
 
&lt;/h2>
&lt;p>An artificial neuron is a simplified computational model inspired by biological neurons.&lt;/p></description></item><item><title>LNN for Regression</title><link>https://arshadhs.github.io/docs/ai/040-deep-learning/030-linear-neural-networks-for-regression/</link><pubDate>Sun, 15 Feb 2026 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/040-deep-learning/030-linear-neural-networks-for-regression/</guid><description>&lt;h1 id="linear-neural-networks-for-regression">
 Linear Neural Networks for Regression
 
 &lt;a class="anchor" href="#linear-neural-networks-for-regression">#&lt;/a>
 
&lt;/h1>
&lt;p>A &lt;strong>linear neural network for regression&lt;/strong> is a model that predicts a &lt;strong>continuous&lt;/strong> target by taking a weighted sum of input features and applying the &lt;strong>identity activation&lt;/strong> (so the output can be any real number).&lt;/p>
&lt;ul>
&lt;li>Single neuron for regression (predicting &lt;em>how much&lt;/em> / &lt;em>how many&lt;/em>)&lt;/li>
&lt;li>Data + linear model (single neuron, no hidden layers) + squared loss&lt;/li>
&lt;li>Training using &lt;strong>batch gradient descent&lt;/strong> algorithm&lt;/li>
&lt;li>Prediction (inference)&lt;/li>
&lt;li>Eg: Auto MPG (UCI) style prediction with a single neuron (from-scratch code)&lt;/li>
&lt;/ul>
&lt;hr>


&lt;script src="https://arshadhs.github.io/mermaid.min.js">&lt;/script>

 &lt;script>mermaid.initialize({
 "flowchart": {
 "useMaxWidth":true
 },
 "theme": "default"
}
)&lt;/script>




&lt;pre class="mermaid">
flowchart LR
 D[&amp;#34;Data&amp;lt;br/&amp;gt;X, y&amp;#34;] --&amp;gt; M[&amp;#34;Linear model&amp;lt;br/&amp;gt;w, b&amp;lt;br/&amp;gt;Single neuron&amp;#34;]
 M --&amp;gt; A[&amp;#34;Activation&amp;lt;br/&amp;gt;Identity&amp;#34;]
 A --&amp;gt; L[&amp;#34;Loss&amp;lt;br/&amp;gt;MSE (Squared error)&amp;#34;]
 L --&amp;gt; O[&amp;#34;Optimiser&amp;lt;br/&amp;gt;Batch Gradient DescentBatch GD / Mini-batch GD&amp;#34;]
 O --&amp;gt; P[&amp;#34;Parameters&amp;lt;br/&amp;gt;w, b&amp;#34;]
 P --&amp;gt; I[&amp;#34;Inference&amp;lt;br/&amp;gt;Predict ŷ (number) for new x&amp;#34;]

 %% Pastel colour scheme
 style D fill:#E3F2FD,stroke:#1E88E5,stroke-width:1px
 style M fill:#E8F5E9,stroke:#43A047,stroke-width:1px
 style A fill:#FFF3E0,stroke:#FB8C00,stroke-width:1px
 style L fill:#FCE4EC,stroke:#D81B60,stroke-width:1px
 style O fill:#F3E5F5,stroke:#8E24AA,stroke-width:1px
 style P fill:#E0F7FA,stroke:#00838F,stroke-width:1px
 style I fill:#F1F8E9,stroke:#558B2F,stroke-width:1px
&lt;/pre>

&lt;hr>
&lt;h2 id="regression">
 Regression
 
 &lt;a class="anchor" href="#regression">#&lt;/a>
 
&lt;/h2>
&lt;p>Regression is a supervised learning task that predicts a continuous-valued output based on input features.&lt;/p></description></item><item><title>Gradient Descent Algorithm</title><link>https://arshadhs.github.io/docs/ai/040-deep-learning/035-gradient-descent-algorithm/</link><pubDate>Thu, 26 Feb 2026 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/040-deep-learning/035-gradient-descent-algorithm/</guid><description>&lt;h1 id="gradient-descent-algorithm">
 Gradient Descent Algorithm
 
 &lt;a class="anchor" href="#gradient-descent-algorithm">#&lt;/a>
 
&lt;/h1>
&lt;p>Gradient Descent Algorithm (GDA) is&lt;/p>
&lt;ul>
&lt;li>an &lt;strong>optimisation method&lt;/strong>&lt;/li>
&lt;li>used to &lt;strong>train models&lt;/strong>&lt;/li>
&lt;li>by repeatedly updating parameters (weights and biases) to &lt;strong>reduce the loss&lt;/strong>&lt;/li>
&lt;/ul>
&lt;blockquote class="book-hint info">
&lt;p>In deep learning, the default training approach is almost always &lt;strong>mini-batch gradient descent&lt;/strong>, usually with &lt;strong>Adam&lt;/strong> or &lt;strong>SGD + momentum&lt;/strong>.&lt;/p>
&lt;/blockquote>
&lt;p>Gradient Descent is &lt;strong>used in both regression and classification&lt;/strong>.&lt;/p>
&lt;p>It’s not tied to the task type — it’s tied to the fact you have:&lt;/p></description></item><item><title>LNN for Classification</title><link>https://arshadhs.github.io/docs/ai/040-deep-learning/040-linear-neural-networks-for-classification/</link><pubDate>Sun, 15 Feb 2026 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/040-deep-learning/040-linear-neural-networks-for-classification/</guid><description>&lt;h1 id="linear-nn-for-classification">
 Linear NN for Classification
 
 &lt;a class="anchor" href="#linear-nn-for-classification">#&lt;/a>
 
&lt;/h1>
&lt;p>A &lt;strong>Linear Neural Network (LNN) for classification&lt;/strong> uses &lt;strong>no hidden layers&lt;/strong>.&lt;br>
It learns a &lt;strong>linear decision boundary&lt;/strong> and outputs &lt;strong>class probabilities&lt;/strong>, then converts them into predicted classes.&lt;/p>
&lt;blockquote class="book-hint info">
&lt;p>Neural-network view:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Binary classification&lt;/strong> → logistic regression (single neuron + sigmoid)&lt;/li>
&lt;li>&lt;strong>Multi-class classification&lt;/strong> → softmax regression (K output neurons + softmax)&lt;/li>
&lt;/ul>
&lt;/blockquote>
&lt;hr>


&lt;script src="https://arshadhs.github.io/mermaid.min.js">&lt;/script>

 &lt;script>mermaid.initialize({
 "flowchart": {
 "useMaxWidth":true
 },
 "theme": "default"
}
)&lt;/script>




&lt;pre class="mermaid">
flowchart LR
 D[&amp;#34;Data&amp;lt;br/&amp;gt;X, y&amp;#34;] --&amp;gt; M[&amp;#34;Linear model&amp;lt;br/&amp;gt;w, b&amp;#34;]
 M --&amp;gt; A[&amp;#34;Activation&amp;lt;br/&amp;gt;Sigmoid / Softmax&amp;#34;]
 A --&amp;gt; L[&amp;#34;Loss&amp;lt;br/&amp;gt;Cross-entropy&amp;#34;]
 L --&amp;gt; O[&amp;#34;Optimiser&amp;lt;br/&amp;gt;Mini-batch GD / Adam&amp;#34;]
 O --&amp;gt; P[&amp;#34;Updated parameters&amp;lt;br/&amp;gt;w, b&amp;#34;]
 P --&amp;gt; I[&amp;#34;Inference&amp;lt;br/&amp;gt;Probabilities → class&amp;#34;]

 %% Pastel colour scheme
 style D fill:#E3F2FD,stroke:#1E88E5,stroke-width:1px
 style M fill:#E8F5E9,stroke:#43A047,stroke-width:1px
 style A fill:#FFF3E0,stroke:#FB8C00,stroke-width:1px
 style L fill:#FCE4EC,stroke:#D81B60,stroke-width:1px
 style O fill:#F3E5F5,stroke:#8E24AA,stroke-width:1px
 style P fill:#E0F7FA,stroke:#00838F,stroke-width:1px
 style I fill:#F1F8E9,stroke:#558B2F,stroke-width:1px
&lt;/pre>

&lt;hr>
&lt;h2 id="classification">
 Classification
 
 &lt;a class="anchor" href="#classification">#&lt;/a>
 
&lt;/h2>
&lt;p>Classification predicts a &lt;strong>discrete class label&lt;/strong>.&lt;br>
Common settings:&lt;/p></description></item><item><title>Deep Feedforward Neural Networks (DFNN) for Classification</title><link>https://arshadhs.github.io/docs/ai/040-deep-learning/050-deep-feedforward/</link><pubDate>Thu, 26 Feb 2026 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/040-deep-learning/050-deep-feedforward/</guid><description>&lt;h1 id="deep-feedforward-neural-networks-dfnn-or-multi-layer-perceptrons-mlp-for-classification">
 Deep Feedforward Neural Networks (DFNN) or Multi Layer Perceptrons (MLP) for Classification
 
 &lt;a class="anchor" href="#deep-feedforward-neural-networks-dfnn-or-multi-layer-perceptrons-mlp-for-classification">#&lt;/a>
 
&lt;/h1>
&lt;p>A &lt;strong>Deep Feedforward Neural Network (DFNN)&lt;/strong>, also called a &lt;strong>Multi-Layer Perceptron (MLP)&lt;/strong>, is a neural network with one or more &lt;strong>hidden layers&lt;/strong> where information flows &lt;strong>forward only&lt;/strong> (no recurrence).&lt;br>
For classification, DFNNs learn &lt;strong>non-linear decision boundaries&lt;/strong> by combining hidden layers with &lt;strong>non-linear activation functions&lt;/strong>.&lt;/p>
&lt;blockquote class="book-hint info">
&lt;p>Core idea:&lt;/p>
&lt;ul>
&lt;li>A single neuron can only learn &lt;strong>linear&lt;/strong> boundaries.&lt;/li>
&lt;li>Adding &lt;strong>hidden layers + non-linearity&lt;/strong> allows DFNNs to solve problems like &lt;strong>XOR&lt;/strong>.&lt;/li>
&lt;/ul>
&lt;/blockquote>
&lt;hr>
&lt;h2 id="mlp-as-solution-for-xor">
 MLP as solution for XOR
 
 &lt;a class="anchor" href="#mlp-as-solution-for-xor">#&lt;/a>
 
&lt;/h2>
&lt;p>A single perceptron fails on XOR because XOR is &lt;strong>not linearly separable&lt;/strong>.&lt;/p></description></item><item><title>Convolutional Neural Networks</title><link>https://arshadhs.github.io/docs/ai/040-deep-learning/060-cnn-fundamentals/</link><pubDate>Sun, 19 Apr 2026 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/040-deep-learning/060-cnn-fundamentals/</guid><description>&lt;h1 id="convolutional-neural-networks-cnn">
 Convolutional Neural Networks (CNN)
 
 &lt;a class="anchor" href="#convolutional-neural-networks-cnn">#&lt;/a>
 
&lt;/h1>
&lt;p>Convolutional Neural Networks (CNNs) are specialised neural networks designed for data with spatial structure, especially images. They became the standard model for computer vision because they preserve spatial locality, reuse the same pattern detector across the image, and build representations hierarchically. In practical terms, a CNN starts by learning simple features such as edges and corners, then combines them into textures, shapes, object parts, and finally full semantic categories.&lt;/p></description></item><item><title>Deep CNN Architectures</title><link>https://arshadhs.github.io/docs/ai/040-deep-learning/065-deep-cnn-architectures/</link><pubDate>Sun, 19 Apr 2026 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/040-deep-learning/065-deep-cnn-architectures/</guid><description>&lt;h1 id="deep-cnn-architectures">
 Deep CNN Architectures
 
 &lt;a class="anchor" href="#deep-cnn-architectures">#&lt;/a>
 
&lt;/h1>
&lt;p>Once the basic ideas of convolution, pooling, channels, and classifier heads are understood, the next step is to study how successful CNN architectures are designed in practice. The history of deep CNNs is not just a list of famous models. It is a progression of design ideas: smaller filters, more depth, better optimisation, bottlenecks, multi-scale processing, residual connections, and transfer learning.&lt;/p>
&lt;blockquote class="book-hint info">
&lt;p>&lt;strong>Key takeaway:&lt;/strong>&lt;br>
Deep CNN architectures evolved by solving specific problems one by one: &lt;strong>LeNet&lt;/strong> established the template, &lt;strong>AlexNet&lt;/strong> proved deep learning could dominate large-scale vision, &lt;strong>VGG&lt;/strong> simplified the design, &lt;strong>NiN&lt;/strong> introduced powerful &lt;code>1 × 1&lt;/code> ideas, &lt;strong>GoogLeNet&lt;/strong> made multi-scale processing efficient, and &lt;strong>ResNet&lt;/strong> solved the optimisation problem of very deep networks.&lt;/p></description></item><item><title>CNN Pipeline</title><link>https://arshadhs.github.io/docs/ai/040-deep-learning/067-cnn-model/</link><pubDate>Wed, 22 Apr 2026 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/040-deep-learning/067-cnn-model/</guid><description>&lt;h1 id="cnn-pipeline-preprocessing--models">
 CNN Pipeline: Preprocessing &amp;amp; Models
 
 &lt;a class="anchor" href="#cnn-pipeline-preprocessing--models">#&lt;/a>
 
&lt;/h1>
&lt;ul>
&lt;li>Understand CNN concepts deeply&lt;/li>
&lt;li>Build CNN models step-by-step&lt;/li>
&lt;li>Apply CNNs in assignments using Keras&lt;/li>
&lt;/ul>
&lt;blockquote class="book-hint info">
&lt;p>Think of CNN as a pipeline:
Image → Features → Patterns → Prediction&lt;/p>
&lt;/blockquote>
&lt;hr>
&lt;h1 id="1-image-representation">
 1. Image Representation
 
 &lt;a class="anchor" href="#1-image-representation">#&lt;/a>
 
&lt;/h1>
&lt;span style="color: green;">
 &lt;link rel="stylesheet" href="https://arshadhs.github.io/katex/katex.min.css" />
&lt;script defer src="https://arshadhs.github.io/katex/katex.min.js">&lt;/script>
 &lt;script defer src="https://arshadhs.github.io/katex/auto-render.min.js" onload="renderMathInElement(document.body, {
 &amp;#34;delimiters&amp;#34;: [
 {&amp;#34;left&amp;#34;: &amp;#34;$$&amp;#34;, &amp;#34;right&amp;#34;: &amp;#34;$$&amp;#34;, &amp;#34;display&amp;#34;: true},
 {&amp;#34;left&amp;#34;: &amp;#34;$&amp;#34;, &amp;#34;right&amp;#34;: &amp;#34;$&amp;#34;, &amp;#34;display&amp;#34;: false},
 {&amp;#34;left&amp;#34;: &amp;#34;\\(&amp;#34;, &amp;#34;right&amp;#34;: &amp;#34;\\)&amp;#34;, &amp;#34;display&amp;#34;: false},
 {&amp;#34;left&amp;#34;: &amp;#34;\\[&amp;#34;, &amp;#34;right&amp;#34;: &amp;#34;\\]&amp;#34;, &amp;#34;display&amp;#34;: true}
 ]
});">&lt;/script>
&lt;span>
 \[ 
X \in \mathbb{R}^{H \times W \times C}
 \]
 &lt;/span>
&lt;/span>
&lt;ul>
&lt;li>H = Height&lt;/li>
&lt;li>W = Width&lt;/li>
&lt;li>C = Channels&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h1 id="2-convolution-operation">
 2. Convolution Operation
 
 &lt;a class="anchor" href="#2-convolution-operation">#&lt;/a>
 
&lt;/h1>
&lt;span style="color: green;">
 &lt;span>
 \[ 
Z(i,j) = \sum_{m,n} X(i+m, j+n) \cdot K(m,n)
 \]
 &lt;/span>
&lt;/span>
&lt;ul>
&lt;li>Sliding filter extracts features&lt;/li>
&lt;li>Produces feature maps&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h1 id="3-stride--padding">
 3. Stride &amp;amp; Padding
 
 &lt;a class="anchor" href="#3-stride--padding">#&lt;/a>
 
&lt;/h1>
&lt;span style="color: green;">
 &lt;span>
 \[ 
Output = \frac{N - F + 2P}{S} + 1
 \]
 &lt;/span>
&lt;/span>
&lt;hr>
&lt;h1 id="4-activation-relu">
 4. Activation (ReLU)
 
 &lt;a class="anchor" href="#4-activation-relu">#&lt;/a>
 
&lt;/h1>
&lt;span style="color: green;">
 &lt;span>
 \[ 
ReLU(x) = max(0, x)
 \]
 &lt;/span>
&lt;/span>
&lt;hr>
&lt;h1 id="5-pooling">
 5. Pooling
 
 &lt;a class="anchor" href="#5-pooling">#&lt;/a>
 
&lt;/h1>
&lt;ul>
&lt;li>Max Pooling → strongest feature&lt;/li>
&lt;li>Average Pooling → smooth&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h1 id="6-global-average-pooling">
 6. Global Average Pooling
 
 &lt;a class="anchor" href="#6-global-average-pooling">#&lt;/a>
 
&lt;/h1>
&lt;span style="color: green;">
 &lt;span>
 \[ 
y_k = \frac{1}{HW} \sum_{i,j} x_{i,j,k}
 \]
 &lt;/span>
&lt;/span>
&lt;hr>
&lt;h1 id="7-loss-function">
 7. Loss Function
 
 &lt;a class="anchor" href="#7-loss-function">#&lt;/a>
 
&lt;/h1>
&lt;span style="color: green;">
 &lt;span>
 \[ 
L = - \sum y \log(\hat{y})
 \]
 &lt;/span>
&lt;/span>
&lt;hr>
&lt;h1 id="8-cnn-architecture">
 8. CNN Architecture
 
 &lt;a class="anchor" href="#8-cnn-architecture">#&lt;/a>
 
&lt;/h1>


&lt;script src="https://arshadhs.github.io/mermaid.min.js">&lt;/script>

 &lt;script>mermaid.initialize({
 "flowchart": {
 "useMaxWidth":true
 },
 "theme": "default"
}
)&lt;/script>




&lt;pre class="mermaid">graph LR
A[Input Image] --&amp;gt; B[Conv]
B --&amp;gt; C[ReLU]
C --&amp;gt; D[Pooling]
D --&amp;gt; E[Conv Layers]
E --&amp;gt; F[Flatten / GAP]
F --&amp;gt; G[Dense]
G --&amp;gt; H[Output]&lt;/pre>
&lt;hr>
&lt;h1 id="9-training">
 9. Training
 
 &lt;a class="anchor" href="#9-training">#&lt;/a>
 
&lt;/h1>
&lt;ul>
&lt;li>Forward pass&lt;/li>
&lt;li>Loss computation&lt;/li>
&lt;li>Backpropagation&lt;/li>
&lt;li>Weight update&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h1 id="10-keras-implementation">
 10. Keras Implementation
 
 &lt;a class="anchor" href="#10-keras-implementation">#&lt;/a>
 
&lt;/h1>
&lt;h2 id="model">
 Model
 
 &lt;a class="anchor" href="#model">#&lt;/a>
 
&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-python" data-lang="python">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">from&lt;/span> tensorflow.keras.models &lt;span style="color:#f92672">import&lt;/span> Sequential
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">from&lt;/span> tensorflow.keras.layers &lt;span style="color:#f92672">import&lt;/span> Conv2D, MaxPooling2D, Dense, Flatten
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>model &lt;span style="color:#f92672">=&lt;/span> Sequential()
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>model&lt;span style="color:#f92672">.&lt;/span>add(Conv2D(&lt;span style="color:#ae81ff">32&lt;/span>, (&lt;span style="color:#ae81ff">3&lt;/span>,&lt;span style="color:#ae81ff">3&lt;/span>), activation&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#39;relu&amp;#39;&lt;/span>, input_shape&lt;span style="color:#f92672">=&lt;/span>(&lt;span style="color:#ae81ff">64&lt;/span>,&lt;span style="color:#ae81ff">64&lt;/span>,&lt;span style="color:#ae81ff">3&lt;/span>)))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>model&lt;span style="color:#f92672">.&lt;/span>add(MaxPooling2D((&lt;span style="color:#ae81ff">2&lt;/span>,&lt;span style="color:#ae81ff">2&lt;/span>)))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>model&lt;span style="color:#f92672">.&lt;/span>add(Conv2D(&lt;span style="color:#ae81ff">64&lt;/span>, (&lt;span style="color:#ae81ff">3&lt;/span>,&lt;span style="color:#ae81ff">3&lt;/span>), activation&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#39;relu&amp;#39;&lt;/span>))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>model&lt;span style="color:#f92672">.&lt;/span>add(MaxPooling2D((&lt;span style="color:#ae81ff">2&lt;/span>,&lt;span style="color:#ae81ff">2&lt;/span>)))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>model&lt;span style="color:#f92672">.&lt;/span>add(Flatten())
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>model&lt;span style="color:#f92672">.&lt;/span>add(Dense(&lt;span style="color:#ae81ff">128&lt;/span>, activation&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#39;relu&amp;#39;&lt;/span>))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>model&lt;span style="color:#f92672">.&lt;/span>add(Dense(&lt;span style="color:#ae81ff">1&lt;/span>, activation&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#39;sigmoid&amp;#39;&lt;/span>))
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;hr>
&lt;h2 id="compile">
 Compile
 
 &lt;a class="anchor" href="#compile">#&lt;/a>
 
&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-python" data-lang="python">&lt;span style="display:flex;">&lt;span>model&lt;span style="color:#f92672">.&lt;/span>compile(optimizer&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#39;adam&amp;#39;&lt;/span>, loss&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#39;binary_crossentropy&amp;#39;&lt;/span>, metrics&lt;span style="color:#f92672">=&lt;/span>[&lt;span style="color:#e6db74">&amp;#39;accuracy&amp;#39;&lt;/span>])
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;hr>
&lt;h2 id="train">
 Train
 
 &lt;a class="anchor" href="#train">#&lt;/a>
 
&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-python" data-lang="python">&lt;span style="display:flex;">&lt;span>model&lt;span style="color:#f92672">.&lt;/span>fit(X_train, y_train, epochs&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">10&lt;/span>, batch_size&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">32&lt;/span>)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;hr>
&lt;h2 id="predict">
 Predict
 
 &lt;a class="anchor" href="#predict">#&lt;/a>
 
&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-python" data-lang="python">&lt;span style="display:flex;">&lt;span>pred &lt;span style="color:#f92672">=&lt;/span> model&lt;span style="color:#f92672">.&lt;/span>predict(X_test)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;hr>
&lt;h1 id="11-tips">
 11. Tips
 
 &lt;a class="anchor" href="#11-tips">#&lt;/a>
 
&lt;/h1>
&lt;ul>
&lt;li>Normalize images&lt;/li>
&lt;li>Use small filters&lt;/li>
&lt;li>Avoid too many dense layers&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h1 id="12-summary">
 12. Summary
 
 &lt;a class="anchor" href="#12-summary">#&lt;/a>
 
&lt;/h1>
&lt;blockquote class="book-hint info">
&lt;p>CNN = Automatic feature extractor + classifier&lt;/p></description></item><item><title>Recurrent Neural Networks</title><link>https://arshadhs.github.io/docs/ai/040-deep-learning/070-recurrent-nn/</link><pubDate>Sun, 19 Apr 2026 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/040-deep-learning/070-recurrent-nn/</guid><description>&lt;h1 id="recurrent-neural-networks">
 Recurrent Neural Networks
 
 &lt;a class="anchor" href="#recurrent-neural-networks">#&lt;/a>
 
&lt;/h1>
&lt;p>Recurrent Neural Networks (RNNs) are neural networks designed for &lt;strong>sequential data&lt;/strong>, where the order of inputs matters and the model must use information from earlier time steps to interpret later ones. Unlike a feedforward network, an RNN does not process each input in isolation. It carries a &lt;strong>hidden state&lt;/strong> from one time step to the next, so the network can build a running summary of what it has seen so far.&lt;/p></description></item><item><title>Deep Recurrent Neural Networks</title><link>https://arshadhs.github.io/docs/ai/040-deep-learning/075-recurrent-nn-deep/</link><pubDate>Sun, 19 Apr 2026 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/040-deep-learning/075-recurrent-nn-deep/</guid><description>&lt;h1 id="deep-recurrent-neural-networks">
 Deep Recurrent Neural Networks
 
 &lt;a class="anchor" href="#deep-recurrent-neural-networks">#&lt;/a>
 
&lt;/h1>
&lt;p>Vanilla RNNs introduce the hidden-state idea, but they struggle on longer and more complex sequences because gradients can vanish across time. Deep recurrent models extend the RNN idea in two important ways:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>make the recurrent architecture richer&lt;/strong>, for example by stacking multiple recurrent layers or using information from both directions,&lt;/li>
&lt;li>&lt;strong>use gates and memory cells&lt;/strong> to control what should be remembered, forgotten, updated, and exposed.&lt;/li>
&lt;/ol>
&lt;p>This is why practical recurrent modelling usually moves from a simple RNN to &lt;strong>stacked RNNs, bidirectional RNNs, GRUs, or LSTMs&lt;/strong>.&lt;/p></description></item><item><title>Attention Mechanism</title><link>https://arshadhs.github.io/docs/ai/040-deep-learning/080-attention-mechanism/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/040-deep-learning/080-attention-mechanism/</guid><description>&lt;h1 id="attention-mechanism">
 Attention Mechanism
 
 &lt;a class="anchor" href="#attention-mechanism">#&lt;/a>
 
&lt;/h1>
&lt;p>Attention is a deep learning mechanism that allows a model to focus on the most relevant parts of an input sequence when producing an output.&lt;/p>
&lt;p>Instead of compressing the whole input into one fixed vector, attention computes a weighted combination of useful information.&lt;/p>
&lt;blockquote class="book-hint info">
&lt;p>&lt;strong>Key takeaway:&lt;/strong>&lt;br>
Attention answers a simple question:&lt;/p>

&lt;blockquote class='book-hint '>
 &lt;p>For the current prediction, which input tokens should the model focus on most?&lt;/p>
&lt;/blockquote>&lt;/blockquote>
&lt;ul>
&lt;li>Queries, Keys, and Values&lt;/li>
&lt;li>Attention Pooling by Similarity&lt;/li>
&lt;li>Attention Pooling via Nadaraya–Watson Regression&lt;/li>
&lt;li>Attention Scoring Functions&lt;/li>
&lt;li>Dot Product Attention&lt;/li>
&lt;li>Convenience Functions&lt;/li>
&lt;li>Scaled Dot Product Attention&lt;/li>
&lt;li>Additive Attention&lt;/li>
&lt;li>Bahdanau Attention Mechanism&lt;/li>
&lt;li>Multi-Head Attention&lt;/li>
&lt;li>Self-Attention&lt;/li>
&lt;li>Positional Encoding&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h2 id="why-attention-is-needed-">
 Why Attention Is Needed ☆
 
 &lt;a class="anchor" href="#why-attention-is-needed-">#&lt;/a>
 
&lt;/h2>
&lt;p>Traditional encoder-decoder RNN models compress the full input sequence into one context vector.&lt;/p></description></item><item><title>Transformer</title><link>https://arshadhs.github.io/docs/ai/040-deep-learning/090-transformer/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/040-deep-learning/090-transformer/</guid><description>&lt;h1 id="transformer">
 Transformer
 
 &lt;a class="anchor" href="#transformer">#&lt;/a>
 
&lt;/h1>
&lt;p>A transformer is a neural network architecture that uses attention as its main mechanism for processing sequences.&lt;/p>
&lt;p>Unlike RNNs, transformers do not process tokens one by one.&lt;/p>
&lt;p>They process many tokens in parallel and use self-attention to learn relationships between tokens.&lt;/p>
&lt;ul>
&lt;li>
&lt;p>is an architecture of neural networks&lt;/p>
&lt;/li>
&lt;li>
&lt;p>based on the multi-head attention mechanism&lt;/p>
&lt;/li>
&lt;li>
&lt;p>text is converted to numerical representations called tokens, and each token is converted into a vector via lookup from a word embedding table&lt;/p></description></item><item><title>Optimisation of Deep models</title><link>https://arshadhs.github.io/docs/ai/040-deep-learning/100-optimise-deep-models/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/040-deep-learning/100-optimise-deep-models/</guid><description>&lt;h1 id="optimisation-of-deep-models">
 Optimisation of Deep models
 
 &lt;a class="anchor" href="#optimisation-of-deep-models">#&lt;/a>
 
&lt;/h1>
&lt;p>Optimizers are algorithms that update neural network parameters to reduce the loss function.&lt;/p>
&lt;p>Deep networks usually have millions or billions of parameters, so there is usually no closed-form solution.&lt;/p>
&lt;p>Instead, training uses iterative optimisation.&lt;/p>
&lt;blockquote class="book-hint info">
&lt;p>&lt;strong>Key takeaway:&lt;/strong>&lt;br>
An optimiser decides how the model moves through the loss landscape towards lower loss.&lt;/p>
&lt;/blockquote>
&lt;hr>
&lt;ul>
&lt;li>Goal of Optimization&lt;/li>
&lt;li>Optimization Challenges in Deep Learning&lt;/li>
&lt;li>Gradient Descent&lt;/li>
&lt;li>Stochastic Gradient Descent&lt;/li>
&lt;li>Minibatch Stochastic Gradient Descent&lt;/li>
&lt;li>Momentum&lt;/li>
&lt;li>Adagrad and Algorithm&lt;/li>
&lt;li>RMSProp and Algorithm&lt;/li>
&lt;li>Adadelta and Algorithm&lt;/li>
&lt;li>Adam and Algorithm&lt;/li>
&lt;li>Code Implementation and comparison of algorithms (webinar)&lt;/li>
&lt;/ul>
&lt;hr>


&lt;pre class="mermaid">
flowchart TD
 A[&amp;#34;Optimisers in DNN&amp;#34;] --&amp;gt; B[&amp;#34;Gradient Descent Variants&amp;#34;]
 A --&amp;gt; C[&amp;#34;Momentum-based Optimiser&amp;#34;]
 A --&amp;gt; D[&amp;#34;Adaptive Methods&amp;#34;]
 A --&amp;gt; E[&amp;#34;Learning Rate Schedules&amp;#34;]

 D --&amp;gt; D1[&amp;#34;Parameter-specific learning rates&amp;#34;]

 E --&amp;gt; E1[&amp;#34;Learning rate changes during training&amp;#34;]

 style A fill:#E1F5FE,stroke:#4A90E2,stroke-width:2px
 style B fill:#EDE7F6,stroke:#7E57C2
 style C fill:#C8E6C9,stroke:#43A047
 style D fill:#FFF9C4,stroke:#FBC02D
 style E fill:#F8BBD0,stroke:#D81B60
&lt;/pre>

&lt;hr>
&lt;h2 id="goal-of-optimisation-">
 Goal of Optimisation ☆
 
 &lt;a class="anchor" href="#goal-of-optimisation-">#&lt;/a>
 
&lt;/h2>
&lt;p>The goal is to find parameters 
&lt;span>
 \( \theta \)
 &lt;/span>

 that minimise the loss.&lt;/p></description></item><item><title>Gradient Descent and Mini-Batch Gradient Descent</title><link>https://arshadhs.github.io/docs/ai/040-deep-learning/101-gradient-descent-and-mini-batch-gd/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/040-deep-learning/101-gradient-descent-and-mini-batch-gd/</guid><description>&lt;h1 id="optimisation-gradient-descent-and-mini-batch-gradient-descent">
 Optimisation: Gradient Descent and Mini-Batch Gradient Descent
 
 &lt;a class="anchor" href="#optimisation-gradient-descent-and-mini-batch-gradient-descent">#&lt;/a>
 
&lt;/h1>
&lt;p>Gradient descent is the core optimisation idea behind neural network training.
It updates the model parameters by moving in the opposite direction of the gradient of the loss.&lt;/p>
&lt;blockquote class="book-hint info">
&lt;p>&lt;strong>Key takeaway:&lt;/strong>&lt;br>
Gradient descent uses the gradient to decide how to change the parameters.
The learning rate controls how large each update step is.&lt;/p>
&lt;/blockquote>
&lt;hr>


&lt;pre class="mermaid">
flowchart TD
 A[&amp;#34;Gradient Descent Variants&amp;#34;] --&amp;gt; B[&amp;#34;Batch Gradient Descent&amp;#34;]
 A --&amp;gt; C[&amp;#34;Stochastic Gradient Descent&amp;#34;]
 A --&amp;gt; D[&amp;#34;Mini-batch Gradient Descent&amp;#34;]

 B --&amp;gt; B1[&amp;#34;Uses full dataset&amp;#34;]
 B --&amp;gt; B2[&amp;#34;One update per epoch&amp;#34;]
 B --&amp;gt; B3[&amp;#34;Smooth but slow&amp;#34;]

 C --&amp;gt; C1[&amp;#34;Uses one example at a time&amp;#34;]
 C --&amp;gt; C2[&amp;#34;Frequent updates&amp;#34;]
 C --&amp;gt; C3[&amp;#34;Fast but noisy&amp;#34;]

 D --&amp;gt; D1[&amp;#34;Uses small batches&amp;#34;]
 D --&amp;gt; D2[&amp;#34;Efficient on hardware&amp;#34;]
 D --&amp;gt; D3[&amp;#34;Balanced and practical&amp;#34;]

 style A fill:#E1F5FE,stroke:#4A90E2,stroke-width:2px
 style B fill:#EDE7F6,stroke:#7E57C2
 style C fill:#C8E6C9,stroke:#43A047
 style D fill:#FFF9C4,stroke:#FBC02D
&lt;/pre>

&lt;hr>
&lt;h2 id="gradient-descent-rule-">
 Gradient Descent Rule ☆
 
 &lt;a class="anchor" href="#gradient-descent-rule-">#&lt;/a>
 
&lt;/h2>
&lt;p>The gradient tells us the direction in which the loss increases fastest.
To reduce the loss, we move in the opposite direction.&lt;/p></description></item><item><title>Momentum Methods</title><link>https://arshadhs.github.io/docs/ai/040-deep-learning/102-momentum-methods/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/040-deep-learning/102-momentum-methods/</guid><description>&lt;h1 id="optimisation-momentum-methods">
 Optimisation: Momentum Methods
 
 &lt;a class="anchor" href="#optimisation-momentum-methods">#&lt;/a>
 
&lt;/h1>
&lt;p>Momentum improves gradient descent by adding a memory of previous update directions.
Instead of using only the current gradient, the optimiser accumulates velocity across iterations.&lt;/p>
&lt;blockquote class="book-hint info">
&lt;p>&lt;strong>Key takeaway:&lt;/strong>&lt;br>
Momentum helps the optimiser move faster in consistent directions and reduces zigzag movement in directions where gradients oscillate.&lt;/p>
&lt;/blockquote>
&lt;hr>


&lt;pre class="mermaid">
flowchart TD
 A[&amp;#34;Momentum-based Optimiser&amp;#34;] --&amp;gt; B[&amp;#34;SGD with Momentum&amp;#34;]

 B --&amp;gt; B1[&amp;#34;Adds velocity term&amp;#34;]
 B --&amp;gt; B2[&amp;#34;Accumulates past gradients&amp;#34;]
 B --&amp;gt; B3[&amp;#34;Reduces zig-zag movement&amp;#34;]
 B --&amp;gt; B4[&amp;#34;Speeds up movement in useful direction&amp;#34;]
 B --&amp;gt; B5[&amp;#34;Helps through shallow regions&amp;#34;]

 B1 --&amp;gt; C1[&amp;#34;Current update depends on previous update&amp;#34;]
 B2 --&amp;gt; C2[&amp;#34;Builds inertia&amp;#34;]
 B3 --&amp;gt; C3[&amp;#34;Smoother path to minimum&amp;#34;]

 style A fill:#C8E6C9,stroke:#43A047,stroke-width:2px
 style B fill:#E1F5FE,stroke:#4A90E2
 style B1 fill:#EDE7F6,stroke:#7E57C2
 style B2 fill:#FFF9C4,stroke:#FBC02D
 style B3 fill:#F8BBD0,stroke:#D81B60
 style B4 fill:#EDE7F6,stroke:#7E57C2
 style B5 fill:#FFF9C4,stroke:#FBC02D
&lt;/pre>

&lt;hr>
&lt;h2 id="physical-intuition-">
 Physical Intuition ☆
 
 &lt;a class="anchor" href="#physical-intuition-">#&lt;/a>
 
&lt;/h2>
&lt;p>Momentum is often explained using the analogy of a ball rolling down a hill.&lt;/p></description></item><item><title>Regularisation for Deep models</title><link>https://arshadhs.github.io/docs/ai/040-deep-learning/110-regularisation-deep-models/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/040-deep-learning/110-regularisation-deep-models/</guid><description>&lt;h1 id="regularisation-for-deep-models">
 Regularisation for Deep models
 
 &lt;a class="anchor" href="#regularisation-for-deep-models">#&lt;/a>
 
&lt;/h1>
&lt;p>Regularisation means adding constraints or techniques that prevent a model from becoming too complex and memorising the training data.&lt;/p>
&lt;p>The goal is not only low training error.&lt;/p>
&lt;p>The goal is good performance on unseen data.&lt;/p>
&lt;blockquote class="book-hint info">
&lt;p>&lt;strong>Key takeaway:&lt;/strong>&lt;br>
Regularisation helps the model generalise by controlling complexity, stabilising training, and reducing overfitting.&lt;/p>
&lt;/blockquote>
&lt;ul>
&lt;li>Generalization for regression&lt;/li>
&lt;li>Training Error and Generalization Error&lt;/li>
&lt;li>Underfitting or Overfitting&lt;/li>
&lt;li>Model Selection&lt;/li>
&lt;li>Weight Decay and Norms&lt;/li>
&lt;li>Generalization in Classification&lt;/li>
&lt;li>Environment and Distribution Shift&lt;/li>
&lt;li>Generalization in Deep Learning&lt;/li>
&lt;li>Dropout&lt;/li>
&lt;li>Batch Normalization&lt;/li>
&lt;li>Layer Normalization&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h2 id="underfitting-good-fit-and-overfitting-">
 Underfitting, Good Fit, and Overfitting ☆
 
 &lt;a class="anchor" href="#underfitting-good-fit-and-overfitting-">#&lt;/a>
 
&lt;/h2>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>Case&lt;/th>
 &lt;th>Model behaviour&lt;/th>
 &lt;th>Training error&lt;/th>
 &lt;th>Test error&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>Underfitting&lt;/td>
 &lt;td>too simple&lt;/td>
 &lt;td>high&lt;/td>
 &lt;td>high&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>Good fit&lt;/td>
 &lt;td>captures useful pattern&lt;/td>
 &lt;td>low&lt;/td>
 &lt;td>low&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>Overfitting&lt;/td>
 &lt;td>memorises training noise&lt;/td>
 &lt;td>very low&lt;/td>
 &lt;td>high&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>


&lt;pre class="mermaid">flowchart LR
 A[&amp;#34;Model Complexity&amp;#34;] --&amp;gt; B[&amp;#34;Too Simple: Underfitting&amp;#34;]
 A --&amp;gt; C[&amp;#34;Just Right: Good Fit&amp;#34;]
 A --&amp;gt; D[&amp;#34;Too Complex: Overfitting&amp;#34;]

 style A fill:#E1F5FE,stroke:#4A90E2
 style B fill:#FFF9C4,stroke:#FBC02D
 style C fill:#C8E6C9,stroke:#43A047
 style D fill:#EDE7F6,stroke:#7E57C2&lt;/pre>
&lt;hr>
&lt;h2 id="training-error-and-generalisation-error-">
 Training Error and Generalisation Error ☆
 
 &lt;a class="anchor" href="#training-error-and-generalisation-error-">#&lt;/a>
 
&lt;/h2>
&lt;p>Training error measures performance on data used for learning.&lt;/p></description></item><item><title>DNN Formula and Numerical Sheet</title><link>https://arshadhs.github.io/docs/ai/040-deep-learning/900-dnn-exam-formula-and-numerical-sheet/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/040-deep-learning/900-dnn-exam-formula-and-numerical-sheet/</guid><description>&lt;h1 id="dnn-formula-and-numerical-sheet">
 DNN Formula and Numerical Sheet
 
 &lt;a class="anchor" href="#dnn-formula-and-numerical-sheet">#&lt;/a>
 
&lt;/h1>
&lt;p>This page consolidates the most useful Deep Neural Networks formulas and numerical patterns for revision.&lt;/p>
&lt;p>It is designed for preparation and should be used together with the topic pages.&lt;/p>
&lt;blockquote class="book-hint info">
&lt;p>&lt;strong>Revision strategy:&lt;/strong>&lt;br>
Do not only memorise formulas.&lt;/p>
&lt;p>For each formula, know:&lt;/p>
&lt;ol>
&lt;li>what each symbol means&lt;/li>
&lt;li>when to apply it&lt;/li>
&lt;li>how to substitute values carefully&lt;/li>
&lt;li>what the output shape or answer represents&lt;/li>
&lt;/ol>
&lt;/blockquote>
&lt;hr>
&lt;h1 id="1-artificial-neuron">
 1. Artificial Neuron
 
 &lt;a class="anchor" href="#1-artificial-neuron">#&lt;/a>
 
&lt;/h1>
&lt;h2 id="weighted-sum-">
 Weighted Sum ☆
 
 &lt;a class="anchor" href="#weighted-sum-">#&lt;/a>
 
&lt;/h2>
&lt;span style="color: blue;">
 &lt;span>
 \[ 
z = \sum_{i=1}^{n} w_i x_i + b
 \]
 &lt;/span>
&lt;/span>
&lt;p>Vector form:&lt;/p></description></item></channel></rss>