Machine learning algorithms

Linear regression, decision trees, k-means, and the other classic algorithms: how each one learns and where it fits, with code I ran.

Linear models

  1. What is linear regression? A gentle guide to fitting linesWhat linear regression is, how least squares picks the weights, how to read coefficients and R², and when it fits or falls short, shown with code I ran.
  2. What is logistic regression? How it predicts yes or noWhat logistic regression is, how the sigmoid turns a weighted sum into a probability, how it learns and reads its weights, and how it handles three classes.

Training and evaluation

  1. What is gradient descent? How a model learns in small stepsWhat gradient descent is, how the learning rate and batch size change training, and why feature scaling matters, worked through with small numpy examples.
  2. What is overfitting? A gentle guide to models that memorizeWhat overfitting is, why a model that aces its training data can fail on new data, how to spot it with learning curves, and how to reduce it.
  3. What is cross-validation? A plain guide to k-foldWhat cross-validation is, why one train/test split can mislead you, how the k-fold variants differ, and how a pipeline keeps data leakage out of your scores.

Tree models

  1. What is a decision tree? How it grows one question at a timeWhat a decision tree is, how it picks each yes/no question with Gini impurity or entropy, why it overfits and is unstable, and where it fits, with iris data.
  2. What is a random forest? Why many trees beat one treeA random forest combines many decision trees grown on resampled data. How it works, why it beats one tree, OOB scores, key settings, and importance traps.
  3. What is gradient boosting? Trees that learn from mistakesGradient boosting adds small decision trees one at a time, each fixing the errors left so far. How it works, when it fits, and how XGBoost and LightGBM differ.

Unsupervised learning

  1. What is k-means clustering? Grouping data without labelsWhat k-means clustering is, the four steps it repeats, how to choose k, why scaling matters, and where it falls short, with Python examples I ran myself.
  2. What is PCA? A plain guide to principal component analysisWhat PCA (principal component analysis) is, how it sums up many tangled features with a few new axes, why scaling matters, and how many components to keep.