线性与逻辑模型的可视化
与线性回归类似,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()