Machine Learning (ML) · Beginner level

Beginner level · Module 2 of 5 · 11 guided hours

Preparing Data for Machine Learning

Explore data, clean it, encode categories and split it correctly so that evaluation is honest.

Learning objectives

  • Explore a data set to find problems and patterns
  • Handle missing values and encode categorical features
  • Split data into training and test sets without leakage

Topics

  • exploratory analysis
  • missing values
  • duplicates and outliers
  • one-hot encoding
  • train/test split
  • data leakage

Lessons

  1. Lesson 1 Exploring a Data Set

    Get to know data before modelling: its size, types, distributions, missing values and surprises.

    info() and describe()missing valuesdistributionoutlier

  2. Lesson 2 Cleaning and Encoding Data

    Handle missing values, fix inconsistent categories and turn categories into numbers that models can use.

    imputationdropping rows or columnsone-hot encodingconsistent categories

  3. Lesson 3 Splitting Data and Avoiding Leakage

    Keep test data truly unseen and avoid features that secretly reveal the answer.

    train_test_splitstratifydata leakagefit on training data only

Practical activity

Prepare the school dropout training data: explore it, fix missing values and categories, split it and write down every preparation decision.

Expected outcomes

  • Clean, model-ready data
  • Honest train/test separation

Assessment

Notebook review: preparation steps are correct, documented and applied without leakage.

Free taster lesson The Machine Learning Workflow Read a free self-study lesson on this topic in the Free Course Library.

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.