Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python

การสร้างกราฟแสดง Accuracy ระหว่าง Training และ Validation บน IMDB ด้วย TensorFlow


บทนำ

TensorFlow เฟรมเวิร์ก ML จาก Google โค้ดเปิด ใช้กับ Python ใช้ในงานวิจัยและการผลิต

การติดตั้ง

pip install tensorflow

ชุดข้อมูล IMDB

รีวิวหนัง 50,000+ เรื่อง ใช้กับ Natural Language Processing (NLP)

ตัวอย่าง: พล็อต Training vs Validation Accuracy

plt.plot(epochs, acc, 'bo', label='Training acc')
plt.plot(epochs, val_acc, 'b', label='Validation acc')
plt.title('Training and validation accuracy')
plt.xlabel('Epochs')
plt.ylabel('Accuracy')
plt.legend(loc='lower right')
plt.show()

ที่มาโค้ด: TensorFlow Text Classification Tutorial

ผลลัพธ์

การสร้างกราฟแสดง Accuracy ระหว่าง Training และ Validation บน IMDB ด้วย TensorFlow

คำอธิบาย

  • หลัง Fit โมเดลแล้ว ต้องเปรียบเทียบค่าจริงและทำนาย
  • วิธีที่ดีคือ Visualization
  • ใช้ matplotlib พล็อต Accuracy ต่อ Epochs
  • แสดงทั้ง Training และ Validation accuracy