Neural Network
A neural network is a parameterised mathematical function loosely inspired by the structure of biological brains, built from layers of interconnected nodes called neurons. Each neuron computes a weighted sum of its inputs, adds a scalar Bias term, and passes the result through a non-linear Activation Function. During training, the network's weights are iteratively updated via Gradient Descent so that a Loss Function measuring the gap between predictions and ground truth is minimised, allowing the network to learn statistical patterns in data.
Think of it like a system of adjustable valves and pipes: water (data) flows in, each valve amplifies or dampens the flow by a learnable amount, and the system is gradually re-tuned until the right amount of water exits at the right outlets.
A minimal neural network in PyTorch shows the core components:
import torch
import torch.nn as nn
class SimpleNet(nn.Module):
def __init__(self):
super().__init__()
self.layers = nn.Sequential(
nn.Linear(784, 256), # weights + bias
nn.ReLU(), # activation function
nn.Linear(256, 10) # output layer
)
def forward(self, x):
return self.layers(x)
Shallow networks with one hidden layer can approximate any continuous function in theory, but in practice deep stacking of layers - giving rise to "deep learning" - enables hierarchical feature extraction that powers modern vision, speech, and language systems. Related ideas include the Transformer (a specialised architecture using Self-Attention rather than dense layers), Convolutional Neural Networks (architectures with weight sharing suited to grid-structured data), Overfitting (a failure mode where the network memorises training data), and Embedding (learned vector representations produced by intermediate layers).
You encounter neural networks as the foundational computational unit in virtually every modern AI product, from recommendation engines to image classifiers to the LLMs that power conversational assistants.