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

Output layers

Output layer ก็คือ Dense layer นั่นเอง! Output layer ทำหน้าที่ลดมิติของข้อมูลขาเข้าให้เหลือเท่ากับมิติของข้อมูลขาออก จะได้เรียนรู้เรื่องมิติของ output เพิ่มเติมในบทที่ 4 แต่สำหรับตอนนี้ โครงข่ายประสาทเทียมของเราจะใช้ output เพียงตัวเดียว ซึ่งเทียบเท่ากับ Dense(1) หรือ dense layer ที่มี 1 unit

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

Deep Learning ขั้นสูงด้วย Keras

ดูคอร์ส

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

  • นำเข้าฟังก์ชัน Input และ Dense จาก keras.layers
  • สร้าง input layer ที่มี shape เป็น 1
  • สร้าง dense layer ที่มี 1 unit แล้วส่ง input_tensor เข้าไปโดยตรง

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

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

# Load layers
____

# Input layer
input_tensor = ____(shape=(____,))

# Create a dense layer and connect the dense layer to the input_tensor in one step
# Note that we did this in 2 steps in the previous exercise, but are doing it in one step now
output_tensor = ____(____)(____)
แก้ไขและรันโค้ด