Machine Learning: Foundations, Paradigms, Architectures, and Language Models
Foundations and Taxonomy of Artificial Intelligence
- Taxonomic Landscape of Artificial Intelligence:
- Artificial intelligence methodologies are structured across two principal orthogonal axes:
- Inference Strategy Axis: Spans from Top-Down approaches (deductive, symbolic, and knowledge-engineered systems) to Bottom-Up approaches (inductive, empirical, data-driven systems).
- Epistemic Model Axis: Spans from Deterministic models (exact, rule-based representations) to Probabilistic models (stochastic, uncertainty-tolerant representations).
- Taxonomic Quadrants:
- Top-Down Deterministic: Encompasses Logical Reasoning and Ontologies.
- Top-Down Probabilistic: Encompasses Planning and Bayesian Reasoning.
- Bottom-Up Deterministic: Encompasses Classical Search.
- Bottom-Up Probabilistic: The primary locus of modern Machine Learning, encompassing Reinforcement Learning, Supervised Learning, Unsupervised Learning, and Markov Models.

Foundational Probabilistic Concepts:
- Prior probability: , the unconditional or initial belief before evidence is observed.
- Posterior probability: , the conditional belief updated in light of evidence .
- Independence: Two events or variables and satisfy conditional or marginal factorization, where .
- Inference by Enumeration: Direct computation of conditional distributions by summing joint probabilities over hidden/unobserved variables.
- Bayes' Rule: The foundational law of Bayesian updating, defined as:
- Naïve Bayes Models: Probabilistic classifiers operating on the simplifying assumption that features are conditionally independent given the class label.
- Bayesian Networks: Directed acyclic graphs (DAGs) representing joint probability distributions through local conditional probability distributions.
- Variable Elimination: An exact dynamic-programming inference algorithm for graphical models that sums out intermediate variables sequentially.
Mathematical Basis of Machine Learning from Data:
- Consider an empirical dataset used to fit a parameterized model configured to predict a latent variable embedded within .
- Applying Bayes' Rule to the model and latent variable:
- Expanding the joint distribution over the latent state and data yields:
- Evaluating the likelihood term :
- Under an ideal or "correct" hypothesis, the model perfectly explains the data given the latent state: .
- A loss function quantifies the deviation from this ideal state, defined such that:
- Optimization Principle: Finding the optimal model equates to minimizing the empirical loss , which can be performed incrementally over successive data observations.
Case Study: Phase-Shift Keying (PSK) Digital Signal Decoder:
- Digital radio receivers receive symbols encoded using Phase-Shift Keying (PSK), where each distinct phase represents a unique transmission symbol.
- Channel noise perturbs the phase values, requiring statistical learning methods to infer the discrete symbol boundaries from noisy complex-plane coordinates.
- Features are captured as the real and imaginary components of the signal, plotted on a complex constellation diagram as and .

