<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Gradient Descent | Portfolio</title><link>https://ansangah.github.io/en/tags/gradient-descent/</link><atom:link href="https://ansangah.github.io/en/tags/gradient-descent/index.xml" rel="self" type="application/rss+xml"/><description>Gradient Descent</description><generator>Hugo Blox Builder (https://hugoblox.com)</generator><language>en</language><lastBuildDate>Wed, 22 Oct 2025 00:00:00 +0000</lastBuildDate><image><url>https://ansangah.github.io/media/sharing.png</url><title>Gradient Descent</title><link>https://ansangah.github.io/en/tags/gradient-descent/</link></image><item><title>📁 Chapter 3: Neural Network Learning and Optimization</title><link>https://ansangah.github.io/en/blog/ai-blog/3networktraining/</link><pubDate>Wed, 22 Oct 2025 00:00:00 +0000</pubDate><guid>https://ansangah.github.io/en/blog/ai-blog/3networktraining/</guid><description>
&lt;details class="print:hidden xl:hidden" open&gt;
&lt;summary&gt;Table of Contents&lt;/summary&gt;
&lt;div class="text-sm"&gt;
&lt;nav id="TableOfContents"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#1-overview-of-neural-network-learning"&gt;1. Overview of Neural Network Learning&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#2-model-parameters-vs-hyperparameters"&gt;2. Model Parameters vs. Hyperparameters&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#3-setting-up-the-optimization-problem"&gt;3. Setting Up the Optimization Problem&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#4-loss-functions-for-regression-and-classification"&gt;4. Loss Functions for Regression and Classification&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#5-core-idea-of-gradient-descent"&gt;5. Core Idea of Gradient Descent&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#6-families-of-optimization-algorithms"&gt;6. Families of Optimization Algorithms&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#7-routine-of-gradient-descent"&gt;7. Routine of Gradient Descent&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#8-summary-at-a-glance"&gt;8. Summary at a Glance&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/nav&gt;
&lt;/div&gt;
&lt;/details&gt;
&lt;h2 id="1-overview-of-neural-network-learning"&gt;1. Overview of Neural Network Learning&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;A neural network initially has no idea what output to produce for a given input.&lt;/li&gt;
&lt;li&gt;By repeatedly feeding training data, it gradually learns the mapping rule between input and output.&lt;/li&gt;
&lt;li&gt;“Learning” means discovering this mapping rule.&lt;/li&gt;
&lt;li&gt;Each neuron is composed of weighted summation and an activation function.&lt;/li&gt;
&lt;li&gt;Stacking layers forms the overall neural network structure, and these structural choices are fixed before training.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id="2-model-parameters-vs-hyperparameters"&gt;2. Model Parameters vs. Hyperparameters&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Model parameters&lt;/strong&gt;: weights and biases.&lt;br&gt;
These change continuously during training depending on data and are saved as the trained model.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Hyperparameters&lt;/strong&gt;: learning rate, optimizer, batch size, network depth, dropout rate, etc.&lt;br&gt;
These are set manually and do not change automatically through training.&lt;/li&gt;
&lt;li&gt;If an activation function (e.g., PReLU) contains a learnable coefficient, that coefficient counts as a model parameter.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For example, in a house price prediction model, the mapping&lt;br&gt;
&lt;code&gt;(number of rooms, area, house type, distance to station → price)&lt;/code&gt;&lt;br&gt;
is captured by the model parameters. Once training is complete, the model can perform inference based on those learned rules.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="3-setting-up-the-optimization-problem"&gt;3. Setting Up the Optimization Problem&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Learning is redefined as minimizing or maximizing an objective function.&lt;/li&gt;
&lt;li&gt;Standard formulation:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;$$
\begin{aligned}
&amp;amp;\text{minimize} &amp;amp;&amp;amp; f(\mathbf{x}) \
&amp;amp;\text{subject to} &amp;amp;&amp;amp; g_i(\mathbf{x}) \le 0,\quad i=1,\dots,m \
&amp;amp;&amp;amp;&amp;amp; h_j(\mathbf{x}) = 0,\quad j=1,\dots,p
\end{aligned}
$$&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;( f(\mathbf{x}) ): objective (loss) function&lt;/li&gt;
&lt;li&gt;( g_i, h_j ): constraint functions&lt;/li&gt;
&lt;li&gt;Getting close to the optimal solution is called &lt;em&gt;convergence&lt;/em&gt;. Once sufficiently close, the model is said to have converged.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id="4-loss-functions-for-regression-and-classification"&gt;4. Loss Functions for Regression and Classification&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Regression Problems&lt;/strong&gt;:&lt;br&gt;
Find parameters ( \theta ) that minimize the difference between target ( t ) and prediction ( y = f_\theta(x) ).&lt;br&gt;
Representative loss = Mean Squared Error (MSE).&lt;/p&gt;
&lt;p&gt;$$
\begin{aligned}
&amp;amp;\underset{\theta}{\text{minimize}} &amp;amp;&amp;amp; \frac{1}{N} \sum_{i=1}^{N} (f(\mathbf{x}_i; \theta) - t_i)^2 \
&amp;amp;\text{subject to} \
&amp;amp;&amp;amp;&amp;amp; \text{No constraints}
\end{aligned}
$$&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Classification Problems&lt;/strong&gt;:&lt;br&gt;
Find parameters ( \theta ) that minimize the difference between the observed distribution ( t ) and predicted distribution ( y ).&lt;br&gt;
Representative loss = Cross-Entropy (CE).&lt;/p&gt;
&lt;p&gt;$$
\begin{aligned}
&amp;amp;\underset{\theta}{\text{minimize}} &amp;amp;&amp;amp; - \frac{1}{N} \sum_{i=1}^{N} \sum_{k=1}^{K} t_{ik} \log \hat{y}_{ik} \
&amp;amp;\text{subject to} \
&amp;amp;&amp;amp;&amp;amp; \text{No constraints}
\end{aligned}
$$&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Once the loss function is defined, parameters are updated iteratively in the direction that minimizes the loss.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="5-core-idea-of-gradient-descent"&gt;5. Core Idea of Gradient Descent&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The ideal case is reaching the &lt;em&gt;global minimum&lt;/em&gt;, but real loss surfaces are complex → in practice, we settle for a good &lt;em&gt;local minimum&lt;/em&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Gradient descent updates parameters using the gradient of the loss function ( L(\theta) ):&lt;/p&gt;
&lt;p&gt;$$
\theta^{(t+1)} = \theta^{(t)} - \alpha \nabla_\theta L(\theta^{(t)})
$$&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;( \alpha ): learning rate (step size)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;( -\nabla_\theta L ): steepest descent direction&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Since neural networks are composite functions, gradients for each parameter are computed via the &lt;strong&gt;chain rule&lt;/strong&gt; (backpropagation).&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id="6-families-of-optimization-algorithms"&gt;6. Families of Optimization Algorithms&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;First-order methods&lt;/strong&gt;: Gradient Descent, SGD, Momentum, AdaGrad, RMSProp, Adam, etc.&lt;br&gt;
Stable even when the loss surface is non-convex.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Quasi-second-order methods&lt;/strong&gt;: Quasi-Newton, Conjugate Gradient, Levenberg–Marquardt.&lt;br&gt;
Approximate curvature information for faster convergence but require more memory.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Second-order methods&lt;/strong&gt;: Newton’s method, interior-point methods.&lt;br&gt;
Directly use curvature, fast but computationally heavy and suited to convex problems — impractical for large neural networks.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id="7-routine-of-gradient-descent"&gt;7. Routine of Gradient Descent&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Perform &lt;strong&gt;forward propagation&lt;/strong&gt; to compute predictions.&lt;/li&gt;
&lt;li&gt;Evaluate the &lt;strong&gt;loss function&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Compute partial derivatives (gradients) of the loss w.r.t. each parameter (&lt;strong&gt;backpropagation&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;Update weights and biases using the update rule.&lt;/li&gt;
&lt;li&gt;Stop training once the loss change is below a certain threshold (convergence).&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;When parameters are fixed after convergence, the model encodes the mapping function that determines outputs for any given input.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="8-summary-at-a-glance"&gt;8. Summary at a Glance&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Neural network learning = discovering functional rules from data.&lt;/li&gt;
&lt;li&gt;Regression usually uses MSE; classification uses Cross-Entropy.&lt;/li&gt;
&lt;li&gt;Optimization = reformulating learning as a loss minimization problem and solving it numerically.&lt;/li&gt;
&lt;li&gt;Gradient descent is the fundamental yet powerful first-order optimization method.&lt;/li&gt;
&lt;li&gt;Backpropagation is essential for applying gradient descent to neural networks.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;div class="text-center"&gt;
&lt;a
id="button-796ae02c7e5f487593cdbbe4c189dc87"
href="https://ansangah.github.io/uploads/deeplearning/3-%ec%8b%a0%ea%b2%bd%eb%a7%9d%ed%95%99%ec%8a%b5.pdf"
class="inline-flex items-center gap-2 font-medium no-underline transition-all duration-300 ease-out transform-gpu focus:outline-none focus:ring-4 focus:ring-offset-2 focus:ring-offset-white dark:focus:ring-offset-zinc-900 disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none bg-gradient-to-br from-primary-500 to-primary-600 hover:from-primary-600 hover:to-primary-700 active:from-primary-700 active:to-primary-800 text-white shadow-lg shadow-primary-500/25 hover:shadow-xl hover:shadow-primary-500/30 hover:-translate-y-0.5 hover:scale-[1.02] active:scale-[0.98] focus:ring-primary-500/50 px-6 py-3 text-lg rounded-lg"
role="button"
aria-label="Download PDF"
&gt;
&lt;span class="flex-shrink-0"&gt;
&lt;svg class="w-4 h-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"&gt;&lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m.75 12l3 3m0 0l3-3m-3 3v-6m-1.5-9H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9"/&gt;&lt;/svg&gt;
&lt;/span&gt;
&lt;span&gt;Download PDF&lt;/span&gt;
&lt;/a&gt;
&lt;/div&gt;</description></item></channel></rss>