📘 Day 2: Set Theory & Notation Refresher – The Language of Math in ML

🎯 Why This Topic Matters
Before we get into algorithms and models, it’s crucial to understand the basic notations used in machine learning papers, textbooks, and code. Most of these come from Set Theory — the foundation of data, probability, and logic in ML.
This post gives you a simple, intuitive refresher on the symbols and concepts you’ll encounter again and again.
📚 What is a Set?
A set is a well-defined collection of distinct objects.
Example:
Let X={1,2,3,4}
This is a set of numbers.
In ML:
The set of inputs (features) is often denoted by X
The set of labels or outputs is denoted by Y
✍️ Basic Notation You’ll See Often
Symbol | Meaning | Example |
∈ | "is an element of" | 2∈X |
∉ | "is not an element of" | 5∉X |
⊆ | Subset | A⊆B |
∪ | Union | A∪B |
∩ | Intersection | A∩B |
\ | Set difference | A\B |
∅ | Empty set | No elements |
🧠 Practical ML Contexts
1. Feature Space and Sample Space
Input features: X={x1,x2,…,xn}
Labels: Y={0,1}
A training dataset is just a set of pairs:
D={(xi,yi) ∣ i=1…n}
2. Probability Events
In probability, an event is a subset of all possible outcomes.
- A⊆Ω, where Ω is the sample space.
Example:
If Ω={Heads,Tails}, then
Event A={Heads}
P(A)=0.5
📏 Functions as Sets of Pairs
A function f: X→Y is a rule that maps each element in X to exactly one in Y.
In ML, models are just functions!
E.g., Linear regression: f(x)=wx+b
So understanding functions as mappings helps.
🧠 Pro Tip:
ML algorithms often operate on vectors or matrices of data, but at their core, these are just organized sets of elements.
✅ Key Takeaways
Set theory is the grammar of mathematical language.
It helps define data, probabilities, features, labels, and events.
ML models are mappings (functions) between sets.
Subscribe to my newsletter
Read articles from Om Koli directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Om Koli
Om Koli
Hello there! I'm a passionate tech enthusiast with a diverse range of interests, including quantum computing, web development, ReactJS, Python, data science, JS, and machine learning. As a seasoned writer and developer, I enjoy sharing my knowledge and experiences with others through engaging and informative articles. Whether you're looking to explore the cutting-edge world of quantum computing or want to learn how to build robust web applications using the latest technologies, I've got you covered. Join me on this exciting journey of discovery, and let's learn together!