Software Development
Machine Learning with Python and scikit-learn
Building a model is the easy part; trusting its reported score is not. This five-day programme covers scikit-learn pipelines, honest cross-validation, the leakage patterns that inflate results, class imbalance, threshold selection, probability calibration, and the interpretation work that lets a business act on a prediction.
Overview
Practical learning for workplace transfer.
Models that disappoint in production were rarely as good as their validation score claimed. A scaler fitted before the split, a target-derived feature, a shuffle applied to time-ordered data, or an accuracy figure quoted on a dataset that is ninety-eight percent negative — each produces a number nobody can reproduce later. This course treats evaluation discipline as the core skill and the estimator as a detail. Participants build every model inside a Pipeline so preprocessing is refitted per fold, choose validation schemes that respect time and group structure, tune with nested search, set a threshold from a real cost matrix, and calibrate probabilities before they are used as risk scores.
Prerequisites
Confident Python and pandas skills, plus familiarity with descriptive statistics. No prior modelling experience is assumed.
Objectives
- Translate a business question into a supervised learning task with a measurable target.
- Compose preprocessing and estimators inside Pipeline and ColumnTransformer objects.
- Identify and eliminate the data-leakage patterns that inflate validation scores.
- Select cross-validation schemes that respect time ordering and group structure.
- Handle class imbalance with resampling, class weights, and cost-aware thresholds.
- Calibrate, interpret, and package a model for handover to an engineering team.
Target audience
- Data scientists formalising an ad hoc modelling practice
- Quantitative and risk analysts moving from statistical models to ML
- Software engineers assigned to a predictive feature
- Data engineers who must productionise models built by others
- Maintenance, demand planning, and credit teams evaluating predictive use cases
- Technical leads reviewing model results before they inform decisions
Program outline
A clear structure for the learning journey.
Program outline
Outline points are grouped in one designed block instead of being treated as separate module cards.
Module 1: Framing the Problem and the Dataset
Choosing a target definition and a prediction horizon the business can act on
Regression, classification, and ranking: matching the task to the decision
Baselines with DummyClassifier and DummyRegressor before any real model
Splitting strategy: random, stratified, grouped, or time-based
Module 2: Pipelines, ColumnTransformer, and Feature Preparation
Why fitting a scaler or imputer outside the pipeline leaks the test set
Numeric scaling, imputation, and encoding categorical variables safely
OneHot, ordinal, and target encoding and their failure modes on high cardinality
Custom transformers with FunctionTransformer and the estimator API
Module 3: Supervised Algorithms and Their Trade-offs
Linear and logistic regression with L1 and L2 regularisation
Decision trees, random forests, and where variance reduction stops helping
Gradient boosting with HistGradientBoosting and XGBoost compared
Bias-variance behaviour read from learning and validation curves
Module 4: Validation, Leakage, and Hyperparameter Search
KFold, StratifiedKFold, GroupKFold, and TimeSeriesSplit chosen by data structure
Target leakage, train-test contamination, and features unavailable at prediction time
GridSearchCV, RandomizedSearchCV, and HalvingSearchCV under a compute budget
Nested cross-validation for an unbiased estimate of tuned performance
Module 5: Imbalance, Thresholds, and Calibration
Why accuracy is meaningless on rare-event data and what to report instead
Class weights, SMOTE, and under-sampling with their side effects
Precision-recall curves, ROC AUC, and picking a threshold from a cost matrix
Probability calibration with Platt scaling, isotonic regression, and reliability curves
Module 6: Interpretation, Packaging, and Handover
Permutation importance and partial dependence read correctly
SHAP values for individual predictions and their communication limits
Persisting models with joblib, pinning versions, and recording training metadata
Monitoring drift and defining the retraining trigger before go-live
Materials provided
- Course workbook, annotated code samples, and reference notes
- Hands-on lab environment and starter repositories
- Exercises, checklists, and reusable code templates
- 4D Certificate of Completion
- Post-course technical guidance
Training Options
Programs can be delivered in-house, online, or in a blended format depending on your team's schedule, location, and learning objectives. When an external certificate or exam is included, certification rules and fees remain under the relevant awarding body's policies, while 4D provides the training and preparation support.
Why choose 4D
4D structures this programme around one of your candidate use cases — churn, credit decisioning, demand forecasting, or failure prediction. Trainers audit the historical dataset for leakage and label quality first, then build the pipeline with your analysts and agree the operating threshold with the business owner who will act on the output, so the model leaves with a defensible decision rule attached.
Related courses
Python Programming Fundamentals
A hands-on introduction to Python for engineers and analysts who need working code rather than tutorial fragments. Participants build fluency with data types, collections, functions, files, and error handling, then assemble a small program that reads real data and produces a usable report.
View courseIntermediate Python and Clean Code Practices
Designed for developers whose Python works but is difficult to change. The course covers dataclasses, generators, decorators, context managers, and type hints, then applies the refactoring moves that turn a nine-hundred-line module into small tested units guarded by black, ruff, and mypy.
View coursePython Automation and Scripting for Work Tasks
Aimed at teams losing hours every week to repetitive file, spreadsheet, and reporting work. Participants automate those tasks with Python: batch file handling, Excel and CSV processing, REST API calls, email alerts, and scheduled jobs that run unattended and report clearly when something fails.
View course