Regression
Linear Regression
See how slope and intercept define a line, and how residuals contribute to mean squared error.
Fit the line
Adjust m and b, then find the least-squares fit.Model and residuals
Vertical segments show each observation's error.Current model metrics
What's Happening?
Adjust the slope or intercept. The residuals and MSE will update immediately.
Formula
The line predicts a value for each X, then averages the squared vertical errors.
ŷ = 0.50x + 2.00rᵢ = yᵢ − ŷᵢMSE = (1 / n) Σ (yᵢ − ŷᵢ)²Inference
After fitting, select a new X value to project it onto the current line.
Fit the model first to enable inference.
Classification
Logistic Regression
Turn a weighted score into probability, then see how a threshold creates a linear decision boundary.
Adjust the boundary
Change the weights and threshold, then fit the classifier.Decision boundary
The boundary is where predicted probability meets the threshold.Current classifier metrics
What's Happening?
Adjust the weights, bias, or threshold to move the boundary. Fit the classifier to learn parameters from the teaching observations.
Formula
A linear score is passed through the sigmoid function to produce a probability.
z = w₁x₁ + w₂x₂ + bp = σ(z) = 1 / (1 + e⁻ᶻ)Class B if p ≥ thresholdInference
After fitting, select a new point to classify with the current boundary.
Fit the model first to enable inference.
Classification
K-Nearest Neighbors
Classify a new point by looking at the labels of the closest training observations.
Choose the neighborhood
Move the query point or change K to see the vote update.Nearest neighbors
Lines connect the query to its K closest observations.K-nearest neighbors metrics
What's Happening?
The nearest observations vote on the query point's class. Adjust K to change how local or broad that vote becomes.
Formula
Distance determines which observations participate in the majority vote.
d = √((x₁ − q₁)² + (x₂ − q₂)²)ŷ = mode(labels of K nearest points)Inference
Move the query point to ask the fitted neighborhood a new question.
Query ready.
Classification
Linear SVM
Find a separating line with the widest useful margin between two classes.
Tune the margin
Change C to balance a wide margin against classification errors.Margin and support vectors
Support vectors anchor the boundary and its two unit-margin guides.Support vector machine metrics
What's Happening?
The solid line separates the classes. Dashed lines show the unit-margin boundaries, while support vectors sit closest to the margin.
Formula
The model penalizes points inside the margin using hinge loss.
f(x) = wᵀx + bmax(0, 1 − y · f(x))Class B if f(x) ≥ 0Inference
After fitting, select a new point to classify against the margin.
Current point ready.
Classification
Decision Tree
See how recursive axis-aligned splits divide the feature space and guide a new observation to a leaf.
Build the tree
Choose a maximum depth, then inspect the split with the lowest weighted Gini.Data space and tree
Select a node to highlight its region and split in the data space.Active decision tree node metrics
What's Happening?
A decision tree chooses the split that leaves the children with the lowest weighted Gini impurity. Set a maximum depth, then build the tree.
Formula
Each split seeks purer child groups by minimizing their weighted impurity.
Gini = 1 − Σ pₖ²Gini split = Σ (nᵢ / n) · Giniᵢxⱼ < threshold → left; otherwise → rightInference
After building, select a new point and follow its animated decision path to a leaf.
Build the tree first to enable inference.
Clustering
K-Means
Watch K-Means alternate between assigning observations to the nearest centroid and updating centroid positions.
Run the clustering cycle
Advance one teaching phase at a time: initialize, assign, then update.Assignments and centroids
Select a training point for distances, or use Inference after convergence.Click a training point during Assign Points to inspect its centroid distances.
K-Means metrics
What's Happening?
Centroids are ready to be initialized. Next Step will assign every observation to its nearest centroid.
Formula
K-Means alternates between nearest-centroid assignment and mean-position updates.
aᵢ = arg minₖ ‖xᵢ − μₖ‖²μₖ = (1 / |Cₖ|) Σ xᵢΣᵢ ‖xᵢ − μₐᵢ‖²Inference
After convergence, switch modes and click the plot. Centroids stay fixed while the new point is assigned.
Converge the training cycle to enable inference.