# R25 Q6a · 3–2–1 forward pass and update w7,w8

Subject: Deep Learning

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/#tee/read/21/tee-c21-s12

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

## Question

**Question. For inputs[1,0,1], weights w1…w8=[0.2,−0.3,0.4,0.1,−0.5,0.2,−0.3,−0.2], biases[−0.4,0.2,0.1], target1 and sigmoid at all neurons: find prediction,error,and update w7,w8 with η=0.9.** (10 marks)

## Answer — step by step

### Given

Diagram edge mapping: x1→h1=w1,x1→h2=w2;x2→h1=w3,x2→h2=w4;x3→h1=w5,x3→h2=w6;h1→out=w7,h2→out=w8.



$$
\begin{bmatrix}0.2&0.4&-0.5\\-0.3&0.1&0.2\end{bmatrix}
$$



[1,0,1] → Two sigmoid hidden units → One sigmoid output → Target1

### To find

Prediction, explicit error convention, two simultaneous output-weight updates.

### Formula: which one and why



$$
E=\frac12(o-t)^2,\quad\delta_o=(o-t)o(1-o),\quad\frac{\partial E}{\partial w_k}=\delta_o h_j,\quad w_k^{new}=w_k-\eta\frac{\partial E}{\partial w_k}
$$



The paper says error without naming its scaling. Use half squared error and also report residual/SSE, so the gradient convention is clear.

### Step 1. Calculate each hidden weighted sum then sigmoid

| Unit | Products +bias | Net | Activation |
| --- | --- | --- | --- |
| 1 | 1×(0.2) + 0×(0.4) + 1×(-0.5) +(-0.4) | -0.7 | 0.331812227832 |
| 2 | 1×(-0.3) + 0×(0.1) + 1×(0.2) +(0.2) | 0.10000000000000003 | 0.524979187479 |

### Step 2. Output weighted sum and sigmoid

z=0.331812227832×(−0.3)+0.524979187479×(−0.2)+0.1=-0.104539505845; o=1/(1+e^(−z))=0.473888898824.

### Step 3. State error and loss

Residual o−t=-0.526111101176; SSE=0.276792890781; halfSSE=0.138396445390.

### Step 4. Multiply the output chain-rule factors

δ=(0.473888898824−1)×0.473888898824×(1−0.473888898824)=-0.131169078214.

### Step 5. Gradient for each edge

| Weight | δ × its source activation | Gradient |
| --- | --- | --- |
| w7 | -0.131169078214×0.331812227832 | -0.043523504065 |
| w8 | -0.131169078214×0.524979187479 | -0.068861036103 |

### Step 6. Update from the old weights

| Weight | Old − learning rate × gradient | New |
| --- | --- | --- |
| w7 | -0.3−0.9×(-0.043523504065) | -0.260828846342 |
| w8 | -0.2−0.9×(-0.068861036103) | -0.138025067507 |

### Final answer

**w7′=-0.260828846342; w8′=-0.138025067507.** Only the requested two weights are updated; use the same old forward pass for both gradients. With unhalved SSE the gradients double, so numerical updates would differ.

**Source / convention note.** Original does not specify loss scaling; half-SSE is declared and alternatives distinguished.
