開始使用免費開始

視覺化已部署模型隨時間變化的輸出

在這個練習中,你會使用兩個月份(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()
____.____
編輯並執行程式碼