开始使用免费开始使用

可视化已部署模型随时间变化的输出

在本练习中,您将使用两个不同月份(1 月和 2 月)的数据,来监控心脏病模型的预测随时间的变化。正如您所知,您的模型经过训练,用于进行心脏病的二元分类任务,并且您已经在这两个月的日志中记录了模型的预测。

假设过去两个月的模型预测日志是通过 Elastic Beanstalk 生成的,并已导入为 pandas 的 DataFrame,分别命名为 logs_januarylogs_february,其中包含该月份预测结果的 target 列。matplotlib.pyplot 已作为 plt 导入。

本练习是课程的一部分

端到端机器学习

查看课程

练习说明

  • 通过绘制相邻的柱状图,按时间可视化模型在 1 月和 2 月的 target 预测分布。

交互式实操练习

通过完成这段示例代码来试试这个练习。

fig, ax = plt.subplots(1, 2, figsize=(15, 6))  # 1 row, 2 columns
# January Plot
logs_january['____'].____.plot(kind=____, ax=ax[0])
ax[0].set_title('Distribution of Predicted Classes - January')
ax[0].set_xlabel('Class')
ax[0].set_ylabel('Frequency')

# February Plot
logs_february['____'].____.plot(____=____, ax=ax[1])
ax[1].set_title('Distribution of Predicted Classes - February')
ax[1].set_xlabel('Class')
ax[1].set_ylabel('Frequency')

plt.tight_layout()
____.____
编辑并运行代码