Lesson 1.3 · 7 min read · about 50 min to master at a very slow pace
The ML Modelling Process
The practical workflow from problem definition to deployment, why it is a loop and not a pipeline, and the difference between an algorithm and its complexity.
The workflow
- Define the problem and the decision the prediction will support. Decide the task type.
- Obtain and explore the data. Identify the target and candidate predictors. Look for missing values, odd units, duplicates.
- Split the data into training, validation and test sets before learning anything from it.
- Choose candidate models and fit them on the training data.
- Compare them on validation data, or by cross-validation.
- Inspect errors and assumptions. Go back and revise features, data or model.
- Evaluate the final model once on the test set, then deploy and monitor it.
A loop, not a pipeline
Step 6 sends you back to earlier steps. Evaluation often reveals that the task definition, the features or the model choice needs to change. What must not loop is the test set: it is used once, at the very end.
A revision analogy
Think of studying with past papers. Training data are the questions you practise on. Validation data are a mock exam you use to decide how to revise. Test data are the real exam, which you must not see in advance. If you memorise the practice answers you score 100% on them and may still fail the real exam. That is overfitting.
Algorithm vs complexity
Two different choices hide inside "choosing a model":
| Model algorithm | Model complexity | |
|---|---|---|
| What it is | The learning technique | How flexible that technique is allowed to be |
| Examples | Linear regression, logistic regression, decision tree, SVM | Polynomial degree, tree depth, number of features, in K-NN, penalty |
| Tree example | "Use a decision tree" | "Depth 2" (simple) vs "depth 20" (very flexible) |
Settings that control complexity and are chosen by you rather than fitted from the data are called hyperparameters. Coefficients are fitted on the training set; hyperparameters are chosen on validation data.
Feature construction
The process includes building new features from domain knowledge: a ratio of debt to income, the day of the week from a timestamp, or to capture curvature. Task definition, features, model choice and evaluation are connected decisions, not isolated steps.
Stuck? Common doubts
Questions real learners asked while studying this lesson. They stay closed so they don't spoil your own thinking: open only the ones you need.
Going deeperWhat is the difference between model algorithm and model complexity?
The algorithm is the learning technique (logistic regression, decision tree, random forest...). The complexity is how sophisticated or flexible that particular model is allowed to be.
Example: a decision tree of depth 2 and one of depth 20 use the same algorithm but have very different complexity. The depth-20 tree can carve out tiny regions around individual training points, so it is far more likely to overfit.
Cheatsheet
ML workflow
Hyperparameter
Check your understanding
Score 75% or more to master this lesson and earn XP. Answer first, then check.