# Faculty Assignment2 Q4 · Batch linear regression update

Subject: Deep Learning

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/#tee/read/22/tee-c22-s3

Canonical: https://deep-learning-study-room.vercel.app/read/dl/tee/section/tee-c22-s3/

## Question

**Question. x=[1,2],y=[3,5],w=b=0,η=0.1;J=(1/(2m))Σ(wxᵢ+b−yᵢ)²,m=2. Compute both gradients and update.** (Faculty assignment: no marks printed)

## Answer — step by step

### Given

Two examples, shared w,b, m=2.

### To find

One simultaneous batch update.

### Formula: which one and why



$$
\frac{\partial J}{\partial w}=\frac1m\sum_ie_ix_i,\quad\frac{\partial J}{\partial b}=\frac1m\sum_ie_i,\quad e_i=wx_i+b-y_i
$$



### Step 1. Predict and subtract targets

| x | y | wx+b | e | e×x |
| --- | --- | --- | --- | --- |
| 1 | 3 | 0 | -3 | -3 |
| 2 | 5 | 0 | -5 | -10 |

### Step 2. Average each gradient sum

dw=(−3−10)/2=−6.5;db=(−3−5)/2=−4.

### Step 3. Update both from old parameters

w′=0−0.1×(−6.5)=0.65;b′=0−0.1×(−4)=0.4.

### Final answer

**w′=0.65,b′=0.4.** New predictions1.05and1.7; do not updatew before computing theoldbgradient.
