Machine Learning (ML) · Intermediate level

Intermediate level · Module 4: Unsupervised Learning · Lesson 3 of 3

Dimensionality Reduction with PCA

Summarise many correlated features with principal component analysis for visualisation and modelling.

In this lesson you will

  • Apply PCA and interpret explained variance
  • Use PCA for visualising clusters and in pipelines

Key concepts

principal componentsexplained variance ratio2-D projectioninformation loss

The lesson

Principal component analysis (PCA) creates new features — components — that capture as much of the data's variation as possible. The first two components let you plot high-dimensional data in two dimensions.

The explained variance ratio shows how much information each component keeps. If two components explain 85% of the variance, a 2-D plot is a fair picture; if they explain 30%, it may mislead.

Components are combinations of original features and harder to interpret. PCA can speed up some models, but always check validation performance after adding it.

Step by step

  1. Run PCA on the scaled agent features.
  2. Plot the cumulative explained variance.
  3. Plot agents on the first two components coloured by cluster.
  4. Compare a model with and without PCA.

Practice activity

Complete the agent segmentation with a PCA plot and a named description and action for each segment.

Expected result: Named, actionable segments with a fair visual summary.

Check your understanding

  1. What does the explained variance ratio tell you?

    Show answer

    How much of the data's variation each component captures.

  2. What is a drawback of PCA components?

    Show answer

    They are combinations of features and harder to interpret.

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.