Machine Learning in Python
About This Course
Machine learning is a set of methods for making predictions from data, and scikit-learn is the library most Python teams use to apply them. This course takes you from the Python language itself to models you can defend. Along the way you learn the programming, the data handling and the numerical work that the modelling depends on.
Day One focuses on the Python language, taught through worked examples rather than syntax tables. The day also covers enough of Jupyter to work in it efficiently, including producing automated reports from a notebook.
Day Two focuses on getting data from where it is kept: spreadsheets, Parquet files, databases, and web APIs with rate limits. You then clean the data and chart it with Plotly Express, so the shape of a problem is visible before you model it.
Day Three covers the numerical groundwork. NumPy underlies every modelling library you will use, so you spend time on arrays, broadcasting and the linear algebra the later methods rely on. The day continues with simulation, regression, clustering and anomaly detection.
Day Four covers machine learning with scikit-learn from end to end. Validation and feature engineering get real time, because they separate a model that works from one that only looked good on the training set. The day finishes with putting a trained model into production, and testing for dataset shift as new data drifts away from the data the model was fitted on.
You write code in every section. Datasets are drawn from a range of industries. Bring your own datasets and we will work through them with you.
Who This Course Is For
Analysts, engineers, scientists and researchers who need to build predictive models but do not yet write Python. The course suits people who currently do this work in spreadsheets, in another language, or with a tool that has run out of room. It covers the language, the data handling and the modelling in a single course, rather than one slice of it.
This course also suits teams where modelling is done by one or two people and everyone else waits on them, and teams who have models in a notebook but none running where a colleague can use them. If your people already write Python and use Pandas or Polars, Python Charmers' Python for Machine Learning course covers the modelling alone in a shorter format.
Prerequisites
Some familiarity with programming concepts in any language is helpful, but prior programming experience is not required. You do not need to have written Python before.
No prior machine learning experience is expected, and no mathematics beyond what your own work already requires. You do not need to derive an algorithm to use one well, and we do not ask you to.
What You'll Learn
- Write Python to load, clean and reshape the data your work depends on.
- Move data between the formats and systems your organisation already uses, including Excel workbooks, Parquet files, SQL databases and web APIs.
- Build regression, classification and clustering models with scikit-learn, using the same estimator interface across all three.
- Validate a model honestly with held-out data and cross-validation, and read the learning and validation curves that show where it is failing.
- Engineer features from messy data, and find the outliers and anomalies that distort results.
- Put a trained model into production, and test it for the dataset shift that degrades it over time.
Course Syllabus
Day 1: Python basics
- The core language, taught through worked examples
- Functions, keyword arguments and exceptions
- Lists, dictionaries and the further data types you will need
- Modules, packages, files and paths
- Working effectively in Jupyter: cells, kernels and keyboard shortcuts
- Producing automated reports from a notebook
Day 2: Handling, analysing and presenting data
- Tabular data analysis with Pandas or Polars
- The common data formats: CSV, Excel, Parquet and JSON
- Retrieving data from databases with SQLAlchemy Core and the ORM
- Retrieving data from web APIs, and working within rate limits
- Cleaning data and handling missing values
- Interactive visualisation with Plotly Express
Day 3: Further data analytics
- Array and matrix computing with NumPy: indexing, views and broadcasting
- Linear algebra, eigenvalues and transformation matrices
- Simulation with Monte Carlo sampling and the bootstrap
- Uncertainty and confidence intervals
- Multiple linear regression, design matrices and categorical data
- Cluster analysis, including satellite imagery and text
- Outlier and anomaly detection with K-means, DBSCAN and pyOD
Day 4: Machine learning
- Regression, classification and time-series forecasting
- The scikit-learn estimator interface, and choosing an estimator
- K-nearest neighbours, applied to image and tabular classification problems
- Validation and scoring: cross-validation, overfitting and underfitting
- Diagnostics: confusion matrices, learning curves and Yellowbrick
- Feature engineering and selection, pipelines and ColumnTransformer
- Putting models into production, and testing for dataset shift