CSE275Semester 4 • 3 CreditsElective Subjects

Optimization Techniques For Machine Learning

This subject explores optimization techniques in machine learning and artificial intelligence systems, covering population-based, evolutionary, swarm intelligence, hybrid, and metaheuristic algorithms. It focuses on applying these methods for feature selection, model optimization, hyperparameter tuning, and developing real-world solutions.

Syllabus PDF
6 Units • Notes • Model Answers • MCQs
Select Course Unit (6 Units)
Active: Unit 1
Unit 1:Unit 1: Introduction to Optimization in Machine Learning
22 min read•High-Yield Unit Guide

Unit 1: Introduction to Optimization in Machine Learning

Unit 1 Exam Focus & Core Takeaways

Review the core definitions, standard architectures, and syntax patterns below. Pay special attention to sections highlighted with bullet points for your mid-term and end-term subjective questions.

Unit 1: Introduction to Optimization in Machine Learning


1. Mathematical Foundations & The Role of Optimization in AI/ML

Machine Learning (ML) can be distilled into three fundamental pillars:

  1. Representation: The choice of hypothesis class (e.g., linear models, kernel machines, deep neural networks, decision trees).
  2. Evaluation: An objective function (loss or risk function) that mathematically measures how well a model hypothesis aligns with observational data.
  3. Optimization: The algorithmic search mechanism employed to locate the optimal hypothesis within the model's hypothesis space that minimizes or maximizes the evaluation criterion.
CODE
       +-------------------------------------------------------+
       |               Machine Learning Pipeline               |
       +-------------------------------------------------------+
                                  |
            +---------------------+---------------------+
            |                     |                     |
            v                     v                     v
    +---------------+     +---------------+     +---------------+
    | Representation|     |   Evaluation  |     |  Optimization |
    | (Architecture,|     | (Loss/Cost    |     | (Search Engine|
    |  Hypothesis   |     |  Function,    |     |  GD, Adam,    |
    |  Space H)     |     |  Regularizer) |     |  GA, PSO)     |
    +---------------+     +---------------+     +---------------+
            |                     |                     |
            +---------------------+---------------------+
                                  |
                                  v
                  Optimal Model Parameters theta*

1.1 Parameters vs. Hyperparameters

In learning systems, parameters and hyperparameters operate at distinct operational tiers:

  • Model Parameters (heta∈Rd heta \in \mathbb{R}^d or W,bW, b): Internal coefficients that are directly determined by the optimization algorithm from training data (e.g., connection weights and bias vectors in artificial neural networks, hyperplane coefficients ww in linear classifiers).
  • Hyperparameters (λ∈Λ\lambda \in \Lambda): External structural or algorithmic configurations fixed prior to executing the primary parameter optimization routine. Examples include learning rate η\eta, mini-batch size BB, weight decay coefficient λ\lambda, tree depth, mutation rates in evolutionary algorithms, and number of swarm particles.

1.2 Learning as Search in Parameter Space

Let X\mathcal{X} denote the input feature space and Y\mathcal{Y} denote the label or target space. A parameterized predictive model is denoted as:

