Skip to content
C

Neural Networks

Complete learning notes


1. Introduction

Topic 1 gave you the big-picture intuition for Deep Learning. Now let's open the hood and look at the actual building block that makes it all work: the artificial neural network. Don't worry — we'll build this up piece by piece, with simple intuition before any technical detail, and no heavy calculus required.


2. What is a Neural Network?

Term: Neural Network

Simple definition: A neural network is a system of connected "nodes" (loosely inspired by neurons in a brain) organized in layers, where each connection has a "weight" that the network adjusts during training to make better predictions.

In simple words: Imagine a voting committee with several rounds. Each person in the first round looks at small pieces of evidence and casts a weighted opinion. The next round combines those opinions into new, more informed opinions. This keeps going until the final round produces one confident overall answer.

Technical explanation: A neural network consists of layers of interconnected nodes ("neurons"), where each connection carries a numeric weight; each neuron computes a weighted sum of its inputs, passes it through an activation function (introducing non-linearity), and forwards the result to the next layer, with the network's weights adjusted during training (via backpropagation) to minimize prediction error.


3. Why is it Important?

  • Neural networks are the fundamental architecture underlying ALL of Deep Learning — Computer Vision, NLP, Generative AI, and LLMs (Topics 5-8) are all built from variations of this same basic idea.
  • Understanding neurons, layers, weights, and activation functions gives you the vocabulary needed to read about or work with any Deep Learning framework (Topics 3-4).

4. Prerequisites

Comfort with Deep Learning Basics (Topic 1) and Linear Algebra Basics (Module 1, Topic 10, since a neuron's weighted sum is essentially a dot product).


5. Core Concepts

  1. Neurons, weights, and bias
  2. Layers: input, hidden, output
  3. Activation functions
  4. Forward propagation
  5. Loss function and backpropagation (intuition only)

6. Detailed Explanation

a) Neurons, Weights, and Bias

Term: Neuron (or "node")

Simple definition: A single computational unit that takes several numeric inputs, multiplies each by a "weight" (reflecting how important that input is), sums them up, adds a "bias" (an adjustable offset), and produces one output number.

In simple words: Think of a neuron like a mini decision-maker: "I'll weigh this piece of evidence more heavily than that one, add my own personal bias, and give you my verdict."

b) Layers

  • Input layer: Receives the raw data (e.g., pixel values, or numeric features).
  • Hidden layer(s): One or more layers between input and output, where the actual "hierarchical feature learning" from Topic 1 happens. "Deep" Learning simply means having MANY hidden layers.
  • Output layer: Produces the final prediction (e.g., a class probability, or a numeric value).

c) Activation Functions

Term: Activation Function

Simple definition: A mathematical function applied to a neuron's weighted sum, which introduces "non-linearity" — without this, a neural network (no matter how many layers) would behave just like a single Linear Regression, unable to capture complex, curved patterns.

In simple words: It's like a filter that decides how strongly a neuron should "fire" based on its input, rather than just passing the raw number through unchanged. Common choices include ReLU (which simply outputs 0 for negative inputs, and passes positive inputs through unchanged) and Sigmoid (which squashes values between 0 and 1, the same function from Logistic Regression, Module 4, Topic 3).

d) Forward Propagation

Term: Forward Propagation

Simple definition: The process of passing input data through the network, layer by layer, to produce a final output/prediction.

In simple words: Data flows "forward" — from input, through each hidden layer's calculations, to the final output — the same direction water flows downhill.

e) Loss Function and Backpropagation (Intuition Only)

Term: Backpropagation

Simple definition: The process of comparing the network's output to the correct answer (using a "loss function" to measure how wrong it was), then working BACKWARD through the network to adjust each weight slightly, so the next prediction is a little better.

In simple words: Imagine getting your exam graded, then going back through EACH question to understand exactly which specific mistakes contributed most to your wrong final grade, and adjusting your understanding of just those specific concepts — repeated over and over across many practice exams (training examples), until your overall performance improves.


7. How It Works

  1. Input data enters the input layer.
  2. Data flows forward through each hidden layer: each neuron computes a weighted sum + bias, then applies an activation function.
  3. The output layer produces a final prediction.
  4. A loss function compares this prediction to the actual correct answer.
  5. Backpropagation calculates how much each weight in the network contributed to the error, and adjusts every weight slightly to reduce it.
  6. This process (forward propagation → loss calculation → backpropagation) repeats across many training examples and many rounds ("epochs"), gradually improving the network's predictions.

8. Real-World Example

