Machine Learning Basics: Build Your First Prediction Model
BeginnerTrain, measure and explain a scikit-learn model that predicts which customers will leave.
You build
A small Python project that trains a model on a sample table of phone company customers to predict which customers will leave, measures it once on customers it never saw, and reports in plain words what its predictions rely on.
You need
- Basic Python: variables, functions, lists, dictionaries, loops, importing a module and running a script from a terminal
- School math: percentages, averages and reading a small table of numbers (no calculus, no statistics course)
To build it on your own machine
This is optional and comes with a plan. The course pack brings the starting files, a ready container and a check for every lesson. You need only Docker and git, plus your own AI coding agent if you want a tutor.
What you learn
A model is worth what it scores on data it never saw
You build one model from the first lesson to the last: it reads a sample table of 7,043 phone company customers, published by IBM, and predicts who will leave. Each lesson adds one working step: split the data, train a first decision tree, measure it with more than accuracy, catch it memorising, cross-validate, add logistic regression, prepare text and blank values in a pipeline, try gradient boosting, test once and explain it. You need basic Python; the few pandas calls used are explained as they appear.
- Honest Measurement. A test set that stays locked until the end, a baseline every model must beat, precision and recall where accuracy flatters, and cross-validation with its spread so that a lucky split never decides.
- Models You Can Read. A decision tree as a short list of yes-or-no questions and logistic regression as a weighted sum turned into a probability: two simple models you can inspect, both trained with the same fit and predict.
- Overfitting. How a model that is allowed to grow memorises its training rows, how the gap between its training and validation scores gives it away, and how a setting is chosen without fooling yourself.
- Features and Stronger Models. Turning text categories and blank values into numbers inside a pipeline, how gradient boosting builds many small trees one after another, why a more powerful model does not always win, and how to choose when two models tie.
Lessons
Turn a Customer Table into a Prediction Question
Machine learning, Classification, Features and label, Tables in pandas
Hold Out Data the Model Never Sees
Generalization, Training, validation and test, Stratified splitting, Random seed
Train a First Model: a Small Decision Tree
Fit and predict, Decision trees, Baseline, Accuracy
Measure What Accuracy Hides
The accuracy trap, Confusion matrix, Precision, Recall
Spot Overfitting
Model complexity, Overfitting, Training versus validation score, Underfitting
Choose a Setting with Cross-Validation
Noise in one split, K-fold cross-validation, Mean and spread, Hyperparameters
A Second Model: Logistic Regression
Weighted sum, Logistic regression, Predicted probabilities, Reading the weights
Prepare Features: Text Categories and Blank Values
Missing values, Category columns, One-hot encoding
Scaling and Pipelines: Preparation That Stays Honest
Feature scaling, Data leakage, Pipeline, Column-wise preparation
Gradient Boosting: Does a Stronger Model Win?
Boosting, Boosting settings, Choosing between close models
The Final Test: One Honest Number
The final fit, One test measurement, Estimate versus result, Ranking by probability
Explain the Model in Plain Words
Permutation importance, Repeats and spread, Correlated features, Model, not cause
Where it fits
Course 1 of 2 on the Machine Learning Engineer path.