The brain solves hard problems of perception with a huge number of simple cells working together. An artificial neural network copies this idea.

Biological Neurons

A neuron is a nerve cell. It has dendrites, which receive signals from other neurons, a cell body, or soma, which adds them up, an axon, which carries the output signal, and synapses, the junctions where the signal passes to the next neuron. The neuron fires when the total input is above a threshold. The brain has about 86 billion neurons, and they learn by changing the strengths of the synapses.

Artificial Neural Networks

An artificial neural network (ANN) is a model made of many simple connected units, called artificial neurons or nodes. Each neuron receives inputs x1, x2, …, each multiplied by a weight w, adds them with a bias b, and passes the sum through an activation function f. The output is y = f(w1x1 + w2x2 + … + b). The units are arranged in layers: an input layer, one or more hidden layers, and an output layer. Knowledge is stored in the weights.

Definition: Artificial neural network. A computing model made of many simple interconnected units, called neurons, which are arranged in layers and learn by adjusting the weights on their connections.

ANN versus Biological Neural Networks

The artificial neuron is a very simple copy of the biological one. The weights correspond to synapse strengths, the summation to the cell body, and the activation function to the firing threshold. The brain has billions of neurons, works in parallel, is slow in each cell but fast overall, is fault tolerant, and uses chemical signals. An ANN has far fewer neurons, normally runs on a digital computer, is fast in each unit, and uses numbers.

Activation Functions

The step function gives 1 if the input is above a threshold, otherwise 0. The sigmoid gives a smooth value between 0 and 1, 1 / (1 + e^-x). The tanh gives a value between -1 and 1. The ReLU gives max(0, x). Smooth functions are needed for training by gradient methods.

Learning in Neural Networks

Learning is the adjustment of the weights so that the output is correct. In supervised learning, the network is shown input and target pairs and the weights are changed to reduce the error. In unsupervised learning, the network finds groups in the inputs without targets. A network is trained over many passes through the data, each called an epoch. The learning rate controls the size of each change.

Table 4.2: Biological and artificial neurons

Feature Biological Artificial
Input Dendrites Input values
Processing Cell body Weighted sum and activation
Strength of link Synapse Weight
Output Axon Output value
Number of units Billions Tens to millions

Example 4.2: Output of one neuron

Problem: A neuron has inputs x1 = 1, x2 = 0, x3 = 1, weights 0.5, -0.4, 0.3 and bias -0.2, with a step activation at 0. Find its output.

Solution:

  1. Weighted sum = 1 × 0.5 + 0 × (-0.4) + 1 × 0.3 = 0.8.
  2. Add the bias: 0.8 - 0.2 = 0.6.
  3. The step function at 0 gives 1 for 0.6.

Result: The output is 1.

x = [1, 0, 1]
w = [0.5, -0.4, 0.3]
b = -0.2
s = sum(i * j for i, j in zip(x, w)) + b
print(round(s, 2), 1 if s > 0 else 0)

Output

0.6 1

Common mistakes

  • Forgetting the bias term.
  • Using the step function in a network that is trained by gradient methods.
  • Thinking that ANNs work exactly like the brain. They are simple models.

Key takeaways

  • A neuron computes y = f(sum of weights times inputs + bias).
  • Knowledge is stored in the weights.
  • A network has input, hidden and output layers.
  • Learning is the adjustment of weights to reduce error.

Practice questions

  1. What is an artificial neural network?
  2. Name the parts of a biological neuron.
  3. What is an activation function?

Answers to the practice questions

  1. A model of many simple connected neurons in layers that learns by adjusting weights.
  2. Dendrites, cell body, axon and synapses.
  3. A function applied to the weighted sum to produce the output of a neuron.

Sources

  • Official BCA syllabus Artificial Intelligence and Expert Systems, course code 25BCA405DS02, Unit IV