Think of training a neural network to recognize handwritten digits (0-9). Initially, with random weights, it might guess "7" when shown a "3" — clearly wrong. Backpropagation looks at exactly how wrong this guess was, and nudges the weights throughout the network slightly so that, next time it sees a similar-looking "3," it's a bit more likely to guess correctly. Repeated across thousands of example digits, the network gradually gets very good at this task — without anyone ever manually telling it what makes a "3" look different from a "7."


9. Mathematical Explanation

A Single Neuron's Computation:

output = activation_function(Σ(wᵢ × xᵢ) + bias)

Where:

  • xᵢ = each input value
  • wᵢ = the weight for that input
  • bias = an adjustable offset value
  • activation_function = a non-linear function (e.g., ReLU, Sigmoid)

Numerical Example:

Suppose a neuron has 2 inputs: x₁=0.5, x₂=0.8, with weights w₁=2, w₂=-1, and bias=0.1.

Weighted sum = (2 × 0.5) + (-1 × 0.8) + 0.1 = 1.0 − 0.8 + 0.1 = 0.3

Applying a ReLU activation function (which outputs the input directly if positive, or 0 if negative): ReLU(0.3) = 0.3

Interpreting the Result: This single neuron passes 0.3 forward to the next layer. If the weighted sum had instead been negative (e.g., -0.5), ReLU would output exactly 0, meaning this neuron simply doesn't "fire" for that particular input — this is the non-linearity that lets networks learn far more complex patterns than a single straight-line equation could.


10. Advantages

  • Extremely flexible architecture — can be adapted (with variations, Topics 5-8) to images, text, audio, and more.
  • Capable of learning highly complex, non-linear patterns given enough data, layers, and training time.
  • The same fundamental building blocks (neurons, weights, activation functions) underlie all modern Deep Learning breakthroughs.

11. Limitations

  • Requires substantial data and computation to train effectively.
  • Many hyperparameters to configure (number of layers, neurons per layer, choice of activation function, learning rate) — tuning is often more art than science.
  • The "black box" interpretability challenge from Topic 1 applies directly here — it's hard to explain exactly WHY a network made a specific prediction.

12. Common Mistakes

  • Forgetting that WITHOUT an activation function, stacking many layers together mathematically collapses into something equivalent to a single linear model — the non-linearity is essential.
  • Assuming more hidden layers always means a better model — very deep networks can be harder to train and more prone to overfitting without careful technique.
  • Confusing "epoch" (one full pass through the entire training dataset) with a single training example.

13. Best Practices

  • Start with a relatively simple network architecture (few layers) before scaling up complexity.
  • Use well-established activation functions (like ReLU for hidden layers, Sigmoid/Softmax for output layers in classification) as sensible defaults.
  • Monitor training vs validation performance closely (recall Module 7's Overfitting/Underfitting) since Deep Learning models can overfit just like any other model.

14. Real-World Applications

  • Image recognition systems (Topic 5, Computer Vision) use specialized neural network architectures (Convolutional Neural Networks).
  • Language models (Topics 6, 8) use specialized architectures (Transformers) built from these same fundamental neuron/layer concepts.
  • Any application requiring learning complex patterns from large amounts of raw data.

15. Interview-Oriented Points

  • Be ready to explain what a neuron computes (weighted sum + bias, then activation function).
  • Understand why activation functions are essential for learning non-linear patterns.
  • Be able to explain backpropagation's core intuition: measuring error, then adjusting weights backward through the network to reduce it.

16. Exam-Oriented Points

  • A neuron computes: activation_function(Σ(weight × input) + bias).
  • Networks consist of an input layer, one or more hidden layers, and an output layer.
  • Activation functions introduce non-linearity, essential for learning complex patterns.
  • Backpropagation adjusts weights backward through the network based on the calculated error (loss).

17. Comparison Table — Common Activation Functions

Activation FunctionBehaviorCommon Use
ReLUOutputs input directly if positive, 0 otherwiseMost common choice for hidden layers
SigmoidSquashes output between 0 and 1Output layer for binary classification (same as Logistic Regression, Module 4)
SoftmaxConverts outputs into a probability distribution across multiple classesOutput layer for multi-class classification

18. Quick Revision

  • A neuron computes a weighted sum of inputs plus a bias, then applies a non-linear activation function.
  • Networks consist of input, hidden, and output layers; "deep" means many hidden layers.
  • Forward propagation passes data through the network to produce a prediction; backpropagation adjusts weights backward based on the resulting error.
  • Common activation functions: ReLU (hidden layers), Sigmoid/Softmax (output layers for classification).

Mock Test

  • Neural Networks — Quick Test

    A 10-question multiple-choice check on Neural Networks.

    10 questions · 10 min · Easy
    Start Mock Test