# Before maths: what are we trying to learn?

Subject: Deep Learning

Exam: MT2

Reader: https://deep-learning-study-room.vercel.app/#mt2/read/2/mt2-c2-s0

Canonical: https://deep-learning-study-room.vercel.app/read/dl/mt2/section/mt2-c2-s0/

### 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.](https://deep-learning-study-room.vercel.app/assets/figures/notebooks_input.png)

### Visible text and connections in this diagram

INPUT

MODEL

OUTPUT

3 notebooks

Multiply by 10

Estimated bill

3 × 10

Total

Rs 30

3 notebooks × Rs 10 per notebook = Rs 30

Input = quantity. Weight = price per notebook. Output = estimated bill.

7

8

9

÷

4

5

6

×

1

2

3

−

0

.

=

+

Green arrow: three notebooks to calculator

Green arrow: calculator to receipt

Diagram: Start at the three notebooks on the left. Their count is the input; the machine turns that quantity into a bill estimate.

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.](https://deep-learning-study-room.vercel.app/assets/figures/v_output.svg)

Diagram: Input and output name two different jobs: quantity enters and the estimated bill leaves.. Labels: Follow the number through the machine | Follow the number through the machine | The units change: notebook quantity goes in; estimated rupees come out. | INPUT | 3 notebooks | MODEL | Multiply by 10 | OUTPUT | Rs 30 | 3 is the quantity. 30 is the bill prediction.

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.](https://deep-learning-study-room.vercel.app/assets/figures/v_multiply.svg)

Diagram: Point to each Rs 10 notebook contribution, then add the three equal amounts.. Labels: Multiplication collects equal groups | Multiplication collects equal groups | Three notebooks. Each contributes the same Rs 10. | Rs 10 | + | Rs 10 | + | Rs 10 | = Rs 30 | 10 + 10 + 10 = 30. The shorter way to write it is 3 × 10 = 30.

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.](https://deep-learning-study-room.vercel.app/assets/figures/v_weight.svg)

Diagram: Only the multiplier changes. Compare both outputs while keeping the three notebooks fixed.. Labels: Same input. Change only the weight. | Same input. Change only the weight. | The multiplier controls the prediction. | Weight = 10 | 3 notebooks × 10 | Prediction = Rs 30 | Weight = 8 | 3 notebooks × 8 | Prediction = Rs 24 | The quantity stays 3 in both calculations.

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.](https://deep-learning-study-room.vercel.app/assets/figures/v_target.svg)

Diagram: The prediction is the machine’s result. The target is the real bill used to judge that result.. Labels: Prediction and target have different jobs | Prediction and target have different jobs | The target is the known correct answer for this training example. | Prediction | Machine says Rs 24 | Target | Actual bill is Rs 30 | Compare | 30 − 24 = 6 rupees too low | Prediction may change during learning. The correct target stays 30.

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.](https://deep-learning-study-room.vercel.app/assets/figures/v_learning.svg)

Diagram: The weight changes from 8 to 10. The same input now produces a prediction closer to the fixed target.. Labels: Learning changes the adjustable number | Learning changes the adjustable number | Here we show a useful change; later, gradient descent calculates the | correction. | Before | 3 × 8 = 24 | Adjust weight | 8 becomes 10 | After | 3 × 10 = 30 | Input 3 and target 30 stay fixed. The weight is what changes.

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.](https://deep-learning-study-room.vercel.app/assets/figures/v_bias.svg)

Diagram: The packing fee is added after the notebook cost. It is not multiplied by the notebook quantity.. Labels: A bias adds a separate amount | A bias adds a separate amount | A fixed packing fee is a useful picture of an added offset. | Notebook cost | 3 × 10 = 30 | Add packing | 30 + 2 | New output | Rs 32 | Multiply first. Add the bias once. 3 × 10 + 2 = 32.

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.](https://deep-learning-study-room.vercel.app/assets/figures/v_symbols.svg)

Diagram: Read each letter as a named box holding a number, then follow the same arithmetic.. Labels: Letters are labels for numbers | Letters are labels for numbers | Read the meaning first, then put the number in its place. | x = input | x holds 3 | w = weight | w holds 10 | b = bias | b holds 2 | x × w + b = 3 × 10 + 2 = 32 | A letter does not add a new operation. It names a value.

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.](https://deep-learning-study-room.vercel.app/assets/figures/v_layers.svg)

Diagram: Each circle is a small calculation. Outputs from one layer become the next layer’s inputs.. Labels: A deep network connects several calculation stages | A deep network connects several calculation stages | Numbers from one layer become inputs to the next layer. | 1 | 2 | 1 | 2 | 3 | 1 | 2 | 1 | Inputs | Hidden layer 1 | Hidden layer 2 | Output | Predictions are calculated forward | Circle numbers identify neurons, not computed values. Each connection has a | weight; each receiving neuron has a bias.

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+b
$$





$$
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.
