Skip to content
C

Problem 4: Visualize High-Dimensional Data in 2D Using PCA

Easypython

Problem Description

Write a Python program that reduces a dataset with more than 2 features down to exactly 2 principal components using PCA, then creates a scatter plot of the reduced data.

Input

A dataset with at least 4 numeric features.

Output

A displayed 2D scatter plot of the PCA-reduced data.

Constraints

  • At least 5 data rows.

Example Input

text
(A dataset with 4 numeric features across 5 or more rows)

Example Output

text
(A 2D scatter plot showing the data reduced to its top 2 principal components)

Concepts Covered

PCA, n_components=2, plt.scatter().

Input (stdin)

Output

Run your code to see output here...