Neural Network হলো এমন একটি Machine Learning model যা multiple layers of connected computational units ব্যবহার করে complex patterns learn করতে পারে।

এর basic building block হলো:

Neuron

একটি Neuron কী করে?

ধরুন input features:

x₁
x₂
x₃

প্রতিটি input-এর সাথে একটি weight থাকে:

w₁
w₂
w₃

Neuron প্রথমে weighted combination calculate করে:

$$z = w^{T}x + b$$

অর্থাৎ:

$$z = w_{1}x_{1} + w_{2}x_{2} + w_{3}x_{3} + b$$

তারপর একটি activation function apply করে:

$$a = f(z)$$

Weight-এর Intuition

Weight বলে দেয় কোন input prediction-এর জন্য কতটা influence করবে।

উদাহরণ:

Feature: Distance
Weight: +2.4

positive influence দিতে পারে।

অন্যদিকে:

Feature: Discount
Weight: -1.2

negative direction-এ influence করতে পারে।

Deep network-এ অবশ্য relationship অনেক বেশি complex।

Activation Function কেন দরকার?

যদি সব layer শুধু linear transformation করত, তাহলে অনেক layer stack করলেও overall model essentially linearই থাকত।

Activation function nonlinearity introduce করে।

এটাই neural network-কে complex nonlinear relationship learn করতে সাহায্য করে।

Layers

একটি simple neural network:

Input Layer
     ↓
Hidden Layer
     ↓
Output Layer

আর deep neural network:

Input
  ↓
Hidden Layer 1
  ↓
Hidden Layer 2
  ↓
Hidden Layer 3
  ↓
...
  ↓
Output

যখন multiple hidden layers থাকে, তখন model-কে সাধারণত Deep Neural Network বলা হয়।

Hidden Layers কী শেখে?

Deep learning-এর একটি important strength হলো representation learning।

উদাহরণস্বরূপ image model:

Early Layer
→ Edges

Middle Layer
→ Shapes / Textures

Later Layer
→ Object-level patterns

Text model-এ:

Words
→ Context
→ Semantic representation

এভাবে different layers different abstraction learn করতে পারে।

Neural Network Training

Training broadly কয়েকটি step-এ হয়।

1. Forward Pass

Input network-এর মধ্য দিয়ে যায়।

Model prediction তৈরি করে।

Input
↓
Layers
↓
Prediction

2. Loss Calculation

Prediction actual target থেকে কতটা ভুল সেটা loss function দিয়ে measure করা হয়।

Classification:

Cross-Entropy Loss

Regression:

MSE
MAE

ইত্যাদি ব্যবহার হতে পারে।

3. Backpropagation

Loss কমাতে কোন weight কোন direction-এ change করা উচিত সেটা gradients দিয়ে calculate করা হয়।

এই gradient calculation process-কে বলা হয়:

Backpropagation

4. Optimizer

Optimizer gradients ব্যবহার করে weights update করে।

Conceptually:

$$w_{\text{new}} = w_{\text{old}} - \eta\nabla L$$

যেখানে:

η
→ Learning Rate

Popular optimizers:

SGD
Adam
AdamW
RMSProp

Common Activation Functions

ReLU
Sigmoid
Tanh
Softmax

ReLU hidden layers-এ খুব common।

Sigmoid binary probability output-এ ব্যবহার হতে পারে।

Softmax multiclass output-এর class probability তৈরি করতে commonly ব্যবহার হয়।

Neural Networks কোথায় Strong?

বিশেষভাবে:

image text audio speech video large-scale representation learning complex nonlinear data multimodal problems

Tabular Data-তে সবসময় Best?

না।

Traditional structured tabular data-তে:

XGBoost
LightGBM
CatBoost

অনেক সময় neural network-এর সমান বা better performance দিতে পারে, বিশেষ করে dataset খুব বড় না হলে।

তাই:

Neural Network powerful মানেই সব problem-এ automatically best নয়।

Limitations

অনেক data প্রয়োজন হতে পারে training expensive hyperparameter tuning complex interpretability কম overfitting হতে পারে GPU/compute requirement বেশি হতে পারে

Interview-ready Explanation

A Neural Network is composed of layers of interconnected
neurons.

Each neuron computes a weighted sum of its inputs,
adds a bias, and applies an activation function.

During training, a forward pass generates predictions,
a loss function measures the error, backpropagation
computes gradients, and an optimizer updates the weights.

Activation functions introduce nonlinearity, allowing
neural networks to learn complex patterns.

They are especially powerful for image, text, audio,
speech, and large-scale representation learning.