2081 5

CSC266 · 2081 · 5 marks

What is reinforcement learning? Configure an ANN neuron to simulate OR gate.

What is reinforcement learning? Configure an ANN neuron to simulate OR gate. [5]

Artificial IntelligenceChapter 5: Machine LearningLearning with Neural NetworksNumerical: ANN neuron OR gate

Reinforcement Learning and ANN Neuron for OR Gate

Given

This is a conceptual + design question. The relevant "data" is:

  • Task 1: Define reinforcement learning.
  • Task 2: Configure a single ANN neuron (perceptron) to implement the OR logic function.
  • OR gate truth table (standard, not given but implied):
$x_1$$x_2$$y$
000
011
101
111

No numeric parameters are supplied; the weights, bias, and threshold must be chosen by design.


Solution

Part 1: Reinforcement Learning

Reinforcement Learning (RL) is a machine learning paradigm in which an agent learns to make decisions by interacting with an environment through trial and error. The agent performs actions, observes the resulting state, and receives a reward (positive) or penalty (negative) as feedback. Its goal is to learn a policy (a mapping from states to actions) that maximizes the cumulative reward over time.

Key elements:

ElementMeaning
AgentThe learner / decision maker
EnvironmentThe world the agent interacts with
StateCurrent situation of the agent
ActionChoice made by the agent
RewardFeedback signal (reinforcement)
PolicyStrategy for choosing actions

There is no labelled training data as in supervised learning; instead learning is guided by the reward signal.

Types:

  • Positive reinforcement - a favourable outcome strengthens and increases the frequency of a behaviour.
  • Negative reinforcement - removing an unfavourable condition strengthens a behaviour.

Examples: game-playing agents (chess, Go), robot navigation, recommendation systems.


Part 2: ANN Neuron (Perceptron) for OR Gate

A single neuron computes a weighted sum plus bias, then applies a step activation function:

$$ \text{Net} = w_1 x_1 + w_2 x_2 + b $$

$$ y = \begin{cases} 1 & \text{if } \text{Net} \ge 0 \ 0 & \text{if } \text{Net} < 0 \end{cases} $$

Chosen parameters:

$$ w_1 = 1,\qquad w_2 = 1,\qquad b = -0.5 $$

This is equivalent to using weights $w_1 = w_2 = 1$ with a threshold $\theta = 0.5$ (since $\text{Net} \ge 0 \Leftrightarrow w_1x_1 + w_2x_2 \ge 0.5$).

Verification:

$x_1$$x_2$$\text{Net}=x_1+x_2-0.5$$\text{Net}\ge 0$?Output $y$Required
00$-0.5$No00 ✓
01$0.5$Yes11 ✓
10$0.5$Yes11 ✓
11$1.5$Yes11 ✓

All four outputs match the OR truth table.

Neuron diagram:

        w1 = 1
x1 ────────────┐
               ├──►[ Σ + b ]──► Step ──► y
x2 ────────────┘   (b = -0.5)
        w2 = 1

Result: With $w_1 = w_2 = 1$ and bias $b = -0.5$ (threshold $\theta = 0.5$), a single perceptron correctly realizes the OR gate.


Common mistake: stating bias $b = 0$ together with threshold $\theta = 0.5$. These are inconsistent: $b = 0$ corresponds to $\theta = 0$, and the bias matching $\theta = 0.5$ is $b = -0.5$. Applying the $\theta = 0.5$ rule in the verification table still gives the correct logical behaviour and weights.

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.