Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 847 Bytes

14.md

File metadata and controls

20 lines (13 loc) · 847 Bytes

特征工程

原文:https://www.textbook.ds100.org/ch/14/feature_engineering.html

# HIDDEN
# Clear previously defined variables
%reset -f

# Set directory for data loading to work properly
import os
os.chdir(os.path.expanduser('~/notebooks/14'))

特征工程指的是为数据集本身创建和添加新特征,以增加模型的复杂性的实践。

到目前为止,我们只使用数字特征作为输入进行线性回归,我们使用(数字)总账单来预测小费金额。然而,tip 数据集也包含分类数据,例如星期几和用餐类型。特征工程允许我们将分类变量转换为数值特征进行线性回归。

特征工程还允许我们通过在数据集中创建新变量来使用线性回归模型进行多项式回归。