Search⌘ K
AI Features

Exercise: Dimensionality Reduction in Plotly

Explore how to perform dimensionality reduction using principal component analysis and visualize the outcomes with Plotly Express. This lesson guides you through scaling data, creating 2D and 3D scatter plots of principal components, and analyzing explained variance using subplots.

We'll cover the following...

Exercise 1

Take the matrix XX, scale the data, apply principal component analysis and plot the first two principal components using Plotly Express.

Solution

This code snippet creates a PCA (principal component analysis) pipeline, transforms the input data using this pipeline, and visualizes the first two principal components using a scatter plot. Here’s an overview of the different parts of the code:

  • A pipeline is created using the make_pipeline() function on line 2 from the ...