Deep Learning · MT2 · section

Before maths: what are we trying to learn?

Mathematics revision

Machine ko ek number do.

Imagine a tiny machine that estimates a bill. You tell it how many notebooks you bought. This information going INTO the machine is called the INPUT. Abhi bas naam samjho: input = andar diya hua number.

Start at the three notebooks on the left. Their count is the input; the machine turns that quantity into a bill estimate. Tap the diagram to enlarge.

Calculation: Input = 3 notebooks

Machine se ek answer niklega.

Suppose the machine says the bill is 30 rupees. This answer coming OUT is called the OUTPUT. Input aur output alag jobs hain: 3 was the quantity; 30 is the predicted bill.

Input and output name two different jobs: quantity enters and the estimated bill leaves. Tap the diagram to enlarge.

Calculation: Input: 3 notebooks → Output: 30 rupees

Multiply kyun karte hain?

If each notebook costs 10 rupees, three notebooks cost 10 + 10 + 10 = 30. Multiplication is just the shorter calculation: 3 × 10. In this simple model the multiplying number is called a WEIGHT.

Point to each Rs 10 notebook contribution, then add the three equal amounts. Tap the diagram to enlarge.

Calculation: 3 × 10 = 30

Weight badla, answer badla.

Keep the input 3. Change only the weight from 10 to 8. The output becomes 3 × 8 = 24. A weight controls how strongly an input affects the answer. Neural-network weights can also be negative or fractions.

Only the multiplier changes. Compare both outputs while keeping the three notebooks fixed. Tap the diagram to enlarge.

Calculation: Old: 3 × 10 = 30. New: 3 × 8 = 24.

Correct answer ko target kehte hain.

The real bill is 30, but the machine predicted 24. The correct answer supplied for a training example is its TARGET. Our prediction is 6 too small because 30 − 24 = 6.

The prediction is the machine’s result. The target is the real bill used to judge that result. Tap the diagram to enlarge.

Calculation: Target = 30. Prediction = 24. Difference = 6.

Learning ka matlab weight improve karna.

For this tiny example, changing the weight from 8 to 10 changes the prediction from 24 to the correct 30. Learning means using examples to adjust weights and reduce prediction error. Later, gradient descent will calculate HOW to adjust them.

The weight changes from 8 to 10. The same input now produces a prediction closer to the fixed target. Tap the diagram to enlarge.

Calculation: 3 × 8 = 24 → adjust weight → 3 × 10 = 30

Bias ek extra add hone wala number hai.

Now suppose there is a fixed packing fee of 2 rupees. First calculate the notebook cost: 3 × 10 = 30. Then add 2. That extra adjustable number is called a BIAS. In a neural network, it lets the result shift independently of the input.

The packing fee is added after the notebook cost. It is not multiplied by the notebook quantity. Tap the diagram to enlarge.

Calculation: 3 × 10 + 2 = 30 + 2 = 32

Letters numbers ke naam hain.

Instead of writing input, weight and bias every time, books use short names. x means input; w means weight; b means bias. So x × w + b says exactly the calculation you already did. A letter is a named box holding a number.

Read each letter as a named box holding a number, then follow the same arithmetic. Tap the diagram to enlarge.

Calculation: x = 3, w = 10, b = 2 → x × w + b = 32

Deep learning mein aage kya hoga?

A neural network connects many small calculating units called neurons. They multiply inputs by weights, add a bias and apply an activation rule. Several layers can learn more complex relationships. First we will learn the small calculation; phir layers jodenge.

Each circle is a small calculation. Outputs from one layer become the next layer’s inputs. Tap the diagram to enlarge.

Calculation: Input → calculations in layers → prediction

Question. A toy model has input 4, weight 5 and bias 2. Find its output using input × weight + bias.

Given

A toy model has input 4, weight 5 and bias 2.

To find

Find the preactivation and the requested neuron output.

Formula — which one and why

Weighted sum and activation. Each input is multiplied by its connection weight. Add these contributions, add the bias once, then apply the stated activation.

xᵢ = input i; wᵢ = its weight; b = bias; z = sum before activation; a = output after activation; f = the specified activation function.

z=\sum_iw_ix_i+bLaTeX: z=\sum_iw_ix_i+b
a=f(z)LaTeX: a=f(z)

Yaad rakhne ka cue: Input × weight, sabka sum, bias once, phir activation.

Solution — step by step

Step 1: multiply input by weight: 4 × 5 = 20.

Step 2: add the bias: 20 + 2 = 22. Final output = 22. The bias is added once, after multiplication.