Class XII Artificial Intelligence, Units 6 and 7

Neural Networks & Generative AI

How machines learn from examples, how to solve neural network numericals, and how AI creates new things.

Tap Next, swipe, or press the arrow keys. Every slide with buttons is meant to be tapped on the board.

A neural network learns the way your brain does

The first time you tasted Hyderabadi biryani, your brain noted the smell, spice and colour. Nobody gave you a rule book. A neural network learns the same way: from many examples.

In your brainIn an artificial neuron
Dendrites receive signalsInputs (x₁, x₂, x₃)
Some connections are strongerWeights (w): importance of each input
Cell body adds up the signalsWeighted sum + bias
Neuron fires only if strong enoughActivation function / threshold
Axon passes the signal onOutput to the next layer

★★ Board definition
A neural network is a machine learning model that makes decisions in a manner similar to the human brain, by using processes that mimic the way biological neurons work together to identify phenomena, weigh options and arrive at conclusions.

Main advantage: it extracts features from data automatically, without the programmer telling it what to look for.

Seen daily in: Gmail spam filter, suggested replies, photo tagging, shopping suggestions, Google Search.

Three layers: input, hidden, output

Think of a food delivery app. Tap each layer.

Tap a layer to explore it

Every neural network has an input layer, one or more hidden layers and an output layer. Each line is a connection with its own weight.

Seven components of a neural network

Choosing a college: placement record matters a lot, hostel food a little. Tap each card to reveal its meaning.

★★ Board Q: Explain the key components of a neural network. Write the meaning; the example helps you remember it.

Bias and threshold: two ways questions are asked

Read the question first. Is a bias given, a threshold, or both?

Style A: bias and threshold both given

z = w₁x₁ + w₂x₂ + w₃x₃ + b

Compare z with the threshold T.
z ≥ T → output 1 (fires)
z < T → output 0

Handbook Case I: bias 0.1, threshold 3.0.

Style B: threshold turned into bias

b = −T,  z = Σwx − T

Now compare z with 0.
z ≥ 0 → output 1 (fires)
z < 0 → output 0

Handbook surfing example: threshold 3 means bias −3.

The trap students fall into

Suppose Σwx = 5 and threshold T = 3. In Style B, z = 5 − 3 = 2.

Correct: 2 ≥ 0, so output = 1. (Same as checking 5 ≥ 3.)

Wrong: 2 < 3, so output = 0. This subtracts the threshold twice.

Rule: subtract the threshold once, or compare with it once. Never both. If z equals the threshold exactly, the neuron fires (≥).

Neuron lab: change a number, watch the neuron decide

Use + and − to change inputs, weights, bias and threshold. Load an example to start.

Solving a board numerical, one step at a time

Tap "Next step" and ask the class to say the answer before it appears.

    Your turn: practice numericals

    A new question every time. Work it out in your notebook, then check.

    1. Your value of z:

    round to 2 decimals

    2. Output of the neuron:

    How a network learns: predict, measure, correct

    Like throwing a paper ball into the dustbin: miss, adjust your aim, throw again. A caterer bills 4 plates at ₹1000. The network must learn the price per plate (the weight).

    Forward pass: predict ŷ = w × 4→Error = 1000 − ŷ→Backpropagation: adjust w↺

    Weight now: ₹100 per plate

    Prediction ŷ: ₹400

    Error: ₹600

    ★★ Backpropagation fine-tunes the weights using the error (loss) of the previous epoch. One epoch = one full pass through the training data.

    EpochWeight wPrediction ŷError

    Five types of neural networks

    Tap a type to see how it is built and where it is used.

    Which network would you use?

    Case-based questions ask exactly this. Pictures, sequences, tables or creating new data?

    Score 0 / 0

    Choose an answer.

    Generative AI creates; discriminative AI decides

    Both models were trained on thousands of cat and dog photos. Ask each one something.

    Tap a button above.

    BasisGenerativeDiscriminative
    PurposeCreates new content similar to training dataDecides which class something belongs to
    LearnsThe underlying data distributionThe boundary between classes
    ExamplesGAN, VAE, LLM, Naive BayesLogistic Regression, Decision Tree, SVM, Random Forest
    Daily lifeCaricature artist at ShilparamamMetro ticket checker: valid or not

    ★★ Board Q: Differentiate between generative and discriminative models.

    GAN: a forger and a checker improve together

    The generator forges a signature. The discriminator compares it with the real one. Every time the fake is caught, the generator gets better.

    Real signature (training data)

    Generator’s fake, round 1 of 6

    Discriminator says

    Chance it calls the fake “real”

    ★★ GAN = Generator (creates fake samples) + Discriminator (judges real vs fake), trained against each other. Used for image generation, style transfer and data augmentation.

    VAE: squeeze the data, then rebuild something new

    Like turning a long trip into a short voice note (encoder) that a friend can picture again (decoder). The short version is the latent space.

    Original image→Encoder→Latent space→Decoder→Output image

    Input

    Latent space: just 3 numbers

    size ?across ?down ?

    Encode first, then sample a new point to create an image the model never saw.

    Output

    ★ GANs are best for visually realistic outputs; VAEs suit structured data generation, anomaly detection and filling in missing data.

    LLM: predicting the next word, again and again

    Your phone keyboard guesses the next word. A Large Language Model does this after reading trillions of words. Tap a word to continue the sentence.

    ★★ A Large Language Model is a deep learning algorithm that performs NLP tasks such as generating and classifying text, answering questions conversationally and translating languages. It is “large” because it is trained on massive datasets of text and code.

    Limitations: needs huge computing power; can state wrong facts confidently; may memorise instead of generalise.

    Probabilities shown here are illustrative, for class discussion.

    What Generative AI makes, and what can go wrong

    Top row: applications. Bottom row: ethical issues. Tap each card.

    Exam corner: must-revise questions

    Ask the question aloud, let students answer, then tap to check.