ightarrow \mathcal{Y}, \quad heta \in \Theta \subseteq \mathbb{R}^d$$ where $\Theta$ represents the parameter space. Given a dataset of $N$ independent and identically distributed (i.i.d.) observations $\mathcal{D} = \{(x_i, y_i)\}_{i=1}^N$, training is mathematically formalized as an optimization problem: $$ heta^* = rg\min_{ heta \in \Theta} \mathcal{L}( heta; \mathcal{D})$$ where $\mathcal{L}( heta; \mathcal{D})$ represents the empirical objective function. --- ## 2. Formal Optimization Problems in Learning Systems A general mathematical optimization problem in canonical form is expressed as: $$egin{aligned} \min_{ heta \in \mathbb{R}^d} \quad & f_0( heta) \ ext{subject to} \quad & g_i( heta) \le 0, \quad i = 1, \dots, m \ & h_j( heta) = 0, \quad j = 1, \dots, p \end{aligned}$$ where: - $ heta \in \mathbb{R}^d$ is the vector of decision variables (model parameters). - $f_0: \mathbb{R}^d ightarrow \mathbb{R}$ is the objective or cost function. - $g_i: \mathbb{R}^d ightarrow \mathbb{R}$ are the inequality constraint functions defining feasible regions. - $h_j: \mathbb{R}^d ightarrow \mathbb{R}$ are the equality constraint functions. - The feasible set $\Omega \subseteq \mathbb{R}^d$ is defined as $\Omega = \{ heta \in \mathbb{R}^d \mid g_i( heta) \le 0, \; h_j( heta) = 0\}$. ### 2.1 Common Objective and Loss Functions Different machine learning paradigms enforce distinct mathematical loss formulations: 1. **Mean Squared Error (MSE) - Regression:** $$J_{ ext{MSE}}( heta) = rac{1}{2N} \sum_{i=1}^N \left( f_ heta(x_i) - y_i ight)^2$$ MSE produces a quadratic, continuously differentiable loss surface. Under linear assumptions $f_ heta(x) = heta^T x$, MSE yields a strictly convex optimization problem with a closed-form analytic solution via Ordinary Least Squares (OLS): $$ heta^* = (X^T X)^{-1} X^T y$$ 2. **Binary Cross-Entropy (BCE) / Log Loss - Binary Classification:** Given $y_i \in \{0, 1\}$ and predicted probability $\hat{y}_i = \sigma( heta^T x_i) = rac{1}{1 + e^{- heta^T x_i}}$: $$J_{ ext{BCE}}( heta) = - rac{1}{N} \sum_{i=1}^N \left[ y_i \ln(\hat{y}_i) + (1 - y_i) \ln(1 - \hat{y}_i) ight]$$ BCE is derived from the principle of Maximum Likelihood Estimation (MLE) under Bernoulli distributed observation errors. 3. **Categorical Cross-Entropy (Softmax Loss) - Multi-Class Classification:** For $C$ discrete classes with one-hot encoded targets $y_{i,c} \in \{0, 1\}$ and class probabilities $p_{i,c} = rac{e^{z_{i,c}}}{\sum_{k=1}^C e^{z_{i,k}}}$: $$J_{ ext{CCE}}( heta) = - rac{1}{N} \sum_{i=1}^N \sum_{c=1}^C y_{i,c} \ln(p_{i,c})$$ 4. **Hinge Loss - Support Vector Machines (SVM):** For binary labels $y_i \in \{-1, +1\}$: $$J_{ ext{Hinge}}( heta) = rac{1}{N} \sum_{i=1}^N \max\left(0, 1 - y_i f_ heta(x_i) ight)$$ Hinge loss is non-differentiable at the inflection point $y_i f_ heta(x_i) = 1$, requiring subgradient optimization techniques. ### 2.2 Constrained Optimization and Lagrange Multipliers When constraints are present, constrained optimization converts the primal constrained task into an unconstrained dual optimization formulation via the **Lagrangian function** $\mathcal{L}( heta, lpha, eta)$: $$\mathcal{L}( heta, lpha, eta) = f_0( heta) + \sum_{i=1}^m lpha_i g_i( heta) + \sum_{j=1}^p eta_j h_j( heta)$$ where $lpha_i \ge 0$ are the Karush-Kuhn-Tucker (KKT) multipliers for inequality constraints and $eta_j \in \mathbb{R}$ are Lagrange multipliers for equality constraints. The **Karush-Kuhn-Tucker (KKT) First-Order Necessary Conditions** for local optimality at point $ heta^*$ state: 1. **Stationarity:** $ abla_ heta \mathcal{L}( heta^*, lpha^*, eta^*) = abla f_0( heta^*) + \sum_{i=1}^m lpha_i^* abla g_i( heta^*) + \sum_{j=1}^p eta_j^* abla h_j( heta^*) = \mathbf{0}$ 2. **Primal Feasibility:** $g_i( heta^*) \le 0 \; ( orall i)$ and $h_j( heta^*) = 0 \; ( orall j)$ 3. **Dual Feasibility:** $lpha_i^* \ge 0 \; ( orall i)$ 4. **Complementary Slackness:** $lpha_i^* g_i( heta^*) = 0 \; ( orall i)$ In Hard-Margin and Soft-Margin Support Vector Machines, complementary slackness mathematically dictates that only data vectors lying directly on or violating the margin have $lpha_i^* > 0$; these critical boundary vectors are the **Support Vectors**. --- ## 3. Loss Minimization, Loss Landscapes, and Risk Minimization ### 3.1 Empirical Risk Minimization (ERM) vs. Structural Risk Minimization (SRM) In statistical learning theory: - **True Risk (Generalization Error):** The expected loss across the entire data-generating distribution $P(X, Y)$: $$R( heta) = \mathbb{E}_{(x, y) \sim P}[L(f_ heta(x), y)] = \int_{\mathcal{X} imes \mathcal{Y}} L(f_ heta(x), y) \, dP(x, y)$$ Because $P(X, Y)$ is unknown, $R( heta)$ cannot be computed directly. - **Empirical Risk:** The sample average error evaluated on the observed finite training set $\mathcal{D}_N$: $$R_{ ext{emp}}( heta) = rac{1}{N} \sum_{i=1}^N L(f_ heta(x_i), y_i)$$ **Empirical Risk Minimization (ERM)** selects $\hat{ heta}_{ ext{ERM}} = rg\min_ heta R_{ ext{emp}}( heta)$. When model capacity is excessively high relative to sample size $N$, ERM leads to severe overfitting. - **Structural Risk Minimization (SRM):** To bound generalization error, Vapnik introduced SRM, which augments empirical risk with a complexity regularization penalty $\Omega( heta)$: $$R_{ ext{SRM}}( heta) = R_{ ext{emp}}( heta) + \lambda \Omega( heta)$$ where $\lambda > 0$ controls the regularization trade-off: - **L2 Regularization (Ridge / Weight Decay):** $\Omega( heta) = rac{1}{2} \| heta\|_2^2 = rac{1}{2} \sum_{j=1}^d heta_j^2$. Promotes diffuse, small weights and prevents co-adaptation. - **L1 Regularization (Lasso):** $\Omega( heta) = \| heta\|_1 = \sum_{j=1}^d | heta_j|$. Induces sparsity by driving non-informative feature weights to exact zeros at the non-smooth axes of the L1 ball. - **Elastic Net Regularization:** $\Omega( heta) = \lambda_1 \| heta\|_1 + \lambda_2 rac{1}{2} \| heta\|_2^2$. ### 3.2 Loss Landscape Topologies and Pathologies The geometric topography of the objective function $J( heta)$ across high-dimensional parameter space defines the difficulty of optimization: - **Global Minimum:** A parameter vector $ heta^* \in \Theta$ satisfying $J( heta^*) \le J( heta), \; orall heta \in \Theta$. - **Local Minimum:** A point $ heta_L$ satisfying $J( heta_L) \le J( heta)$ for all $ heta$ within a local neighborhood $\| heta - heta_L\| < \epsilon$. - **Saddle Points:** Stationary points where $ abla J( heta) = \mathbf{0}$, but the Hessian matrix $ abla^2 J( heta)$ has both strictly positive and strictly negative eigenvalues. In deep high-dimensional loss landscapes, saddle points are exponentially more prevalent than isolated local minima. - **Ravines / Ill-Conditioned Valleys:** Geometric regions where curvature is steep along one directional coordinate but flat along orthogonal coordinates. This is characterized by a large condition number $\kappa = rac{\lambda_{\max}(H)}{\lambda_{\min}(H)} \gg 1$, causing first-order gradient descent to oscillate wildly across the canyon walls while progressing at a negligible pace along the ravine base. - **Plateaus:** Extended flat regions where gradients approach zero ($\| abla J( heta)\| pprox 0$), causing first-order gradient algorithms to stall prematurely. ``` Types of Stationary Points in Loss Landscapes: Local/Global Minimum Saddle Point Plateau \ / \ / ------------- \ / \_/ (curve up in X) (gradient = 0) \_/ ---/ \--- (curve down in Y) Hessian: Positive Definite Hessian: Mixed Eigenvalues Hessian: Zero/Near-Zero ``` --- ## 4. Gradient-Based vs. Gradient-Free Optimization Optimization algorithms are categorized based on their dependency on functional derivatives. ``` +---------------------------------------------------------------------------------------+ | Optimization Algorithms | +---------------------------------------------------------------------------------------+ | | v v +----------------------------------+ +----------------------------------+ | Gradient-Based Methods | | Gradient-Free Methods | +----------------------------------+ +----------------------------------+ | First-Order: | | Direct / Heuristic Search: | | - Batch Gradient Descent (BGD) | | - Grid Search & Random Search | | - Stochastic GD (SGD) | | - Nelder-Mead Simplex | | - SGD with Momentum & Nesterov | | - Pattern Search | | - AdaGrad, RMSprop, Adam, AdamW | | Metaheuristics: | | Second-Order: | | - Genetic Algorithms (GA) | | - Newton-Raphson Method | | - Particle Swarm Opt (PSO) | | - Quasi-Newton (BFGS, L-BFGS) | | - Simulated Annealing (SA) | +----------------------------------+ +----------------------------------+ ``` ### 4.1 First-Order Gradient-Based Algorithms #### Batch Gradient Descent (BGD) Computes the exact analytic gradient using all $N$ training samples at every iteration: $$ heta_{t+1} = heta_t - \eta abla J( heta_t) = heta_t - \eta \left( rac{1}{N} \sum_{i=1}^N abla_ heta L(f_ heta(x_i), y_i) ight)$$ - **Pros:** Deterministic descent trajectory; guaranteed convergence to global minimum on convex surfaces. - **Cons:** Computational complexity is $O(N \cdot d)$ per step; intractable for massive web-scale datasets; cannot be updated online. #### Stochastic Gradient Descent (SGD) Approximates the true gradient using a single randomly sampled observation $(x_t, y_t)$ at step $t$: $$ heta_{t+1} = heta_t - \eta abla_ heta L(f_ heta(x_t), y_t)$$ - **Pros:** Fast $O(d)$ parameter updates; stochastic variance acts as computational noise that helps escape shallow local minima. - **Cons:** High gradient variance creates erratic oscillations; requires progressive learning rate decay schedules (e.g., Robbins-Monro conditions $\sum \eta_t = \infty, \; \sum \eta_t^2 < \infty$). #### Mini-Batch Gradient Descent The standard training standard in modern deep learning. Updates parameters over a small subset $\mathcal{B} \subset \mathcal{D}$ of batch size $B$ (typically $32 \le B \le 512$): $$ heta_{t+1} = heta_t - \eta \left( rac{1}{B} \sum_{i \in \mathcal{B}} abla_ heta L(f_ heta(x_i), y_i) ight)$$ - Strikes an optimal balance: leverages GPU vectorization (SIMD) while retaining beneficial stochastic exploration. #### Classical Momentum & Nesterov Accelerated Gradient (NAG) To accelerate convergence through ravines and suppress high-frequency oscillations, **Momentum** introduces an exponential moving average velocity vector $v_t$: $$v_{t+1} = \gamma v_t + \eta abla J( heta_t)$$ $$ heta_{t+1} = heta_t - v_{t+1}$$ where $\gamma \in [0.9, 0.99]$ is the momentum friction coefficient. **Nesterov Accelerated Gradient (NAG)** calculates the gradient not at current position $ heta_t$, but at the "look-ahead" predictive position $ heta_t - \gamma v_t$: $$v_{t+1} = \gamma v_t + \eta abla J( heta_t - \gamma v_t)$$ $$ heta_{t+1} = heta_t - v_{t+1}$$ NAG acts as an anticipatory braking mechanism, reducing overshooting around sharp turns in the loss surface. #### Adaptive Learning Rate Algorithms: AdaGrad, RMSprop, Adam, AdamW Standard SGD applies an identical learning rate $\eta$ across all $d$ dimensions. In practice, sparse features require larger steps, whereas dense, volatile features require smaller steps. 1. **AdaGrad (Duchi et al., 2011):** Accumulates historical squared gradients: $$G_{t} = G_{t-1} + g_t \odot g_t$$ $$ heta_{t+1} = heta_t - rac{\eta}{\sqrt{G_t} + \epsilon} \odot g_t$$ *Defect:* $G_t$ monotonically increases, causing the effective step size to shrink to zero, prematurely halting training before convergence. 2. **RMSprop (Hinton, 2012):** Replaces raw accumulation with an exponentially decaying moving average of squared gradients: $$v_t = eta v_{t-1} + (1 - \ beta) g_t^2$$ $$ heta_{t+1} = heta_t - rac{\eta}{\sqrt{v_t} + \epsilon} \odot g_t$$ where $eta pprox 0.9$. Resolves AdaGrad's diminishing step size problem. 3. **Adam (Adaptive Moment Estimation - Kingma & Ba, 2014):** Combines first moment tracking (momentum) with second uncentered moment tracking (RMSprop), augmented with initialization bias correction: $$m_t = eta_1 m_{t-1} + (1 - eta_1) g_t \quad ext{(First Moment Estimate)}$$ $$v_t = eta_2 v_{t-1} + (1 - eta_2) g_t^2 \quad ext{(Second Moment Estimate)}$$ Bias-corrected moment vectors: $$\hat{m}_t = rac{m_t}{1 - eta_1^t}, \quad \hat{v}_t = rac{v_t}{1 - eta_2^t}$$ Parameter update: $$ heta_{t+1} = heta_t - rac{\eta}{\sqrt{\hat{v}_t} + \epsilon} \hat{m}_t$$ Default hyperparameters: $eta_1 = 0.9$, $eta_2 = 0.999$, $\epsilon = 10^{-8}$. 4. **AdamW (Loshchilov & Hutter, 2017):** Fixes the incorrect coupling of L2 weight decay in Adam. In standard Adam with L2 regularization, the weight penalty is added to the gradient $g_t$, which becomes warped by the adaptive second moment $\sqrt{\hat{v}_t}$. AdamW decouples weight decay directly from gradient moments: $$ heta_{t+1} = heta_t - \eta \lambda heta_t - rac{\eta}{\sqrt{\hat{v}_t} + \epsilon} \hat{m}_t$$ ### 4.2 Second-Order Optimization Algorithms Second-order methods incorporate curvature information via the **Hessian matrix** $H \in \mathbb{R}^{d imes d}$: $$H_{jk} = rac{\partial^2 J( heta)}{\partial heta_j \partial heta_k}$$ The **Newton-Raphson Update** uses the second-order Taylor expansion: $$ heta_{t+1} = heta_t - H^{-1}( heta_t) abla J( heta_t)$$ - **Properties:** Achieves quadratic convergence ($\mathcal{O}(\| heta_t - heta^*\|^2)$) near strict local minima. It is scale-invariant and jumps directly to the minimum of a quadratic bowl in a single step. - **Computational Bottlenecks in Machine Learning:** 1. Computing the full Hessian requires $O(d^2)$ space and $O(N d^2)$ operations. 2. Inverting $H$ costs $O(d^3)$ arithmetic operations. For deep networks with $d pprox 10^8$ weights, $O(d^3) pprox 10^{24}$ flops, which is computationally intractable. 3. If $H$ is not positive definite (e.g., at saddle points where eigenvalues are negative), Newton's step can propel parameters toward local maxima rather than minima. **Quasi-Newton Methods (BFGS & L-BFGS):** - Broyden-Fletcher-Goldfarb-Shanno (BFGS) constructs an iterative rank-2 approximation of $H^{-1}$ using successive gradient differences, reducing per-iteration cost to $O(d^2)$. - **Limited-memory BFGS (L-BFGS)** stores only the last $m$ displacement vectors ($m pprox 10$), avoiding full $d imes d$ matrix storage. L-BFGS is the optimizer of choice for moderate-sized convex ML models (e.g., CRF, Logistic Regression, Scikit-Learn MLPClassifier). --- ## 5. Convex vs. Non-Convex Optimization in ML ### 5.1 Convex Sets and Convex Functions 1. **Convex Set:** A set $C \subseteq \mathbb{R}^d$ is convex if for all $x, y \in C$ and any $lpha \in [0, 1]$: $$lpha x + (1 - lpha) y \in C$$ (The line segment connecting any two points in $C$ lies entirely within $C$). 2. **Convex Function:** A function $f: C ightarrow \mathbb{R}$ defined over a convex set $C$ is convex if for all $x, y \in C$ and $lpha \in [0, 1]$: $$f(lpha x + (1 - lpha) y) \le lpha f(x) + (1 - lpha) f(y)$$ Geometrically, the secant line between $(x, f(x))$ and $(y, f(y))$ lies on or above the graph of $f$. ``` Convex Function Non-Convex Function \ / /\ / \ Secant/ / \ / \ --- / / \__/ \___/ / Any local min is global Multiple local minima, saddles ``` ### 5.2 Mathematical Criteria for Convexity - **First-Order Condition:** A continuously differentiable function $f$ is convex on $C$ if and only if: $$f(y) \ge f(x) + abla f(x)^T (y - x), \quad orall x, y \in C$$ (The first-order Taylor approximation forms a global underestimator of $f$). - **Second-Order Condition:** A twice continuously differentiable function $f$ is convex on $C$ if and only if its Hessian matrix is **Positive Semi-Definite (PSD)** everywhere:

