# R25 Q4b · Bipolar AND perceptron

Subject: Deep Learning

Exam: TEE

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

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

## Question

**Question. Implement AND with bipolar inputs/targets and learning rate1.** (10 marks)

## Answer — step by step

### Given

Truth table: (−1,−1)→−1;(−1,+1)→−1;(+1,−1)→−1;(+1,+1)→+1. η=1.

### To find

A trained separating perceptron.

### Formula: which one and why

Initial weights/bias and zero-threshold tie rule are unspecified. Choose w=(0,0),b=0; output+1ifnet≥0,else−1. Use error update w←w+η(t−y)x,b←b+η(t−y). A sign-only misclassification update differs by a factor2 but can also learn the gate.



$$
z=w^Tx+b,\quad w\leftarrow w+(t-y)x,\quad b\leftarrow b+(t-y)
$$



### Step 1. Run all examples in the declared order

| Epoch | x | Target | Old parameters | Net | Output | t−y | New parameters |
| --- | --- | --- | --- | --- | --- | --- | --- |
| 1 | [-1, -1] | -1 | [0, 0]; b=0 | 0 | 1 | -2 | [2, 2]; b=-2 |
| 1 | [-1, 1] | -1 | [2, 2]; b=-2 | -2 | -1 | 0 | [2, 2]; b=-2 |
| 1 | [1, -1] | -1 | [2, 2]; b=-2 | -2 | -1 | 0 | [2, 2]; b=-2 |
| 1 | [1, 1] | 1 | [2, 2]; b=-2 | 2 | 1 | 0 | [2, 2]; b=-2 |
| 2 | [-1, -1] | -1 | [2, 2]; b=-2 | -6 | -1 | 0 | [2, 2]; b=-2 |
| 2 | [-1, 1] | -1 | [2, 2]; b=-2 | -2 | -1 | 0 | [2, 2]; b=-2 |
| 2 | [1, -1] | -1 | [2, 2]; b=-2 | -2 | -1 | 0 | [2, 2]; b=-2 |
| 2 | [1, 1] | 1 | [2, 2]; b=-2 | 2 | 1 | 0 | [2, 2]; b=-2 |

### Step 2. Verify every truth-table row with final parameters

| x | Net | Output | Target |
| --- | --- | --- | --- |
| [-1, -1] | -6 | -1 | -1 |
| [-1, 1] | -2 | -1 | -1 |
| [1, -1] | -2 | -1 | -1 |
| [1, 1] | 2 | 1 | 1 |

### Final answer

**One valid learned solution: w=[2, 2], b=-2.** Last full epoch makes no changes; all four rows are correct.

**Source / convention note.** Initialization, order and threshold convention explicitly supplied as assumptions; multiple equivalent separating weights exist.
