Note that when the input z is a vector or Numpy array, Numpy automatically applies the function sigmoid elementwise, that is, in vectorized form.
We then add a feedforward method to the Network class, which, given an input a for the network, returns the corresponding output* All the method does is applies Equation (22) for each layer:
*It is assumed that the input a is an (n, 1) Numpy ndarray, not a (n,) vector. Here, n is the number of inputs to the network. If you try to use an (n,) vector as input you'll get strange results. Although using an (n,) vector appears the more natural choice, using an (n, 1) ndarray makes it particularly easy to modify the code to feedforward multiple inputs at once, and that is sometimes convenient.
หมายเหตุว่า เมื่อ z อินพุตเป็นเวกเตอร์หรือเรย์ Numpy, Numpy โดยอัตโนมัติใช้ฟังก์ชัน sigmoid elementwise นั่นคือ vectorized แบบนั้นเราเพิ่มวิธีเสียงประเภทเครือข่าย ซึ่ง ให้อินพุตแบบเครือข่าย ผลตอบแทนสอดคล้องกันผลผลิต * วิธีการไม่ได้ใช้สมการ (22) สำหรับแต่ละชั้น: * มันจะสันนิษฐานที่การป้อนข้อมูลเป็นตัว (n, 1) เวกเตอร์ Numpy ndarray ไม่มี (n,) ที่นี่ n คือ จำนวนของอินพุตกับเครือข่าย ถ้าคุณพยายามที่จะใช้ (n), เวกเตอร์เป็นผลอินพุตได้แปลก แม้ว่าการใช้ (n), เวกเตอร์ปรากฏ ตัวเลือกที่เป็นธรรมชาติ ใช้เป็น (n, 1) ndarray ง่ายโดยเฉพาะแก้ไขรหัสเพื่อเสียงอินพุตหลายครั้ง และที่บางครั้งสะดวก
การแปล กรุณารอสักครู่..