Feature Representations, Parameters, and Kernels
Feature Vector Taxonomy:
- Data instances are represented as feature vectors composed of individual features . Features are not necessarily uncorrelated or orthogonal.
- Continuous Features: Real-valued numbers, where .
- Discrete Features: Countable values, where with .
- Categorical Features: Qualitative variables taking symbolic labels from a predefined set, where .
- Text Features: Character strings, typically encoded using vector embeddings.
Parameters vs. Hyperparameters:
- Parameters (): Internal model factors that directly scale, transform, or weight features , expressed functionally as .
- Parameters adapt dynamically throughout learning via optimization.
- Example (Simple Linear Regressor): Here, the weights and bias/offset are the parameters.
- Hyperparameters: External tuning constants that control the structure of the model or the mechanics of learning.
- Hyperparameters remain constant or evolve on a slow schedule during model optimization.
- Cannot generally be determined analytically; chosen empirically through systematic experimentation, validation splits, or grid/random search.
Feature Preprocessing and Representations:
- All raw features must ultimately be converted into numeric representations.
- Categorical Encoding: Typically represented via one-hot encoding, producing a binary vector of length (where is the number of distinct categories) with exactly one active bit () and inactive bits ().
- Dynamic Range and Normalization:
- Substantial differences in feature ranges can distort optimization algorithms that rely on distance calculations or gradient updates.
- Features are typically scaled to a uniform range, most commonly .
- Features exhibiting wide dynamic ranges or power-law distributions are transformed logarithmically:
- Dimensionality Reduction: Applied to mitigate multicollinearity, eliminate redundant features, and reduce computational overhead.
Kernel Functions and the Kernel Trick:
- A kernel is a formal similarity measure comparing a prototype vector with an input feature vector :
Continuous Function Convolution: For continuous representations, the kernel similarity is formulated as a convolution applying a sliding filter:
The Kernel Trick: In any algorithm formulated using inner products of the form , the dot product can be replaced directly by a nonlinear kernel function , projecting data into a higher-dimensional implicit feature space without explicitly calculating coordinates in that space.
Serves as the operational basis for Support Vector Machines and Convolutional Neural Networks.
Learning Paradigms: Classification, Clustering, and Regression
Classification:
- Operational Objective: Assign each input vector a discrete class label chosen from a finite categorical set (e.g., ).
- Learning Type: Supervised learning.
- Data Requirements: Requires labeled ground-truth training pairs.
- Evaluation: Measured via objective accuracy, precision, recall, and computational throughput under latency constraints.
Clustering:
- Operational Objective: Partition unlabeled data points into discrete subsets or clusters (e.g., ).
- Learning Type: Unsupervised learning.
- Fundamental Challenge: Because ground-truth partitions are undefined, no single objective "best model" exists.
- Inevitable Hyperparameter: The total number of target clusters () must be specified a priori in most formulations.

Regression:
- Operational Objective: Estimate a functional mapping from continuous inputs to continuous target variables.
- Learning Type: Can be executed in both supervised and unsupervised regimes.
- Modeling Decisions: Requires selecting a family of functions (e.g., linear, polynomial, exponential).
- Objective Criterion: Evaluated based on predictive power and empirical residual minimization over unseen query inputs.
Decision Boundaries:
- Definition: The dividing hyperplane or manifold within feature space where the inferred class assignment shifts from one category to another.
- Complexity vs. Generalization Trade-off:
- Fewer, simpler decision boundaries produce faster, low-variance models that generalize robustly but risk underfitting (poor discrimination).
- Highly complex, non-linear boundaries yield high-precision models on the training distribution but risk severe overfitting (poor generalization).
Nonparametric and Maximum-Margin Algorithms
K-Nearest Neighbours (KNN):
- Nature: A non-parametric, lazy supervised classification algorithm.
- Operational Procedure:
- Establish a distance metric (e.g., Euclidean distance) across the feature space.
- Populate the feature space with labeled reference exemplars.
- Specify the integer hyperparameter denoting the neighborhood size.
- For an unobserved, unlabeled query instance, determine the nearest labeled exemplars.
- Compute the frequency of class labels within this set.
- Assign the query instance the majority label via the decision rule:
K-Means Clustering:
- Nature: An iterative, centroid-based unsupervised clustering algorithm.
- Algorithmic Procedure:
- Define a geometric distance metric between sample points and cluster centroids.
- Scatter initial cluster centroids randomly across the feature space.
- Iterative Assignment Step: Assign every unlabeled data point to its nearest centroid.
- Centroid Update Step: Recompute each centroid's coordinates as the arithmetic mean of all data points currently assigned to it.
- Convergence: Repeat the assignment and update steps until centroid positions stabilize and no assignments change.
Support Vector Machines (SVM):
- Algorithmic Formulation: A maximum-margin learning framework used for both classification and regression.
- Conceptual Approach: Identifies the optimal separating hyperplane that maximizes the margin separating distinct classes.
- Mathematical Specification:
- Establish a linear decision boundary function:
- Establish a target margin .
- The perpendicular geometric distance from an arbitrary data point to the decision boundary is given by:
- Define slack variables to quantify margin violations for support vectors where :
- Optimization Objective: Solve for parameter vector and boundary to minimize the loss formulation:
- The penalty hyperparameter establishes the trade-off between maximizing the geometric margin () and tolerating misclassified training instances ().
Neural Networks and Multilayer Perceptrons
Neuron Architecture and Processing:
- Artificial neural networks comprise layers of linear regressor units followed by nonlinear activation functions.
- Fundamental Unit Computation: The output of an individual unit receiving inputs over connection weights is: Where is a nonlinear threshold or activation function.
- Vectorized Layer Notation:
Network Topologies:
- Feedforward Networks: Information flows unidirectionally from input to output layers without cycles or feedback loops.
- Recurrent Networks: Units incorporate cyclical connections that feed outputs back into previous layers or self-loops, endowing the network with internal dynamic temporal memory.
Activation and Threshold Functions ():
- The activation function determines the output format and governs the non-linear expressive capacity of the node:
- Rectified Linear Unit (ReLU):
- Sigmoid (Logistic):
- Hyperbolic Tangent (Tanh):
- Softmax:
- Vanishing Gradient Pathology: Saturating functions (such as Sigmoid and Tanh) asymptotically approach upper and lower plateaus. At extreme values, their derivatives approach zero (), causing error gradients to vanish during backpropagation through deep architectures.
Multilayer Perceptrons (MLP):
- Structural Configuration: Consists of sequential layers: an Input Layer, one or more intermediate Hidden Layers, and a terminating Output Layer.
- Representational Capacity:
- A single-layer network can only solve linearly separable decision problems.
- Stacking two or more layers with nonlinear activations forms a universal function approximator, capable of learning arbitrary continuous functions.
- Algorithmic Execution: Evaluated as a chained sequence of matrix-vector multiply-accumulate operations interleaved with elementwise activation functions.

