視覺化線性與邏輯斯模型
就像線性迴歸一樣,regplot() 也能幫你畫出邏輯斯迴歸的模型預測,你不需要自己處理建模程式碼。為了比較線性與邏輯斯迴歸的預測差異,試著把兩條趨勢線並排畫出來。提示:線性模型會是線性的(直線)趨勢,邏輯斯模型則會是 S 形的趨勢。
churn 已可使用。
本練習屬於課程
使用 Python 中的 statsmodels 進行回歸入門
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Draw a linear regression trend line and a scatter plot of time_since_first_purchase vs. has_churned
sns.regplot(____,
line_kws={"color": "red"})
plt.show()