Hands on AI I
Module 1: Data Foundations and Processing
1.1 Tabular Data and Dimensionality Reduction
Data is often structured in a tabular form, where elements are arranged in vertical columns (features) and horizontal rows (samples). For instance, a dataset containing samples and features can be modelled as a matrix , where individual sample vectors are defined as and their corresponding labels as . Due to the high dimensionality of features (e.g., in the Wine dataset), visualizing raw tabular data is often infeasible. Dimensionality reduction techniques like Principal Component Analysis (PCA) and t-Distributed Stochastic Neighbour Embedding (t-SNE) are applied to compress -dimensional data into lower-dimensional spaces (e.g., -dimensional) to preserve and visualize clustered variance.
1.2 Image, Sequential, and Categorical Data Representation
Images are multidimensional structures containing height, length (or width), and channels. The RGB model utilizes three colour channels (Red, Green, Blue), whereas the RGBA model includes an alpha ( ) channel representing transparency. Image data can be processed through augmentation techniques such as rotation, flipping, noise injection, and input dropout to reduce overfitting and increase model robustness.
Sequential data forms like sound waves rely on continuous signals measured in Hertz (Hz). To accurately reconstruct a sound signal computationally, the Nyquist-Shannon theorem must be satisfied, which dictates that the sampling rate must exceed twice the highest signal frequency:
Alternatively, sampling points must be separated by seconds. Furthermore, Fourier transformations decompose signals from the time domain into the frequency domain, visualized via spectrograms representing energy over time.
Categorical textual data must map distinct words into mathematical vectors. Simple mapping relies on one-hot encoding, producing a binary vector where if category is true, and otherwise. To handle vast vocabularies, Word Embeddings represent words in smaller, continuous vector spaces containing semantic similarities.
Module 2: Unsupervised Learning
Unsupervised learning segments unlabelled datasets ( ) into structural partitions relying solely on input features.
2.1 Similarity Metrics
Similarity is computed via distance measures. The dissimilarity between two data points and across features is formally defined as:
For standard metric spaces, the squared Euclidean distance is utilized:
2.2 Clustering Algorithms
K-means Clustering: Segments data into clusters by minimizing the compactness, defined as the Within-Cluster Sum of Squares (WCSS):
where is the th data point in cluster and is the center of the th cluster.
DBSCAN: Density-based clustering groups core, border, and noise points defined by a proximity radius and a threshold of minimum connecting points (minPts).
Gaussian Mixture Models (GMM): Assumes data stems from a mixture of distributions. It employs soft clustering by maximizing posterior probabilities using the Expectation-Maximization (EM) algorithm to estimate weights , means , and covariance matrices :
2.3 Cluster Validation
To prevent algorithms from imposing structure on random noise, internal validation techniques are necessary. The Silhouette Score computes the ratio of intra-cluster similarity ( ) against inter-cluster similarity ( ):
The overall Silhouette Coefficient for a clustering partition containing samples averages the distinct scores ranging from to :
Module 3: Supervised Learning & Optimization
Supervised learning models formulate mappings from input to true target labels . Models parameterize mapping functions to output predictions .
3.1 Loss Functions and Generalization Error
Loss functions measure prediction inaccuracies. The expected generalization risk over the true, unknown joint probability distribution is:
Since is unknowable, empirical risk minimization (ERM) approximations compute the loss against available data points :
Zero-one loss: Used for exact match classification.
Mean-Squared Error (MSE) / Quadratic Loss: Minimized iteratively or directly closed-form (in linear models) for regression tasks.
3.2 Logistic Regression and Gradient Descent
Logistic classification applies a non-linear sigmoid activation function to map linear raw outputs into probabilities constrained to $$:
Because the formulation has no closed-form analytical minimum, parameters are iteratively updated using Gradient Descent with a selected learning rate :
Module 4: Deep Learning & Convolutional Networks
4.1 Multi-class Softmax and Cross-Entropy
For class architectures, the sigmoid function generalizes into the softmax equation to construct output probabilities:
Neural networks evaluate these probability distributions utilizing the Binary Cross Entropy (BCE) loss framework:
4.2 Network Topologies
A fully connected linear layer containing weights and bias computes its outputs as:
Stacking multiple hidden layers successively collapses logically into a single affine transformation , proving the necessity of inter-layer non-linear activation functions (e.g., ReLU, Tanh) to scale deep architectures.
4.3 Convolutional Neural Networks (CNNs)
CNNs capture local spatial structures avoiding feed-forward parameter explosion by sharing kernel weights across a receptive field. Formally, the 2D mathematical convolution operation between matrix functions and slides the kernel across the input matrix:
Sub-operations in a CNN hierarchy include padding strategies to manipulate border overlaps and pooling topologies (Max or Average) to drastically down-sample activation maps prior to final flat-vector dense classifications.