การพยากรณ์อีกครั้ง
ผ่านขั้นตอนการพยากรณ์มาหลายครั้งแล้วด้วยตัวแปรอธิบายหลายชุด ถึงเวลาลองอีกครั้งกับโมเดลที่มีตัวแปรอธิบาย 3 ตัว ที่นี่จะใช้โมเดลแบบ 3-way interactions แม้ว่าโค้ดจะเหมือนกันไม่ว่าจะใช้โมเดลใดจากแบบฝึกหัดก่อนหน้าก็ตาม
taiwan_real_estate และ mdl_price_vs_all_3_way_inter พร้อมใช้งานแล้ว และได้โหลด itertools.product ไว้แล้ว
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Regression ระดับกลางด้วย statsmodels ใน Python
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# 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)