Search⌘ K
AI Features

Dimensionality Reduction in Plotly

Explore how to perform dimensionality reduction with principal component analysis on the cancer dataset using Plotly. Understand scaling, transformation, and how to visualize principal components in 2D and 3D scatter plots. Learn to interpret explained variance ratio charts to assess data representation.

Our data

Here we use the cancer dataset to perform dimensionality reduction using principal component analysis (PCA).

Python 3.8
# Import libraries
import pandas as pd
import numpy as np
# Import datasets
cancer = pd.read_csv('/usr/local/csvfiles/breast_cancer.csv')
print(cancer.head())

Principal component analysis

Just a brief definition first: Principal component analysis (PCA) aims to transform a high-dimensional feature space into a lower-dimensional space while still trying to retain as much information in the data as possible.

The idea behind this is that if we are dealing with a dataset with many features, we can represent the data in a much lower dimensional space ...