Sitemap
Dewasheesh Rana

Dewasheesh Rana

Enterprise AI Architect | GenAI · Agentic AI · RAG · LLMOps · MLOps | Cloud-Native AI · Responsible AI | CKAD | BFSI & Payments | Portfolio: dewasheesh.is-a.dev

Normalization, Standardization, Regularization (L1/L2) & DropOut— The Most Easily Understandable Guide Ever (2025 Edition)

6 min readNov 15, 2025

--

A complete article with math, intuition, examples, Python code & lambda selection

Machine Learning beginners and even working professionals often get confused between Normalization, Standardization, and Regularization (L1/L2) and Drop Out.

Press enter or click to view image in full size

They look similar, sound similar, but solve completely different problems.

This article explains everything using:

  • Ultra-simple intuitive explanations
  • Minute mathematical steps
  • Fully worked examples
  • Extremely clear L1/L2 explanation with real logic
  • How L1 decides which weight to zero
  • Python examples
  • How to choose λ (lambda)
  • 2025 industry recommendations

By the end, you will master these concepts.

⭐ PART 1 — NORMALIZATION

📌 “Put all values on the same scale.”

Normalization transforms numbers into a fixed range — usually 0 to 1.

Why do this?

Because models treat large numbers as more important unless rescaled.

For example:
Age = 30, Salary = 80,000
Salary will dominate unless normalized.

Press enter or click to view image in full size

🐍 Python

from sklearn.preprocessing import MinMaxScaler
import numpy as np

X = np.array([[20], [40], [60]])
print(MinMaxScaler().fit_transform(X))

⭐ PART 2 — STANDARDIZATION

📌 “Make mean = 0 and variance = 1.”

Standardization stabilizes learning and is used in many algorithms.

Press enter or click to view image in full size

⭐ Why variance becomes 1?

Press enter or click to view image in full size

🐍 Python

from sklearn.preprocessing import StandardScaler
import numpy as np
X = np.array([[2], [4], [6]])
print(StandardScaler().fit_transform(X))

⭐ PART 3 — REGULARIZATION (L1, L2, Elastic Net)

📌 “Prevent models from memorizing by controlling weights.”

To understand regularization, you must first know:

🌟 What is a Weight? (Super simple)

A weight tells the model:

How important a feature is.

Examples:

  • Weight = 8 → strong influence
  • Weight = 0 → feature removed
  • Weight = -5 → negative influence

Regularization modifies weights so the model can’t memorize training data.

⭐ PART 3.1 — L2 Regularization (Ridge)

📌 “Shrink all weights smoothly.”

Adds penalty:

λw2

  • Large weights → penalized heavily
  • Small weights → lightly penalized
  • Weights become smaller but never zero

🔍 Mini math example

w = 4
λ = 0.5

Penalty:

0.5×42=80.5 × 4² = 80.5×42=8

Optimizer shrinks:

4 → 3 → 2 → 1.8 → …
But never 0.

⭐ PART 3.2 — L1 Regularization (Lasso)

📌 “Automatically remove useless features by forcing weights to zero.”

Adds penalty:

λ∣w∣

Because |w| has a sharp corner at 0, it pulls weights to EXACT 0.

🔍 The clearest example ever

(How L1 chooses which feature to remove)

Press enter or click to view image in full size

Assume model learns:

  • w1 = 100 (important)
  • w2 = 1 (weak)

Now L1 asks:

“If I delete this feature (weight=0), does prediction become bad?”

✔ Test removing w1

Predictions become:

10, 20 instead of 100, 200 → horrible

❌ Cannot remove w1.

✔ Test removing w2

Predictions become:

100, 200 → perfect

Removing F2 does NOT hurt prediction.

✔ So L1 removes w2 → sets it to 0.

⭐ Final L1 logic (Simple!)

  • If removing a weight hurts prediction → keep it
  • If removing it does NOT hurt prediction → kill it (make zero)

This is EXACTLY how L1 performs feature selection.

⭐ PART 4 — How to Choose λ (Lambda)

Lambda controls how strong the regularization is.

  • High λ → aggressive shrink/removal → risk underfitting
  • Low λ → weak effect → risk overfitting

You must choose λ carefully.

⭐ METHOD 1 — Cross-Validation (BEST)

Try many λ values (0.001, 0.01, 0.1, 1, 10…)

Pick λ with lowest validation loss.

Python:

from sklearn.model_selection import GridSearchCV
from sklearn.linear_model import Lasso
params = {'alpha': [0.001, 0.01, 0.1, 1, 10]}
model = GridSearchCV(Lasso(), params, cv=5)
model.fit(X, y)
print(model.best_params_)

⭐ METHOD 2 — Validation Curve (Visual)

Plot:

  • λ on x-axis
  • validation error on y-axis

Choose bottom of the “U-shape”.

⭐ METHOD 3 — Rule of Thumb (Quick)

  • Many features → higher λ
  • Small dataset → medium λ
  • Large dataset → small λ
  • For L1 → start at 0.1
  • For L2 → start at 1
  • Tune around these values

⭐ Example: Effect of λ in L1

Weights before L1:

Get Dewasheesh Rana’s stories in your inbox

