เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

พล็อตกราฟ Learning Curve

ในระหว่างการเรียนรู้ โมเดลจะบันทึกค่า loss function ที่คำนวณได้ในแต่ละ epoch การดูกราฟ learning curve ช่วยให้เข้าใจกระบวนการเรียนรู้ได้อย่างชัดเจน ในแบบฝึกหัดนี้ จะได้พล็อตกราฟ training loss และ validation loss ของโมเดลที่ฝึกขึ้น

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

การสร้างโมเดลภาพด้วย Keras

ดูคอร์ส

คำแนะนำการฝึกหัด

  • Fit โมเดลกับข้อมูลฝึก (train_data)
  • ใช้ validation split ที่ 20%, จำนวน 3 epochs และ batch size เท่ากับ 10
  • พล็อตกราฟ training loss
  • พล็อตกราฟ validation loss

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

import matplotlib.pyplot as plt

# Train the model and store the training object
training = ____

# Extract the history from the training object
history = training.____

# Plot the training loss 
plt.plot(history[____])
# Plot the validation loss
plt.plot(history[____])

# Show the figure
plt.show()
แก้ไขและรันโค้ด