确定需要标准化的特征
在本练习中,您将查看 UFO 数据集各列的方差,以判断哪些特征需要标准化。观察 seconds 和 minutes 两列的方差后,您会发现 seconds 列的方差非常高。由于 seconds 与 minutes 彼此相关(我们在进行建模特征选择时会处理这一问题),现在先对 seconds 列进行对数归一化。
本练习是课程的一部分
Python 中的机器学习预处理
练习说明
- 计算
seconds和minutes两列的方差,并仔细查看结果。 - 对
seconds列执行对数归一化,生成名为seconds_log的新列。 - 打印
seconds_log列的方差。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Check the variance of the seconds and minutes columns
print(____)
# Log normalize the seconds column
ufo["seconds_log"] = ____
# Print out the variance of just the seconds_log column
print(____)