Blog
Machine learning, explained from first principles.
Practical articles on learning ML properly: what to learn, in what order, and the mistakes that make good-looking models fail.
Machine learning
Accuracy is lying to you: baselines, imbalance, precision and recall
Why a model that's right 89% of the time can be almost useless, and the three questions to ask before you trust any accuracy score.
Data leakage in machine learning: how a model looks brilliant and fails on day one
What data leakage is, the five ways it sneaks in, and the habits that keep your validation scores honest.
How to make an AI program that learns, step by step in Python
Build a small Python program that learns its own rule from examples, corrects its mistakes and beats a hand-written rule, then redo it in scikit-learn.
Regression models in machine learning: 8 types compared in Python
The main regression models in machine learning, from linear and ridge to random forests and gradient boosting, compared on one dataset in Python.
Cross-validation for groups and time: check what a split holds out
Audit random, grouped and chronological folds on the same small table, and choose a split that matches the prediction you intend to make.
Logistic regression from scratch: fit probabilities and inspect errors
Implement stable binary cross entropy and its gradient in NumPy, train on invented data and compare held-out predictions with a constant baseline.
Permutation feature importance: how it works and how to group correlated features
Permutation feature importance is how far a model's score drops when one feature is shuffled. Python code, a comparison with MDI and grouped shuffles.
Linear regression in machine learning: a worked Python example with a baseline
Learn linear regression with a worked prediction, runnable Python, a held-out test and a baseline. Explain coefficients and check where a line can fail.
Machine learning for business analytics: start with the decision, then the model
Plan a useful machine learning project for business analytics: define a decision, compare a rule, choose data and evaluate errors with a worked example.
Machine learning for predictive analytics: define the target, beat a baseline, test fairly
Build a predictive analytics experiment with a demand example: define the target, use prediction-time inputs, beat a baseline and test on held-out data.
Machine learning for unlabeled data: a clustering example and how to check it
Explore unlabeled data with a runnable clustering example. Understand cluster IDs, scaling, useful checks and when you still need human labels.
Machine learning interview questions: how to prepare, with worked answers
Machine learning interview questions with worked answers: splits, leakage, precision and recall, baselines, gradient descent and regularisation, in Python.
Overfitting vs underfitting: examples and how to fix each
Tell overfitting from underfitting with training and validation error, work through a demand example and choose a sensible next experiment.
Where to start with machine learning: a four-step path for beginners
Start machine learning with Python, then NumPy and pandas, the maths a model uses, and linear regression. A four-step path for beginners, with checkpoints.
How to learn AI from scratch: a 12-week plan for beginners
Learn AI from scratch in order: Python, data tools, maths, statistics, a first model, then an AI app. A 12-week plan with checkpoints and free resources.
Machine learning engineer roadmap: seven stages, each with a checkpoint
A machine learning engineer roadmap in seven stages, from Python as software to a portfolio. Each stage lists what to study and ends in a checkpoint.
How to get an AI or machine learning internship: what to learn, build and explain
Get an AI or machine learning internship: the four skills interviewers test, two projects worth building, where to find openings and how to apply.
AI engineer vs machine learning engineer: the difference, and what to learn for each
An ML engineer trains and deploys models; an AI engineer builds products on models like LLMs. Compare the work, skills and maths, and what to learn.
Python
Python shallow copy vs deep copy: trace a nested-data bug
Follow a nested dictionary through assignment, shallow copying and deep copying, then choose the right copying boundary for a data workflow.
Python projects for beginners: three small programs with complete code
Build three beginner Python projects with complete code: a study tracker, quiz report and CSV stock checker. Check the output, then extend each one.
Python for machine learning and AI: what to learn first, and what to skip
Learn core Python first, then NumPy, pandas, Matplotlib and scikit-learn, in that order. What each stage gives you, what to skip and when you know enough.
Data tools
pandas loc vs iloc: select by label or by position
loc selects pandas rows and columns by label; iloc selects by integer position. See a side-by-side table, slicing rules, errors and examples you can run.
scikit-learn fit, transform and predict: what each method does
fit learns from training data, transform applies that learning, predict outputs answers. See a table, runnable code and why test data gets transform only.
Machine learning code in Python: a first model in about 30 lines, plus two more examples
Runnable machine learning sample code in Python: a scikit-learn classifier explained line by line, plus regression and clustering, each with its output.
Statistics
Misleading statistics: 10 examples and how to spot each one
Misleading statistics use true numbers to suggest false conclusions. See 10 examples, from truncated axes to Simpson's paradox, and how to spot each one.
Statistics and probability for data science and machine learning: what to learn, in order
The statistics and probability data science and machine learning use, in 7 steps, with a worked example for each and a list of what you can skip.
Maths
Matrix multiplication with shapes: map a batch of vectors
Trace a 2×3 batch through a 3×2 matrix, calculate individual entries and distinguish matrix multiplication from broadcasting and elementwise products.
Prerequisites for machine learning and AI: the maths, statistics and Python you need
The prerequisites for machine learning: Python, basic linear algebra and calculus, and intro statistics and probability. Exact topics and a readiness test.
Deep learning
Convolution output shape: work through padding, stride and channels
Calculate a CNN's spatial dimensions by hand, verify them in PyTorch and repair a mismatched linear layer after flattening.
PyTorch model.eval() vs torch.no_grad(): what each does and why you need both
model.eval() switches dropout and batch norm to inference behavior; torch.no_grad() stops gradient tracking. Use both to validate, with checked code.
Machine learning vs deep learning: key differences, with examples
Deep learning is machine learning with many-layered neural networks. Compare data, features, hardware and real examples, and see when to use each.
PyTorch vs TensorFlow: which should beginners learn first?
Our advice: learn PyTorch first, unless your course, team or project uses TensorFlow. See the same model in both, a side-by-side table and a decision rule.
Transfer learning vs fine-tuning: the difference and when to use each
Fine-tuning is one kind of transfer learning: it updates pretrained weights, while feature extraction freezes them. When to use each, with PyTorch code.
First Principles, the SchoolWhool newsletter
One machine learning idea, explained properly, every week.
The intuition, the common mistake, and a five-minute way to try it yourself. Written by Gaurav.