检查相关特征
现在回到 wine 数据集,它包含连续的数值型特征。请在该数据集上计算 Pearson 相关系数,以确定哪些列适合被删除。然后,从 DataFrame 中移除这些列。
本练习是课程的一部分
Python 中的机器学习预处理
练习说明
- 打印
wine数据集中每对特征的 Pearson 相关系数。 - 从
wine中删除与至少另外 2 列的相关系数「高于 0.75」的任何列。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Print out the column correlations of the wine dataset
print(____)
# Drop that column from the DataFrame
wine = wine.____(____, ____)
print(wine.head())