abla^2 f(x) \succeq 0, \quad orall x \in C \iff z^T
abla^2 f(x) z \ge 0, ; orall z \in \mathbb{R}^d$$
All eigenvalues of abla2f(x) abla^2 f(x) must be non-negative: \lambda_i(H) \ge 0, \; orall i.

  • Strict Convexity: If abla2f(x)≻0 abla^2 f(x) \succ 0 (strictly positive definite, λi>0\lambda_i > 0), then the function is strictly convex and possesses a unique global minimum.

5.3 Comparison Table: Convex vs. Non-Convex Optimization in ML

PropertyConvex OptimizationNon-Convex Optimization
Local vs. Global OptimaEvery local minimum is guaranteed to be a global minimum.Multiple isolated local minima exist; local minima are generally suboptimal.
Stationary Points$
abla f(x) = \mathbf{0}$ uniquely identifies the global minimum.Stationary points include local minima, local maxima, and saddle points.
Curvature / HessianPSD everywhere (λi≥0\lambda_i \ge 0).Indefinite Hessian (positive, negative, and zero eigenvalues coexist).
Representative ML ModelsLinear Regression (MSE), Logistic Regression, Linear SVM, Lasso/Ridge.Deep Neural Networks (CNNs, Transformers, MLPs), K-Means, Autoencoders.
Algorithmic GuaranteesStrong polynomial time convergence guarantees (ϵ\epsilon-optimality).NP-hard in general; heuristics search for "good enough" basins of attraction.
Sensitivity to InitInsensitive; converges to the same optimum regardless of starting point heta0 heta_0.Highly sensitive; initialization (He, Xavier/Glorot) dictates final convergence basin.