Backpropagation, Overfitting, and Regularization
- Backpropagation Algorithm:
- A supervised training algorithm using gradient descent to iteratively update weights by propagating the loss backwards via the chain rule.
- Output Layer Updates: For an output unit with activation , target value , net input , and learning rate :
- Loss Function Derivatives:
- Cross-Entropy Loss (classification):
- (Mean Squared) Loss (regression):
- Hidden Layer Updates: The weight update for connection entering hidden unit is calculated using downstream error gradients from subsequent layer units :
- Optimization Efficiency: Follows the path of steepest gradient descent to locate local loss minima.

Data Partitioning and Model Validation:
- To measure generalization to unobserved data, datasets are partitioned into:
- Training Set: Used directly by the learning algorithm to update model parameters.
- Validation Set: Used to evaluate performance across training epochs, guide hyperparameter tuning, and trigger early stopping.
- Test Set: Held out to evaluate the final model on unseen data.
- -Fold Cross-Validation: The complete dataset is split into equal partitions. The model undergoes training passes, each using a distinct partition for testing and the remaining partitions for training.
Overfitting:
- Occurs when a high-capacity model fits the idiosyncrasies and noise of the training data rather than the underlying data distribution.
- Diagnostic Profile: Training loss continues to decrease steadily, whereas validation/test loss plateaus, becomes noisy, or begins to diverge upward.

- Regularization Techniques:
- Used to constrain model capacity and mitigate overfitting by encouraging sparser parameter distributions:
- Regularization: Imposes a penalty proportional to the absolute values of the weights, equivalent to placing a Laplace prior over the parameters. Drives non-essential weights to exactly zero.
- Regularization: Imposes a penalty proportional to the squared magnitude of the weights, equivalent to placing a Gaussian prior with mean . Shrinks weights smoothly toward zero.
- Dropout: Randomly deactivates a stochastic subset of units and their associated weights during each forward/backward pass, preventing co-adaptation of features.

