2081 8

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 LearningSupervised, Unsupervised and Reinforcement LearningNumerical: ANN neuron OR gate

Reinforcement Learning and ANN Neuron for OR Gate

Given Data

  • Task 1: Define reinforcement learning (conceptual).
  • Task 2: Configure a single ANN neuron (perceptron) to simulate the OR gate.
  • OR gate truth table (standard, boolean logic):
$x_1$$x_2$$y = x_1 \lor x_2$
000
011
101
111

No numeric parameters are supplied, so weights, bias, and threshold are to be designed.


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. The agent performs actions, observes the resulting state, and receives feedback in the form of a reward (for good actions) or a penalty/punishment (for bad actions). The goal of the agent is to learn a policy (a mapping from states to actions) that maximizes the cumulative reward over time.

Unlike supervised learning, there is no labelled dataset; the agent learns purely by trial and error guided by reward signals.

Key elements:

ComponentMeaning
AgentThe learner / decision maker
EnvironmentThe system the agent interacts with
State ($s$)Current situation of the environment
Action ($a$)Choice made by the agent
Reward ($r$)Feedback signal (positive or negative)
Policy ($\pi$)Strategy mapping states to actions

Types of reinforcement:

  • Positive reinforcement: rewarding desirable behaviour so it occurs more often.
  • Negative reinforcement: removing an unpleasant condition to strengthen desirable behaviour.

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


Part 2: ANN Neuron (Perceptron) for OR Gate

A single neuron computes:

$$y = f!\left(\sum_i w_i x_i + b\right) = f(w_1 x_1 + w_2 x_2 + b)$$

Using a step activation function with threshold $\theta$:

$$f(net) = \begin{cases} 1 & \text{if } net \geq \theta \ 0 & \text{otherwise} \end{cases}$$

Chosen parameters

  • $w_1 = 1$
  • $w_2 = 1$
  • Threshold $\theta = 1$ (equivalently bias $b = -1$ with firing condition $net \geq 0$)

Verification against truth table

Case 1: $x_1=0,\ x_2=0$ $$net = (1)(0)+(1)(0) = 0 < 1 \Rightarrow y = 0\ \checkmark$$

Case 2: $x_1=0,\ x_2=1$ $$net = (1)(0)+(1)(1) = 1 \geq 1 \Rightarrow y = 1\ \checkmark$$

Case 3: $x_1=1,\ x_2=0$ $$net = (1)(1)+(1)(0) = 1 \geq 1 \Rightarrow y = 1\ \checkmark$$

Case 4: $x_1=1,\ x_2=1$ $$net = (1)(1)+(1)(1) = 2 \geq 1 \Rightarrow y = 1\ \checkmark$$

All four outputs match the OR gate truth table.

Neuron diagram

x1 ---(w1=1)---\
                (Σ) --> net --> [Step, θ=1] --> y
x2 ---(w2=1)---/

Conclusion

A single perceptron with $w_1 = 1$, $w_2 = 1$, and threshold $\theta = 1$ (bias $b = -1$) correctly simulates the OR gate.

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