A principal component is a new, independent feature formed by combining correlated original features. PCA uses these components to reduce dimensionality while preserving as much data variance, or information, as possible. section 9.2.5
A practical PCA workflow is:
- Split the feature data into training and testing sets, then check class balance. section 9.2.5
- Scale the training features to mean 0 and standard deviation 1 with StandardScaler. section 9.2.5
Four-component representation
Applying PCA(n_components=4) to X_train_scaled produces X_train_pca with columns PC1, PC2, PC3, and PC4. Plotting PC1 against PC2, or PC3 against PC4, helps compare the transformed data by class.