6. The Need for Metaheuristic Optimization

6.1 Limitations of Gradient-Based Solvers

While gradient-based algorithms power parameter optimization for smooth, differentiable models, they suffer catastrophic failure in several critical scenarios:

  1. Non-Differentiable / Discontinuous Landscapes: Objective functions with discontinuous step thresholds, discrete branchings, or non-smooth objectives.
  2. Combinatorial Search Spaces: Problems where decision variables belong to a discrete domain (e.g., feature selection where x∈{0,1}dx \in \{0, 1\}^d). Gradients cannot be computed with respect to binary inclusions.
  3. Black-Box Evaluation: Situations where the analytical function form is unknown, and the evaluation relies on running an external physical simulation, complex benchmark test, or external software binary.
  4. Severe Multi-Modality: Highly rugged surfaces riddled with thousands of deceptive local optima and vast plateaus where standard gradient descent gets trapped almost immediately.

6.2 The No Free Lunch (NFL) Theorem

Formulated by David Wolpert and William Macready (1997), the No Free Lunch Theorem for Optimization states:

If an algorithm performs better than random search on a certain class of problems, it must perform worse on the set of all remaining problems. Averaged across all mathematically possible cost functions, all optimization algorithms possess identical expected performance.

Crucial ML Takeaway: There is no single universal optimization algorithm. Gradient descent excels on smooth convex problems; metaheuristics (GA, PSO, Differential Evolution) excel on non-differentiable, rugged, multi-modal, or combinatorial spaces. Domain-specific knowledge must guide algorithm selection.

