以交叉驗證評估神經網路
為了評估模型,我們會使用獨立的測試資料集。與訓練資料相同,測試資料中的影像在提供給全連接式網路之前也需要重新塑形,因為網路在輸入端預期每個像素對應一個欄位。
你在前一個練習中訓練好的 model,以及 test_data 和 test_labels,都已經在你的工作區可用。
本練習屬於課程
使用 Keras 進行影像建模
練習說明
- 重新塑形
test_data,使其可用來評估模型。 - 使用
test_labels在test_data上評估模型。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Reshape test data
test_data = test_data.____(____, ____)
# Evaluate the model
model.evaluate(____, ____)