IITP · Semester ISummaries · Quizzes · Assignments

Lecture summary

Advance Machine Learning

29 Sep 2026 · 18:301h 29m2 parts

Source: IITP-big-files\Sem-1\AML\Lectures\2026-09-29 1830 Advance Machine Learning\summary\notes.md

Overview

This class covered activation functions, focusing on ReLU and its variants, and introduced the core training processes of forward and back propagation in neural networks. It then delved into the historical perceptron model, detailing its algorithm, weight update rule, and geometric interpretation. The session connects foundational concepts of neuron activation to the iterative training mechanics that underpin modern deep learning, setting the stage for more advanced optimization techniques.

Learning outcomes

  • Explain the benefits and drawbacks of the ReLU activation function and its leaky variant.
  • Describe the forward propagation and back propagation processes in a neural network.
  • Apply the perceptron weight update rule given an input, target, and prediction.
  • Interpret weight updates geometrically using decision boundaries and vector angles.
  • Determine when architectural changes can be made to a neural network.

Core concepts

ReLU and Sparsity

The Rectified Linear Unit (ReLU) outputs the input directly if positive, else zero. This induces sparsity by deactivating neurons with negative inputs, which reduces computational load in large networks. It connects to efficiency in training deep models.

The Dying ReLU Problem

When neurons output zero for all inputs during training, they become permanently inactive, known as the "dying ReLU" problem. This matters because it can render parts of the network useless. Leaky ReLU is introduced as a solution.

Leaky ReLU

A variant of ReLU that allows a small, non-zero gradient for negative inputs (e.g., 0.01x). This prevents neurons from dying by ensuring weight updates can still occur. It connects as a direct fix to the dying ReLU problem.

Forward Propagation

The process where input data passes through the network layer-by-layer using current weights and activation functions to produce an output (ŷ). It matters because it is the first step in the iterative training cycle, generating predictions.

Back Propagation

The process following forward propagation where the prediction error is used to update the network's weights, moving backwards from the output layer. It is mandatory for learning, as it adjusts weights to minimize error.

Perceptron Weight Update

A rule from the perceptron algorithm where weights are adjusted proportionally to the error, learning rate, and input. It matters as a foundational, interpretable learning rule that illustrates how models correct mistakes.

Geometric Interpretation of Weight Update

Viewing the weight vector and input vector in space, updates change the angle between them to correct misclassifications relative to a decision boundary. This connects the algebraic update rule to an intuitive, visual understanding of learning.

Formulas and maths

  • ReLU:
    ( f(x) = \max(0, x) )
    Symbols: x is the net input to a neuron.
    Use: Applied as an activation function in hidden layers for its simplicity and sparsity.
  • Leaky ReLU:
    ( f(x) = \max(0.1x, x) ) [unclear]
    Symbols: x is the net input; a small slope (e.g., 0.1) is used for x < 0.
    Use: Mitigates the dying ReLU problem by allowing a small gradient for negative inputs.
  • Forward Propagation (General):
    ( h = g(W \cdot \text{input}) )
    Symbols: h is layer output, g is the activation function, W is the weight matrix.
    Use: Computes the output of any layer in a neural network.
  • Perceptron Weight Update:
    ( W_{\text{new}} = W_{\text{old}} + \alpha (t - o) x_i )
    Symbols: α is learning rate, t is target, o is predicted output, x_i is input.
    Use: Updates weights in the perceptron algorithm when a misclassification occurs.
  • Vector Dot Product (Geometric Interpretation):
    ( W \cdot X = |W||X| \cos \theta )
    Symbols: W is weight vector, X is input vector, θ is the angle between them.
    Use: Explains classification based on the angle between weight and input vectors.

Worked examples

  • Parameter Count Example: The ResNet model has approximately 11.7 million parameters.
  • Network Example: A simple 3-layer network:
    • Input layer: 3 neurons (A1⁰, A2⁰, A3⁰).
    • Hidden layer: 4 neurons (A1¹, A2¹, A3¹, A4¹).
    • Output layer: 1 neuron.
  • Weight Notation: W11 means weight from the first neuron of the input layer to the first neuron of the hidden layer.
  • Forward Propagation Steps:
    1. Initialize all weights and parameters randomly.
    2. For each neuron, calculate net input: (inputs * associated weights) + bias.
    3. Pass net input through the layer's activation function to get the neuron's output.
    4. Feed the outputs of one layer as inputs to the next layer.
  • Training Stop Condition: Training can stop when error becomes zero (rare) or when the error stops improving/reducing.
  • Perceptron Error Scenarios (Unit Step Activation):
    • Target=1, Predicted=1 → Error=0.
    • Target=1, Predicted=0 → Error=+1.
    • Target=0, Predicted=1 → Error=−1.
    • Target=0, Predicted=0 → Error=0.
  • Geometric Interpretation:
    • Data points above the decision boundary have an angle θ < 90° with weight vector W → W·x is positive.
    • Data points below the decision boundary have an angle θ > 90° with W → W·x is negative.
    • Case 1 (Positive class misclassified as negative): θ > 90°, weight update increases W to reduce θ.
    • Case 2 (Negative class misclassified as positive): weight update decreases W.

