LoslegenKostenlos loslegen

Multicollinearity techniques - PCA

In the last exercise you used feature engineering to combine the s1 and s2 independent variables as s1_s2 since they displayed the highest correlation in the diabetes dataset.

In this exercise, you'll perform PCA on diabetes to remove multicollinearity before you apply Linear Regression to it. Then, you'll compare the output metrics to those from the last exercise. Finally, you'll visualize what the correlation matrix and heatmap of the dataset looks like since PCA completely removes multicollinearity.

Diese Übung ist Teil des Kurses

Practicing Machine Learning Interview Questions in Python

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Import
from sklearn.decomposition import ____

# Instantiate
pca = ____()

# Fit on train
pca.____(____)

# Transform train and test
X_trainPCA = pca.____(____)
X_testPCA = pca.____(____)
Code bearbeiten und ausführen