Five tools cover almost every DBA thesis. Here is what each one really computes — the equation, the intuition, and a hands-on demo of the engine underneath.
Before the detail, the lay of the land. Tap each card for the one-line summary; the rest of the page is a deep dive into each.
Interactive — tap each card.
Method
Target
Answers
Linear regression
Continuous (a number)
How much does X change y?
Logistic regression
Binary (yes/no)
How does X change the probability of yes?
Decision tree / forest
Either
What if/then rules predict y?
k-means clustering
None
What natural groups exist?
Correlation
None (a pair)
Do two variables move together?
1 · LINEAR REGRESSION
THE EQUATION
A weighted sum of your predictors
With several predictors it generalises Part 1's line into a plane:
ŷ = b₀ + b₁x₁ + b₂x₂ + … + bₖxₖ
bⱼthe effect of predictor xⱼ holding the others constant — this "all else equal" is the entire reason regression beats simple correlation.
Below, predict an employee's salary from years of experience and training days. Tune the two slopes; the readout shows a prediction for a specific person and the model's overall fit.
Interactive 1 — two predictors, one prediction.
Predicted salary (8 yrs, 10 days)
—
Fit R²
—
Assumptions (the viva favourites): a roughly linear relationship, residuals that are independent and roughly normal with constant spread, and predictors not too collinear (not near-duplicates of each other). Violations don't break the maths but weaken your claims — name them.
2 · LOGISTIC REGRESSION
WHY A NEW MODEL IS NEEDED
You cannot fit a straight line to yes/no
If the target is 0 or 1 (churn / stay), a straight line happily predicts 1.4 or −0.3 — nonsense as a probability. Logistic regression fixes this by passing the linear part through the sigmoid (S-curve), which squeezes any number into the 0–1 range:
P(yes) = 1 / (1 + e−z) , where z = b₀ + b₁x
zthe familiar linear part (the "log-odds").
e≈ 2.718. The sigmoid turns z into a probability: very negative z → 0, very positive z → 1, z = 0 → exactly 0.5.
Drag the curve. b₁ controls steepness (how sharply yes/no flips); b₀ shifts it left/right (the threshold). The dots are real customers at 0 (stayed) and 1 (churned).
Interactive 2 — shape the S-curve to separate the two outcomes.
P(churn) at x=7
—
Classified correctly
—
Reading the output: logistic software reports odds ratios, not slopes. OR > 1 means the factor raises the odds of "yes"; OR < 1 lowers them. Part 4 drills this.
3 · DECISION TREES
HOW A SPLIT IS CHOSEN
Twenty questions, chosen by maths
A tree asks yes/no questions to carve the data into ever-purer groups. The art is which question to ask. The tree tries every possible threshold on every feature and keeps the split that best reduces impurity — a measure of how mixed the outcomes are. A common impurity measure is the Gini index:
Gini = 1 − Σ pᵢ²
pᵢthe proportion of class i in a group. A pure group (all churned) has Gini 0; a 50/50 mix has Gini 0.5 — maximally impure.
Below, pick a split point on "tenure". Watch the two resulting groups and their combined impurity. The tree would pick the threshold that drives the weighted Gini lowest — find it by hand.
Interactive 3 — slide the split; minimise the weighted impurity.
Left Gini
—
Right Gini
—
Weighted (lower=better)
—
From tree to forest. A single deep tree overfits (Part 5). A random forest grows hundreds of trees on random slices of data and averages them — far more accurate, but you trade away the simple readable rules. Classic accuracy-vs-interpretability tension.
4 · CLUSTERING & 5 · CORRELATION
CLUSTERING — RECAP
k-means: covered hands-on in Part 2
Clustering is the unsupervised method; you ran its four-step engine in Part 2 (choose k → assign to nearest centre → move centres → repeat). Its objective is minimising within-group distance (inertia). The key reminders: you choose k, results depend on the random start, and clusters are a hypothesis to validate.
Pearson's r measures the strength and direction of a linear link between two variables, from −1 (perfect down) through 0 (none) to +1 (perfect up):
r = Σ(xᵢ−x̄)(yᵢ−ȳ) / √[ Σ(xᵢ−x̄)² Σ(yᵢ−ȳ)² ]
ideawhen x is above its average and y is too, the product is positive; do that consistently and r climbs toward +1. The denominator just rescales it to the −1…+1 range.
Drag the slider to change the true strength of the relationship and watch both the cloud and r respond. Note how r² (the share of variance explained) is literally the regression R² from Part 1 for a single predictor.
Interactive 5 — change the strength; read r.
Correlation r
—
r² (variance shared)
—
Verbal strength
—
r measures only straight-line links. A perfect U-shape can have r ≈ 0. Always plot first. And — the drum we keep beating — a high r is association, never proof of causation (Part 5).
OUT OF SCOPE
Name them, don't claim them
These appear in papers but need data volumes and skills beyond a typical DBA. Cite them as future work; don't claim to have applied them.
Neural networks / Deep learningSVMTime series / ARIMAPCAGradient boosting
Scroll progress saves on this device. Part of the DBA Data-Analysis series by Jan Erik Meidell.