每个类别各建一个模型
您在整个数据集上拟合的模型,对某些部分的拟合要优于其他部分。值得分别在数据集的不同子集上运行线性模型,看看这些模型之间是否一致,或者出现分歧。
taiwan_real_estate 已提供。
本练习是课程的一部分
Python 中级回归:使用 statsmodels
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Filter for rows where house age is 0 to 15 years
taiwan_0_to_15 = ____
# Filter for rows where house age is 15 to 30 years
taiwan_15_to_30 = ____
# Filter for rows where house age is 30 to 45 years
taiwan_30_to_45 = ____