ความหมายของ evolution
ในแบบฝึกหัดนี้ เราจะสำรวจความสัมพันธ์ระหว่างตัวแปร "donations2017min_2016" ที่เพิ่มลงใน basetable ในแบบฝึกหัดก่อนหน้า กับ target โดยใช้ predictor insight graph
เพื่อความสะดวก เมธอดสำหรับสร้าง predictor insight graph ได้ถูกกำหนดไว้ให้แล้ว
หากต้องการพล็อต predictor insight graph ของตัวแปรต่อเนื่อง variable ใน basetable ให้ทำตามขั้นตอนเหล่านี้:
- แบ่งตัวแปรออกเป็น
n_binsbins:
basetable["variable_disc"] = pd.qcut(basetable["variable"], n_bins)
- สร้างตาราง predictor insight graph:
pig_table = create_pig_table(basetable, "target","variable_disc")
- พล็อต predictor insight graph จากตารางนี้:
plot_pig(pig_table,"variable_disc")
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Predictive Analytics ระดับกลางด้วย Python
คำแนะนำการฝึกหัด
- แบ่งตัวแปร evolution
donations_2017_min_2016ออกเป็น 5 bins และเพิ่มลงใน basetable - สร้างตาราง predictor insight graph สำหรับตัวแปรนี้
- พล็อต predictor insight graph ของตัวแปรนี้
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# Discretize the variable in 5 bins and add to the basetable
basetable["donations_2017_min_2016_disc"] = pd.____(____["____"], ____)
# Construct the predictor insight graph table
pig_table = ____(____, "target", "____")
# Plot the predictor insight graph
plot_pig(____, "____")