再次进行预测
您已经用不同的自变量组合多次走完预测流程。现在再在包含 3 个自变量的模型上练习一次。本题将使用包含三重交互项的模型,不过无论使用上一个练习中的哪一个模型,代码写法都是相同的。
taiwan_real_estate 和 mdl_price_vs_all_3_way_inter 已提供。itertools.product 已加载。
本练习是课程的一部分
Python 中级回归:使用 statsmodels
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Create n_convenience as an array of numbers from 0 to 10
n_convenience = ____
# Create sqrt_dist_to_mrt_m as an array of numbers from 0 to 80 in steps of 10
sqrt_dist_to_mrt_m = ____
# Create house_age_years with unique values
house_age_years = ____
# Create p as all combinations of n_convenience, sqrt_dist_to_mrt_m, and house_age_years, in that order
p = ____
# Transform p to a DataFrame and name the columns
explanatory_data = ____
# See the result
print(explanatory_data)