📌 What is an ANN?
An Artificial Neural Network (ANN) is a computational model inspired by the way biological neurons in the human brain work.
It consists of layers of interconnected nodes (neurons) that process data, learn patterns, and make predictions.
📌 Structure of an ANN
- Input Layer
- Receives raw features (e.g., pixel values in an image, sensor readings, text embeddings).
- Each neuron represents one input feature.
- Hidden Layers
- Perform transformations on input data using weights, biases, and activation functions.
- Can be one (shallow ANN) or many (deep ANN).
- Output Layer
- Produces the final prediction.
- For classification → probabilities for each class.
- For regression → continuous value.
📌 How ANN Works (Step-by-Step)
- Weighted Sum
Each neuron calculates: z=∑(wi⋅xi)+bz = \sum (w_i \cdot x_i) + bz=∑(wi⋅xi)+b where www = weight, xxx = input, bbb = bias. - Activation Function
Applies a non-linear transformation (e.g., ReLU, Sigmoid, Tanh) so the network can model complex patterns. - Forward Propagation
Input flows layer by layer until an output is generated. - Loss Function
Measures how far predictions are from actual values (e.g., MSE, Cross-Entropy). - Backpropagation
Computes gradients of the loss w.r.t. weights and biases. - Weight Update
Uses Gradient Descent (or variants like Adam) to minimize loss.
📌 Types of Neural Networks
- Feedforward ANN (FNN): Simple one-directional flow (no loops).
- Convolutional Neural Network (CNN): Specialized for images & computer vision.
- Recurrent Neural Network (RNN): Good for sequential data (speech, text, time-series).
- Deep Neural Network (DNN): Many hidden layers (deep learning).
📌 Example: ANN for Spam Detection
- Input Layer: Email features (keywords, frequency, sender info).
- Hidden Layers: Extract relationships (e.g., “free money” + “click link”).
- Output Layer: 0 = Not Spam, 1 = Spam.
📊 ANN Architecture Diagram (Conceptual)
Input Layer → Hidden Layer(s) → Output Layer
x1 ──▶ ●───▶ ●
x2 ──▶ ●───▶ ●───▶ y (prediction)
x3 ──▶ ●───▶ ●
📌 Advantages of ANN
✅ Learns complex non-linear patterns
✅ Adaptable across domains (vision, NLP, speech, healthcare, finance)
✅ Improves with large datasets
📌 Challenges of ANN
❌ Requires lots of data and computation power
❌ Difficult to interpret (“black box”)
❌ Risk of overfitting if not regularized
📖 Analogy:
- ANN is like a brain-inspired calculator:
- Neurons (nodes) = tiny decision makers.
- Synapses (weights) = connection strengths.
- Learning = adjusting connections until predictions are accurate.