Questions asked in class

  • Q (Akash): Is activation a layer?
    A: No, activation is a function applied at every neuron, not a separate layer.
  • Q (Sachin): Can different layers have different activation functions?
    A: Yes, different layers can have different activation functions, but all neurons in a given layer use the same one.
  • Q (Saurabh Kumar Pandey): Is back propagation mandatory?
    A: Yes, for learning from data (model training), back propagation is mandatory. Without it, there is no weight update/learning.
  • Q (Saurabh): When do we stop training?
    A: When the error becomes zero (rare) or when the error stops reducing/improving.
  • Q (Lashmi): Is bias updated like other weights?
    A: Yes, bias is also a weight and gets updated during back propagation.
  • Q (Gyan Chand): Can we change the network architecture after training starts?
    A: No, once training starts, you cannot change the number of layers or neurons. You can only change it before starting or after stopping a training run.
  • Q (Sachin): Can we define our own activation function?
    A: Yes, you can define custom activation functions based on requirements.
  • General Q: How to choose an activation function?
    A: It often comes from experience and hit-and-trial. There is no hard and fast rule.

Key takeaways

  • ReLU outputs the input if positive, else zero, promoting sparse activation and computational efficiency.
  • The dying ReLU problem occurs when neurons output zero permanently; leaky ReLU mitigates this with a small slope for negative inputs.
  • Forward propagation computes the network's output using current weights and activation functions.
  • Back propagation is mandatory for learning, as it uses error to update weights in reverse order.
  • The number of layers and neurons is fixed once training begins; changes can only be made before or after a run.
  • All neurons in a layer share the same activation function, but different layers can use different functions.
  • The perceptron weight update rule is ( W_{\text{new}} = W_{\text{old}} + \alpha (t - o) x_i ).
  • In the perceptron with unit step activation, error (t - o) can only be +1, 0, or -1.
  • Weight updates can be interpreted geometrically: they adjust the angle between weight and input vectors to correct classification.
  • A positive class misclassification (target=1, predicted=0) requires adding the input vector to the weight vector.
  • Training stops when error is zero or no longer improves.
  • Bias is a parameter updated during back propagation, similar to other weights.

Exam-style questions

  1. Given a neuron using ReLU, calculate its output for net inputs of 2.5 and -1.3. Explain the result in the context of sparse activation.
    Outline: For 2.5: output = 2.5. For -1.3: output = 0. Explanation: ReLU deactivates neurons with negative input, outputting zero and contributing to network sparsity.

  2. A perceptron with unit step activation misclassifies a positive sample (target=1). The current weight vector is [0.5, -0.2], input is [1.0, 0.5], and learning rate α=0.1. Calculate the new weight vector.
    Outline: Error = target - predicted = 1 - 0 = 1. ΔW = α * error * input = 0.1 * 1 * [1.0, 0.5] = [0.1, 0.05]. New W = [0.5, -0.2] + [0.1, 0.05] = [0.6, -0.15].

  3. Describe the dying ReLU problem and how leaky ReLU attempts to solve it. Provide the formula for both.
    Outline: Dying ReLU: neurons output zero for all inputs, becoming inactive. Leaky ReLU allows a small gradient (e.g., 0.01x) for x<0. Formulas: ReLU: f(x)=max(0,x); Leaky ReLU: f(x)=max(0.1x, x) [unclear].

  4. Explain why the network architecture (layers, neurons) cannot be changed during training. What practical implication does this have?
    Outline: Weights and connections are initialized at start; changing architecture mid-training invalidates the existing weight matrices and optimization state. Implication: Architecture must be finalized before training begins.

  5. Using the vector dot product, explain why a data point with an angle >90° to the weight vector is classified as negative in a perceptron.
    Outline: W·X = |W||X|cosθ. If θ > 90°, cosθ is negative, making W·X negative. With sign/step activation, negative net input yields a negative class prediction.

Glossary

  • Activation Function - A function applied to a neuron's net input to produce its output.
  • ReLU (Rectified Linear Unit) - Activation function: f(x) = max(0, x).
  • Dying ReLU Problem - Phenomenon where ReLU neurons output zero permanently.
  • Leaky ReLU - ReLU variant allowing a small, non-zero output for negative inputs.
  • Forward Propagation - Process of passing input through a network to compute output.
  • Back Propagation - Process of using error to update network weights in reverse order.
  • Perceptron - A simple neural network model using forward/back propagation and weight updates.
  • Weight Update - Adjusting weights based on error, e.g., W_new = W_old + α(t - o)x.
  • Decision Boundary - A line or hyperplane that separates classes in a classification model.
  • Bias - An additive parameter in a neuron, updated like a weight during training.
  • Unit Step Activation - Outputs 1 if net input ≥ 0, else 0.
  • Sign Activation Function - Outputs +1 or -1 based on the sign of net input.

Follow-ups

  • Detailed discussion of gradient descent and learning rate.
  • Softmax activation function (to be covered during CNN discussion).
  • Perceptron model (further details).
  • Definitions of epoch, batch size, iteration.
  • McCulloch-Pitts (MCP) model and Hebb's rule/learning model (mentioned as historical context but not part of the course).
  • The role and detailed discussion of bias.
  • Detailed, low-level mechanics of back propagation and weight update rules.
  • Widrow-Hoff learning rule (next class).
  • Upcoming topics: NLP, CNN.

Exam verification — corrections & additions

  • Forward pass = compute the output from the current weights and biases (no learning).
  • Backward pass = update weights and biases from the prediction error.
  • Distance between the hyperplanes wᵀx + b = 1 and wᵀx + b = −1 is 2/‖w‖. Example: ‖w‖ = 2 → distance = 1.
  • Bias is an extra input with value 1 and its own weight; after training it can be positive, negative or zero.
  • Batch update: average the gradients over all samples in the batch, then apply one update. Example: (x=1, t=2), (x=2, t=3), w = b = 0, η = 0.1 → gradient w: −2, −6 (mean −4) → w = 0.4; gradient b: −2, −3 (mean −2.5) → b = 0.25.
  • Full 80-question answer key: C:\PORJECTX\aml-import\AML-FINAL-EXAM-ANSWER-KEY.md