Advanced Architectures: CNNs, Natural Language, and Transformers
Convolutional Neural Networks (CNNs):
- Architecture: Employs the kernel trick by convolving localized sliding filters over multidimensional input arrays instead of learning dense, all-to-all connection matrices.
- Max-Pooling Layers: Interleaved with convolutional operations to downsample spatial representations by extracting the local maximum:
- Advantages over Multilayer Perceptrons: Massive parameter reduction, spatial translation invariance, accelerated training, and the option to use hardwired, fixed filter kernels.
- Modern Modular Tripartite Division:
- Backbone: Sequential stack of convolutional and pooling layers that extracts hierarchical spatial feature representations.
- Neck: Intermediate hidden dense layers that aggregate and cross-process extracted features.
- Head: Specialized output layers tasked with final classification, bounding box localization, or pixel-level segmentation.
Historical Evolution of Language and Communication Models:
- Classical View (pre-1953): Language conceived as formal logic consisting of truth-conditional propositions intended to express objective facts about the physical world.
- Modern View (1953–2000): Language understood as intentional action designed to alter the state and behavior of external agents:
- Ludwig Wittgenstein (1953), Philosophical Investigations.
- J. L. Austin (1962), How to Do Things with Words.
- John Searle (1969), Speech Acts.
- Postmodern View (post-2000): Language viewed as functional communication that enables receiving agents to infer the internal belief and intentional states of the speaker.
Text Vectorization and Embedding Techniques:
- Symbolic string representations cannot be directly processed by numerical machine learning algorithms.
- While hash tables provide general string indexing, they fail to model sequential dependencies or semantic proximity.
- Co-occurrence Matrix: Maps the distribution of words based on contextual proximity, following the linguistic principle that words with similar meanings appear in similar contexts (e.g., "Apple" and "Mango" occurring near "fruit").
- Context Window: Defined by a symmetric integer width. For instance, a window of size (around) selects the two preceding and two succeeding tokens: For the target word "outside", the context window consists of the tokens "go", "outside", "to", and "play".
- Term Frequency-Inverse Document Frequency (TF-IDF):
- Generates a term-document frequency matrix to represent documents within an algebraic vector space.
- Three-step pipeline: Tokenization, computation of TF-IDF scores, and assembly of the sparse document-frequency matrix.
- Mathematical formulation:
- Word2Vec (Skip-Gram Architecture):
- A two-layer neural embedding model that learns distributed vector representations of words by predicting surrounding context tokens from a center target token.
- Objective Optimization Formulation:
- Implementation Constraints: Computing the argmax objective across large vocabularies requires global dataset visibility, and preserving high-quality semantic fidelity requires large context windows .
Long Short-Term Memory (LSTM) Networks:
- A specialized recurrent neural network architecture designed to preserve state across extended sequences while avoiding vanishing gradients.
- Structural Unit Composition: Replaces basic neurons with an internal memory cell regulated by three gating interfaces:
- Signal Input: Ingests incoming temporal data.
- Input Gate (): Regulates the addition of new information to the cell memory.
- Output Gate (): Controls what portion of the internal memory is emitted to downstream computations.
- Bidirectional Processing: Units can process sequences both forward and backward in time, with final predictions reading out from all internal states.
- Training: Optimized via modified Backpropagation Through Time (BPTT), which unrolls recurrent connections into an equivalent feedforward cascade.
Transformer Architectures and Self-Attention:
- Replaces recurrent sequential processing with an attention mechanism that models word probabilities conditioned on full global context: .
- Triple Input Projections: Computes attention using queries (, target word), keys (, context tokens), and values (, context likelihoods):
- Scaling Parameter: The term scales the inner products to prevent numerical saturation in the softmax function, where denotes the representation dimensionality ( in the original Transformer architecture).
- Core Mechanics: Weights tokens dynamically based on contextual similarity, ensuring words that are more semantically relevant in context receive larger attention weights.
- Structural Pipeline: Built from stacked Multi-Head Attention blocks, Positional Encodings (which preserve token order without recurrence), Layer Normalization (Add & Norm), and Feed-Forward networks.