6.3 Exploration vs. Exploitation Trade-off

Every metaheuristic algorithm must balance two competing operational imperatives:

  • Exploration (Diversification): The ability to investigate broadly distant, unvisited territories across the entire search space to avoid premature convergence in deceptive local basins.
  • Exploitation (Intensification): The ability to concentrate search effort locally around the neighborhood of currently discovered high-performing solutions to refine accuracy.
CODE
       Low Exploration / High Exploitation ---> Trapped in Local Optima
       High Exploration / Low Exploitation ---> Inefficient Random Walk
       Balanced Dynamic Control            ---> Robust Metaheuristic Search

7. Concrete Applications of Optimization in Machine Learning

Optimization in ML extends beyond backpropagation training into three critical architectural phases:

CODE
+---------------------------------------------------------------------------------------+
|                    Key Optimization Applications in Machine Learning                  |
+---------------------------------------------------------------------------------------+
        |                                   |                                   |
        v                                   v                                   v
+-----------------------+       +-----------------------+       +-----------------------+
|   Feature Selection   |       | Hyperparameter Tuning |       | Neural Architecture   |
| (Combinatorial Space) |       | (Black-Box / Complex) |       | Search (NAS / AutoML) |
+-----------------------+       +-----------------------+       +-----------------------+
| - Filter, Wrapper,    |       | - Grid & Random Search|       | - Search Space Design |
|   Embedded Paradigms  |       | - Bayesian Opt (BO)   |       | - Evolutionary NAS    |
| - Binary GA / PSO     |       | - Hyperband / Successive|     | - Differentiable      |
|   Feature Subsets     |       |   Halving             |       |   DARTS               |
+-----------------------+       +-----------------------+       +-----------------------+

