Advanced programming
This section deepens students' Python programming skills beyond the foundations covered in Modules 1 and 2. The module opens with a consolidation of string formatting techniques, including f-strings, before moving into one of the most important paradigms in modern software development: Object-Oriented Programming (OOP). Students learn how to define classes, create objects, and write methods — concepts that underpin much of the Python code used in data science and machine learning libraries. The module then expands the Python toolkit with additional data structures (tuples and sets) and introduces file handling: how to read input from files and write output to files, including an understanding of file objects as consumable resources. Throughout, students apply and consolidate these skills through hands-on exercises and by annotating their own data science project notebooks.
This section guides students through the complete sequence of steps that transform raw data into a working classification model. Building on the preprocessing introduced in Module 2, students consolidate their understanding of handling missing values and duplicates, then move on to categorical data encoding — exploring the different strategies available and the reasoning behind each choice. A dedicated focus is placed on class imbalance: how to detect it, interpret it, and decide among the available strategies for addressing it. Students then learn the principles and good practices of splitting data into training and test sets, including stratification and random seed reproducibility, before confronting a critical and often underestimated issue: data leakage and the importance of fitting transformations exclusively on training data. The module culminates in the creation, fitting, and evaluation of a first classification model using K-Nearest Neighbors (KNN), introducing the conceptual framework of true/false positives and negatives as the foundation for model evaluation metrics. Students apply every step to their own dataset, progressively building an annotated, reproducible machine learning workflow.
This slide deck introduces Object-Oriented Programming (OOP) in Python. Starting from the foundational idea that everything in Python is an object, it motivates OOP through a concrete real-world analogy: programming a delivery drone by decomposing it into modular components (propeller, landing legs, camera, signalling system), each with its own attributes and methods. Key concepts covered include encapsulation, modular development, code reusability, and the distinction between a class (blueprint) and an object (instance). The deck concludes by introducing the class keyword and the concept of instantiation.
This slide deck introduces the K-Nearest Neighbors (KNN) algorithm within the supervised machine learning workflow. Starting from an overview of classification and regression methods, it explains how KNN works, how it measures distance between data points, and how to choose the optimal value of K. The deck also covers the risks of overfitting and underfitting, KNN's main limitations (memory cost, curse of dimensionality, sensitivity to noise and class imbalance), and why it is considered a "black box" model.