Friday , December 4 2026
Introduction to Artificial Neural Network (ANN)

Introduction to Artificial Neural Network (ANN)

Updated: 28 November 2026Level: BeginnerReading time: about 7 minutesConcepts · NumPy example

An Artificial Neural Network (ANN) is a computer system that learns in a way loosely inspired by the human brain. Like brain cells (neurons) that pass signals to each other, an ANN is built from small units that receive numbers, process them and pass them on.

What You Will Learn

  • What an artificial neuron is
  • How neurons are organised into layers
  • What weights are and how the network learns
  • How a single neuron calculates its output, in Python

Prerequisites

Introduction to Deep Learning and basic NumPy.

Key Parts of an ANN

Part What it does
Neuron (node) Receives inputs, combines them and produces one output
Layer A group of neurons. Input layer → hidden layers → output layer
Weight A number on each connection that says how important that input is
Bias An extra number added so the neuron can shift its output
Activation function Decides how strongly the neuron “fires” (for example ReLU or sigmoid)
Artificial neural network structure
Artificial neural network structure

A Simple Analogy

Imagine teaching a child to tell apples from bananas. You show many examples and say the names. Over time the child notices patterns such as shape and colour. An ANN does the same with numbers: it sees labelled examples, compares its guesses with the right answers, and slowly adjusts its weights to make fewer mistakes. This adjustment is called training.

The Biological Neuron

A real neuron has dendrites that receive signals, a cell body that processes them, and an axon that sends the signal to other neurons. The artificial neuron copies this idea: inputs play the role of dendrites and the output plays the role of the axon.

Biological neuron
Biological neuron
Neurons connected to each other
Neurons connected to each other

How It Works in Machine Learning

Each input value is multiplied by its weight, the results are added together with the bias, and the activation function turns that sum into the neuron’s output.

Artificial neuron receiving input signals
Artificial neuron receiving input signals

Example: One Neuron in Python

Example
import numpy as np

x = np.array([0.5, 0.8, 0.2])      # inputs
w = np.array([0.4, 0.3, 0.9])      # weights
b = 0.1                            # bias

z = np.dot(x, w) + b               # weighted sum
output = 1 / (1 + np.exp(-z))      # sigmoid activation

print("Weighted sum:", round(z, 3))
print("Output:", round(output, 3))

Explanation: np.dot(x, w) computes 0.5×0.4 + 0.8×0.3 + 0.2×0.9 = 0.62. Adding the bias gives 0.72. The sigmoid squashes this into the range 0–1, so the neuron outputs about 0.673. Training would change w and b to make such outputs match the correct answers.

Output
Weighted sum: 0.72
Output: 0.673

Activation Function

Without an activation function, a stack of layers would behave like one straight-line model. The activation adds non-linearity so the network can learn curves and complex patterns. The details are in the ANN – Plan of Attack tutorial.

Activation function in a neuron
Activation function in a neuron

Why ANNs Are Useful

  • They recognise patterns in images, speech and data.
  • They improve by learning from examples instead of being programmed for every case.
  • They can solve complex problems where simple rules fail.

Series

Deep Learning series: Introduction to Deep Learning · AI vs ML vs DL · Introduction to ANN · ANN – Plan of Attack · ANN Practical · Introduction to CNN · CNN Steps · CNN Practically · Introduction to RNN · RNN Steps · RNN Practically

Interview Questions

Q: What is the role of weights in an ANN?
Weights decide how much each input affects the neuron. Learning means finding good weight values.

Q: Why do we need a bias?
It lets the neuron shift its output up or down, so it can fit data that does not pass through the origin.

Q: What is a hidden layer?
Any layer between the input and output layers; it learns intermediate features.

Practice Exercises

  1. Change the weights in the example to [1, 1, 1] and predict the output before running it.
  2. Replace the sigmoid with ReLU: max(0, z). What changes?
  3. Draw a network with 4 inputs, 2 hidden layers of 3 neurons and 1 output, and count its connections.

Summary

An ANN is made of neurons arranged in layers. Each neuron computes a weighted sum of its inputs plus a bias and passes it through an activation function. Training adjusts the weights so predictions match the data.

Next: ANN – Plan of Attack · ANN Practical Example

About Machine Learning

Check Also

LSTM and GRU Explained (NumPy LSTM Cell + Keras Example)

LSTM and GRU explained: vanishing gradients, cell state and gates, an LSTM step in NumPy, GRU comparison, parameter counts and a Keras sentiment model.