7.1 Feature Selection

Given DD candidate features, the goal is to select an optimal subset of d≪Dd \ll D features that maximizes predictive performance while minimizing model complexity.

  • Search Space Complexity: For DD features, there exist 2D−12^D - 1 possible non-empty candidate subsets. For D=100D = 100, 2^{100} pprox 1.26 imes 10^{30}, rendering exhaustive brute-force search mathematically impossible.
  • Formulation: Represented as a binary decision vector z∈{0,1}Dz \in \{0, 1\}^D, where zj=1z_j = 1 denotes inclusion of feature jj.
  • Fitness Function Formulation:

ight)$$
where M(z)M(z) is the model evaluated on subset zz, and lpha \in [0, 1] balances validation accuracy against sparsity. Binary Genetic Algorithms (BGA) and Binary Particle Swarm Optimization (BPSO) are the leading metaheuristic methods used for wrapper feature selection.

7.2 Hyperparameter Optimization (HPO)

Hyperparameters govern model capacity and optimization dynamics:

  1. Grid Search: Exhaustively evaluates every Cartesian product combination across pre-selected discrete parameter grids. Suffer from the curse of dimensionality (O(kp)O(k^p) evaluations for pp hyperparameters with kk values).
  2. Random Search (Bergstra & Bengio, 2012): Samples hyperparameters randomly from continuous probability distributions. Empirically superior to Grid Search because most ML models are sensitive to only a small subset of hyperparameters with low effective dimensionality.
  3. Bayesian Optimization: Constructs a probabilistic surrogate model (typically a Gaussian Process f(λ)∼GP(m(λ),k(λ,λ′))f(\lambda) \sim \mathcal{GP}(m(\lambda), k(\lambda, \lambda'))) of the expensive black-box validation loss, and utilizes an Acquisition Function (e.g., Expected Improvement extEI(λ) ext{EI}(\lambda), Upper Confidence Bound extUCB(λ) ext{UCB}(\lambda)) to select the most informative hyperparameter configuration to evaluate next.

7.3 Neural Architecture Search (NAS)

Automates the design of deep neural network architectures:

  • Search Space: Directed Acyclic Graphs (DAGs) representing layer connectivity, kernel sizes, activation functions, and channel widths.
  • Search Strategies:
    • Evolutionary NAS (AmoebaNet, Regularized Evolution): Populations of neural architectures undergo mutation (adding/removing skip connections, mutating kernel dimensions) and tournament selection.
    • Reinforcement Learning NAS (Zoph & Le): An RNN controller generates architecture specifications, receives validation accuracy as a reward signal, and updates via policy gradients.
    • Differentiable Architecture Search (DARTS - Liu et al., 2018): Continuous relaxation of the discrete architecture search space, allowing joint gradient-based optimization of both network weights ww and architectural parameters lpha via bi-level optimization.

8. Summary Checklist & Core Formulas

  1. Primal Optimization Form: min⁡hetaf0(heta)\min_{ heta} f_0( heta) s.t. gi(heta)≤0,  hj(heta)=0g_i( heta) \le 0, \; h_j( heta) = 0.
  2. Gradient Descent Update: hetat+1=hetat−ηablaJ(hetat) heta_{t+1} = heta_t - \eta abla J( heta_t).
  3. Newton-Raphson Update: hetat+1=hetat−H−1ablaJ(hetat) heta_{t+1} = heta_t - H^{-1} abla J( heta_t).
  4. Adam Updates: First and second moments with bias correction \hat{m}_t = rac{m_t}{1 - eta_1^t}, \; \hat{v}_t = rac{v_t}{1 - eta_2^t}.
  5. Convexity Condition: abla2f(heta)⪰0 abla^2 f( heta) \succeq 0 (Hessian is positive semi-definite; all eigenvalues non-negative).
  6. No Free Lunch Theorem: All optimization algorithms have identical performance when averaged over all possible objective functions.