Machine Learning Engineer: From First Model to ML Engineer
Learn machine learning in Python, then ship it: data analysis, regression, classification, tuning, deployment and MLOps. Each tutorial below stands on its own and is free to read, in the order the course teaches it.
Start with step 1: First Look at a DatasetTutorials in course order
- Step 1: First Look at a Dataset: 6 Checks Before You Plot or Model
Six quick pandas checks that tell you what's inside a dataset: size, types, gaps, spread, label balance and duplicates. Shown on 142,193 days of Australian weather.
- Step 2: Plotting Distributions with seaborn: Histograms, KDE, Counts and log1p
Look at one column at a time: read the peak and the tail of a histogram, compare groups with hue, count categories, and tame a long tail with log1p. Shown on restaurant bills and iris flowers.
- Step 3: Scatter Plots and Pair Plots: See How Two Columns Relate
Draw one dot per row with seaborn scatterplot, colour the dots by group with hue, turn a clean split into a one-line rule, and read every pair at once with pairplot. Shown on iris and tips.
- Step 4: Finding Outliers: Box Plots, Violin Plots and the IQR Rule
Read a box plot from its five numbers, flag outliers with the 1.5 x IQR rule in pandas, compare groups with box and violin plots, and cap extreme values with clip. Shown on 244 restaurant bills.
- Step 5: Correlation and Heatmaps: Covariance, df.corr() and What They Miss
Put one number on "these two columns move together": why covariance depends on units, how correlation fixes it, scanning every pair with df.corr() and a seaborn heatmap, and the two traps correlation can't see.
- Step 6: Train-Test Split and Data Leakage: Split First, Learn After
Why the train-test split comes before everything else: an 80/20 split with stratify and random_state, a scaler that leaks test rows, and a column that secretly holds the answer. Shown on Rain in Australia.
- Step 7: Handling Missing Data: Count the Blanks, Then Fill Them with SimpleImputer
Count the blanks with isnull().sum(), see why dropna() would throw away 60% of the rows, and fill the gaps with SimpleImputer: median for numbers, most frequent for text, learned from the train rows only. Shown on Rain in Australia.
- Step 8: Encoding Categorical Data: OrdinalEncoder, OneHotEncoder and LabelEncoder
Models only understand numbers. Encode T-shirt sizes with OrdinalEncoder, colours with OneHotEncoder, avoid the dummy variable trap, handle a colour the encoder never saw, tame a date with 3,436 values, and encode the answer with LabelEncoder.
- Step 9: Feature Scaling: StandardScaler, MinMaxScaler and Which Models Care
Put features on the same scale so each one gets a fair say. StandardScaler and MinMaxScaler fitted on the train rows, the formula checked by hand, and a wine test where KNN jumps from 0.806 to 0.972 while a decision tree stays at 0.944.
- Step 10: Pipelines and ColumnTransformer: All Preprocessing and the Model in One Object
Pack imputing, encoding, scaling and the model into one scikit-learn Pipeline with two ColumnTransformer lanes. One fit on the train rows, 21 columns in, 115 out, 0.849 test accuracy, and a raw row with a blank predicted directly.
- Step 11: Feature Selection and the Curse of Dimensionality: Keep the Columns That Matter
More columns can hurt. See the curse of dimensionality in numbers (farthest over nearest falls from 46.78 to 1.10), then keep the best columns with SelectKBest inside a pipeline: 5 of 115 columns score 0.83 against 0.849 for all.
- Step 12: Project: Preprocess Rain in Australia from Raw CSV to Model-Ready Data
A hands-on project: take the raw weatherAUS.csv through a health check, a new Month column, leak removal, a stratified split and a two-lane ColumnTransformer. 22 columns become 127 numeric inputs with zero blanks, and a 0.776 baseline to beat.
- Step 13: Linear Regression and the Cost Function: Draw a Line, Score It
Draw a straight line through six kids' ages and weights, measure every miss, and turn the misses into one score, the mean squared error. Then let np.polyfit find the line with the lowest score.
- Step 14: Gradient Descent Explained: Feel the Slope, Step Downhill
Instead of handing over the best line, let the computer walk to it: measure the slope of the cost, step downhill with a learning rate, repeat. Shown step by step on six kids' ages and weights.
- Step 15: Linear Regression in scikit-learn: Fit, Predict and Read the Price Tags
Predict a yearly medical bill with scikit-learn's LinearRegression: first from age alone, then from every column inside a pipeline. Each coefficient reads like a price tag, and smoker_yes is by far the biggest.
- Step 16: Regression Metrics: MAE, RMSE, R-squared and the Baseline to Beat
Score a regression model honestly: MAE, MSE and RMSE from four darts, then the insurance model on 268 test people, a DummyRegressor baseline to beat, R-squared and adjusted R-squared, and a residual plot.
- Step 17: Polynomial Regression, Overfitting and Underfitting: Bend the Line, Watch the Test Score
Give a linear model extra columns with PolynomialFeatures and it can bend. Then watch train and test scores split apart: degrees 1, 2 and 16 on Canada's income per person, and degrees 1 to 5 on the insurance model.
- Step 18: Regularisation with Ridge and Lasso: Put a Price on Big Weights
The degree-4 insurance model overfits (train 0.876, test 0.754). Ridge shrinks every weight and lifts the test score to 0.843; Lasso switches off all but 40 of 495 columns and reaches 0.862.
- Step 19: Logistic Regression and the Sigmoid: Score, Squash, Decide
How logistic regression turns a price into the probability of a car: why a straight line fails, Euler's number e, the sigmoid, the 0.5 threshold, the decision boundary and log loss, on eight vehicles.
- Step 20: Logistic Regression in scikit-learn: predict, predict_proba and Softmax
Logistic regression as the last step of a scikit-learn pipeline on Rain in Australia: test accuracy, max_iter and ConvergenceWarning, predict vs predict_proba, then three Iris classes and softmax worked by hand.
- Step 21: Why Accuracy Lies: The Confusion Matrix, Baselines and Type I/II Errors
On 20,000 card payments with 1% fraud, a model that never looks scores 99% accuracy and catches nothing. The confusion matrix shows what accuracy hides: 21 frauds caught, 29 missed.
- Step 22: Precision, Recall and F1 Score: Two Questions and One Balance
Precision asks whether the model's yes is right; recall asks whether it found them all. Worked by hand and with scikit-learn on a fraud model with 99.4% accuracy and only 0.42 recall.
- Step 23: ROC Curve, AUC and Choosing a Classification Threshold
The 0.5 cut is only a default. On 1% fraud data: slide the threshold, draw the ROC and precision-recall curves, read AUC 0.877, pick the best-F1 cut on validation data, then open the test part once.
- Step 24: Handling Imbalanced Data: class_weight, SMOTE and the Resampling Leak
With 150 frauds among 15,000 training payments, a model learns to ignore fraud. Compare class_weight, random oversampling and SMOTE, see why full balance overshoots, pick a gentle SMOTE on validation data and avoid the resample-before-split leak.
- Step 25: Cross-Validation: KFold, StratifiedKFold, cross_val_score and cross_validate
The same model on five different splits scores F1 from 0.52 to 0.63. Cross-validation replaces one lucky number with a mean and a spread: KFold vs StratifiedKFold, cross_val_score, cross_validate on four models, then one honest test.