Interactive Decision Boundary Explorer
Watch in real-time as different ML models warp the decision space to separate classes through Gradient Descent. Experiment with Logistic Regression's linear constraints or a Neural Network's hyper-dimensional folding.
Click to add points, or generate a dataset
Data Setup
Model & Training
Decision Boundary - The Explanation
Math Explorer
Logistic Regression
Models the probability of a point belonging to class 1 using a linear combination of features passed through a Sigmoid activation function.
This algorithm mathematically can only draw a straight straight line through the 2D plane. It fails on non-linear datasets (like Moons or Circles).
1. Formal Definition
A decision boundary is a function (or set of points) that partitions the feature space into regions assigned to different classes.
Mathematically, for a classifier:
This defines the boundary. The classification follows:
- If → Class 1
- If → Class 2
2. Geometric Interpretation
Let's think geometrically. Depending on the dimensions of your input data:
- In 2D: The boundary is a line
- In 3D: The boundary is a plane
- In higher dimensions: The boundary is a hyperplane
For a linear classifier, this geometric separator is captured by the equation:
Where = weight vector (direction), = input features, and = bias (shift).
3. Visual Intuition (Critical)
Imagine plotting your data. Each point is a student: Red = Fail, and Blue = Pass.
The decision boundary is the theoretical line where the model is fundamentally uncertain.
4. Linear vs Non-Linear Boundaries
Linear Boundary
Assumes classes are separable by a perfectly straight feature line.
Common Models:
- Logistic Regression
- Linear SVM
- Perceptron
Non-Linear Boundary
Uses curved, flexible, and adaptive contours to separate data.
Common Models:
- Neural Networks
- Kernel SVM
- Decision Trees
5. Learning the Boundary (Optimization Perspective)
Now, this is where theory meets practice. A model does not "draw" a boundary directly. Instead, it:
- Defines an objective function
- Uses a loss function to measure the cost of misclassification
- Optimizes parameters iteratively
6. Margin — A Subtle but Powerful Idea
In Support Vector Machines, just having a boundary is not enough; we want to maximize the margin.
Why? Because a larger margin leads to drastically better generalization.
7. Overfitting vs Underfitting (Critical Insight)
Let me challenge you to think visually:
- A straight line might be too simple → Underfitting
- A highly wiggly curve wrapping every point → Overfitting
Fact: The goal is not perfect separation of training data.
Goal: The goal is pure generalization to unseen data.
8. Probabilistic Interpretation
Especially in architectures like Logistic Regression, the decision boundary is exactly where:
- Boundary = Maximum uncertanity space.
- Away from boundary = Higher confidence spaces.
9. High-Dimensional Reality
In real ML systems, you rarely work in 2D or 3D. You work in hundreds or thousands of dimensions. Yet the same core idea holds:
10. Final Conceptual Insight
"A machine learning model is nothing but a system that learns how to carve space into meaningful regions."
- Data lives in space.
- The model draws boundaries.
- Prediction = finding which region a point belongs to.
Summary (Professor's Closing Notes)
- * Decision boundary = separating surface in feature space.
- * Defined formally by .
- * Linear boundaries are simple and interpretable.
- * Non-linear boundaries are powerful and flexible.
- * Boundaries are learned via iterative optimization.
- * Margin strictly improves robustness.
- * Complexity must always be controlled.