PCA Implementation Steps: 4 to 6
Explore how to scale features using StandardScaler, apply PCA to reduce data to key components, and visualize these components with Matplotlib. This lesson helps you perform essential PCA implementation steps to prepare data for further machine learning models.
4) Scale data
Next, you will import the Scikit-learn function StandardScaler, which standardizes features by using zero as the mean for all variables and scaling to unit variance. The mean and standard deviation are then stored and used later with the transform method, which recreates the data frame with the requested transformed values.
After importing StandardScaler, you can assign it as a new variable, fit the function to the features contained in the data frame, and transform those values under a new variable name.
StandardScaler is often used in conjunction with PCA and other algorithms, ...