Problem Statement: Principal Component Analysis (PCA) on High-Dimensional Data
Objective:
We have a dataset with multiple highly correlated features, which makes it difficult to interpret and use for predictive modeling.
The goal is to use Principal Component Analysis (PCA) to reduce the dimensionality of the dataset while retaining most of its variance.
The steps are:
- Generate synthetic high-dimensional data.
- Perform PCA to reduce dimensions.
- Visualize the explained variance and transformed dataset in $2D$ space.
Python Code
1 | import numpy as np |
Explanation of Code
- Data Generation:
- A synthetic dataset with $10$ highly correlated features is generated by adding small random noise to a base feature.
- Additional noise ensures some weaker correlations for realism.
- Standardization:
- Features are standardized to have a mean of $0$ and a standard deviation of $1$, which is necessary for PCA.
- PCA:
- Principal components are computed to transform the high-dimensional dataset into a lower-dimensional space.
- The explained variance ratio shows how much variance each principal component captures.
- Visualization:
- A scree plot shows the cumulative variance explained by the components.
- A $2D$ scatter plot visualizes the dataset in the first two principal components.
Results

Explained Variance Ratio for each component: Component 1: 0.8043 Component 2: 0.0274 Component 3: 0.0267 Component 4: 0.0237 Component 5: 0.0220 Component 6: 0.0209 Component 7: 0.0201 Component 8: 0.0198 Component 9: 0.0178 Component 10: 0.0172
- Scree Plot:
- Shows how many components are required to explain most of the variance.
- Typically, we select enough components to explain $90$-$95$% of the variance.
- 2D Scatter Plot:
- Displays the high-dimensional data projected onto the first two principal components, which often reveal underlying patterns or clusters.