Join Medium for free to get updates from this writer.

[10, 2, 0.2, 0.05, 0.01]

  • λ = 0.01 → almost no removal
  • λ = 0.1 → removes weights < 0.05
  • λ = 1 → removes weights < 0.2
  • λ = 10 → very aggressive

Lambda decides “how many” features L1 kills.

⭐ Summary Table (Memory Booster)

Press enter or click to view image in full size

⭐ 2025 Industry Best Practices

ML & Tabular:

  • Standardize inputs
  • Use ElasticNetCV or RidgeCV
  • Use early stopping

Deep Learning:

  • Standardize inputs
  • Use AdamW
  • Use dropout + weight decay

Transformers:

  • RMSNorm / LayerNorm
  • Attention dropout
  • DropPath
  • Weight decay

RAG / Vector Search:

  • Always L2-normalize embeddings
  • Standardize numeric metadata for hybrid search

⭐ Dropout — The Easiest Explanation Ever (Neural Network Regularization)

📌 “Randomly switch off neurons during training so the model cannot rely too heavily on any one path.”

Dropout is a regularization method used mainly in neural networks.

🌟 Why Do We Need Dropout?

Neural networks can memorize:

  • memorizing patterns
  • memorizing noise
  • memorizing outliers
  • memorizing training samples

This causes overfitting → poor performance on new/unseen data.

Dropout fixes this by making the network “forget on purpose” during training.

⭐ Think of Dropout Like Exam Preparation

A student learns with:

  • Book
  • Notes
  • Summary
  • Online videos

If the student relies ONLY on notes → they fail when notes are removed.

Dropout simulates this:

“Let’s remove notes randomly during practice so the student cannot depend on them, and learns the actual concepts.”

Same for neurons.

⭐ How Dropout Actually Works (VERY SIMPLE)

During training:

  • Each neuron is given a probability p to be dropped.
  • Typical p values: 0.2–0.5
  • Dropped neurons → set to zero temporarily
  • Remaining neurons must adjust and learn without them
  • This prevents the network from relying too heavily on any one neuron

During inference (prediction):

  • NOTHING is dropped
  • The model uses all neurons
  • Outputs are scaled properly

⭐ A VISUAL EXAMPLE (Super Clear)

Imagine this network:

Input → [A B C] → [D E F] → Output

Dropout = 0.4 → 40% chance of removal.

During ONE training step, network becomes:

Input → [A 0 C] → [D 0 F] → Output

Next step:

Input → [0 B 0] → [0 E F] → Output

Next step:

Input → [A B C] → [0 0 0] → Output

Over thousands of steps:

✔ Every neuron learns to work independently
✔ No neuron becomes “too important”
✔ Network becomes robust
✔ Overfitting reduces drastically

⭐ Minute Mathematical Intuition

Press enter or click to view image in full size

⭐ SUPER SIMPLE CODE EXAMPLE — Keras

from tensorflow.keras.layers import Dense, Dropout
model = Sequential([
Dense(128, activation='relu'),
Dropout(0.3), # 30% neurons removed randomly
Dense(64, activation='relu'),
Dropout(0.2),
Dense(1, activation='sigmoid')
])

✔ Dropout happens ONLY during training
✔ During prediction → dropout is OFF

⭐ When to Use Dropout

✔ Useful in:

  • Deep neural networks
  • CNNs
  • Early layers of MLPs
  • Preventing overfitting when dataset is small
  • When model has too many parameters

❌ NOT useful in:

  • Linear models
  • Tree models (RF, XGBoost)
  • BatchNorm-heavy architectures (BatchNorm already regularizes)

⭐ 2025 Best Practices for Dropout

For CNNs:

  • Use SpatialDropout for better effect
  • Use dropout only near fully connected layers

For Transformers:

  • Use Attention Dropout + DropPath
  • Low dropout works best (0.1–0.2)

For MLPs:

  • Use 0.2 to 0.5 dropout depending on dataset size

For Large Models:

  • Prefer Stochastic Depth (DropPath) over plain dropout

⭐ Why Dropout Helps (Final Clear Intuition)

Without dropout:
→ Neurons rely on each other
→ They form co-dependent patterns
→ Easy overfitting

With dropout:
→ Neurons must work independently
→ Each neuron learns useful, general features
→ Model becomes robust and generalized

Think:

Dropout forces the network to learn multiple paths instead of one shortcut.

⭐ One-Line Summary

Dropout randomly removes neurons during training so that the model cannot memorize patterns and must learn robust, generalizable representations.

⭐ Final Takeaway

  • Normalization removes scale differences
  • Standardization stabilizes distributions
  • L1/L2 regularization prevents memorization
  • L1 automatically removes useless features
  • Lambda controls the strength of regularization
  • Use cross-validation to pick lambda

Master these, and you master the foundations of modern machine learning.

--

--

Dewasheesh Rana
Dewasheesh Rana

Written by Dewasheesh Rana

Enterprise AI Architect | GenAI · Agentic AI · RAG · LLMOps · MLOps | Cloud-Native AI · Responsible AI | CKAD | BFSI & Payments | Portfolio: dewasheesh.is-a.dev