LoslegenKostenlos loslegen

Checking for correlated features

You'll now return to the wine dataset, which consists of continuous, numerical features. Run Pearson's correlation coefficient on the dataset to determine which columns are good candidates for eliminating. Then, remove those columns from the DataFrame.

Diese Übung ist Teil des Kurses

Preprocessing for Machine Learning in Python

Kurs anzeigen

Anleitung zur Übung

  • Print out the Pearson correlation coefficients for each pair of features in the wine dataset.
  • Drop any columns from wine that have a correlation coefficient above 0.75 with at least two other columns.

Interaktive Übung

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

# Print out the column correlations of the wine dataset
print(____)

# Drop that column from the DataFrame
wine = wine.____(____, ____)

print(wine.head())
Code bearbeiten und ausführen