Feedforward Neural Networks

The Foundation of Deep Learning

Understanding the basic building blocks of artificial neural networks

Key Concept: Neural networks are computational models inspired by biological neural networks that can learn complex patterns from data through layers of interconnected nodes.
Notation Used Throughout:

Historical Context

From Perceptrons to Deep Networks

Key Insight: Neural networks experienced periods of decline ("AI winters") and resurgence, ultimately leading to today's deep learning revolution.

The Artificial Neuron

Basic Computational Unit

x₁
Σ
f(·)
ŷ
Mathematical Formula: $$\hat{y} = f\left(\sum_{i=1}^{n} w_i x_i + b\right)$$

Where $w_i$ are weights, $x_i$ are inputs, $b$ is bias, $f$ is the activation function, and $\hat{y}$ is the predicted output

Network Architecture

Layers and Connections

Layer Dimensions:

Activation Functions

Introducing Non-linearity

Common Activation Functions:

Purpose: Enable networks to learn non-linear patterns and relationships

Forward Propagation

Computing Network Output

Step-by-step Process:
  1. Initialize input values: $\mathbf{x} = [x_1, x_2, ..., x_n]$ (where $\mathbf{a}^{(0)} = \mathbf{x}$)
  2. For each layer $l$: $\mathbf{z}^{(l)} = \mathbf{W}^{(l)} \mathbf{a}^{(l-1)} + \mathbf{b}^{(l)}$
  3. Apply activation: $\mathbf{a}^{(l)} = f(\mathbf{z}^{(l)})$
  4. Repeat until output layer: $\hat{\mathbf{y}} = \mathbf{a}^{(L)}$ (final prediction)

Matrix Representation: Enables efficient computation using vectorized operations

Loss Functions

Measuring Network Performance

Common Loss Functions:

Where $y$ is the true target value and $\hat{y}$ is the predicted value

Purpose: Quantify the difference between predicted ($\hat{y}$) and actual outputs ($y$)

Goal: Minimize the loss function $\mathcal{L}$ to improve model predictions

Backpropagation Algorithm

Learning Through Gradient Descent

Key Steps:
  1. Forward pass: Compute predictions $\hat{y}$ and loss $\mathcal{L}(y, \hat{y})$
  2. Backward pass: Compute gradients $\frac{\partial \mathcal{L}}{\partial w}$ using chain rule
  3. Update weights: $w_{new} = w_{old} - \alpha \frac{\partial \mathcal{L}}{\partial w}$
  4. Repeat: Until convergence or stopping criteria
Chain Rule Application: $$\frac{\partial \mathcal{L}}{\partial w_{ij}^{(l)}} = \frac{\partial \mathcal{L}}{\partial a_j^{(l)}} \cdot \frac{\partial a_j^{(l)}}{\partial z_j^{(l)}} \cdot \frac{\partial z_j^{(l)}}{\partial w_{ij}^{(l)}}$$

Where $\mathcal{L}$ is the loss function we want to minimize

Training Process

Optimizing Network Parameters

Training Algorithm: for epoch in range(num_epochs):
    for batch in data_loader:
        # Forward pass: compute predictions
        y_hat = network(batch.inputs) # predicted values
        loss = loss_function(y_hat, batch.y) # minimize this
        # Backward pass: compute gradients
        gradients = compute_gradients(loss)
        # Update parameters to minimize loss
        optimizer.step(gradients)

Objective: Minimize loss $\mathcal{L}(y, \hat{y})$ by adjusting weights and biases

Key Hyperparameters: Learning rate, batch size, number of epochs

Training Challenges

Common Issues and Solutions

Regularization Techniques

Preventing Overfitting

Common Techniques:

We minimize the total loss $\mathcal{L}_{total}$ which includes penalty terms

Goal: Balance model complexity with generalization ability

Modern Optimization

Beyond Basic Gradient Descent

Advanced Optimizers:

All optimize by minimizing the loss function $\mathcal{L}$ more effectively than basic gradient descent

Benefits: Faster convergence, better handling of sparse gradients, adaptive learning rates

Key Takeaways

Feedforward Neural Networks

Next Steps: Explore specialized architectures for specific domains (computer vision, NLP, etc.)
Slide 1 of 13