# Neural Network Layers

การทดลองนี้จะปูพื้นฐานความเข้าใจการทำงานของ AI พื้นฐานและการเริ่มต้นทำความเข้าใจการฝึกสอน AI เพื่อเป็นพื้นฐานในคาบต่อๆไป

<figure><img src="/files/xkmPVAy75CQ6Qr8rGWgf" alt=""><figcaption></figcaption></figure>

## Introduction&#x20;

เริ่มทำการปูพื้นฐานเพิ่มความเข้าใจจาคาบที่แล้วกันก่อนในเรื่องของ AI และกระบวนการคิดและการตัดสินใจของ AI ก่อนที่จะทำการทำการแปลงความเข้าใจให้เป็นโค้ดภาษา C จากคาบที่แล้วเราได้รู้จัก AI และประเภทของ AI กันไปแล้ว วันนี้เราจะมาทำความเข้าใจกันในส่วนที่หลายคนอาจสงสัยว่าไอเจ้าก้อนกลมๆที่ยึดโยงกันเป็นโครงข่ายประสาทมันทำงานยังไงเพื่อให้สามารถนำไปต่อยอดงานอื่นๆในอนาคตได้  การทำงานของตัว AI ที่เป็น machine learning หรือ deep learning นั้นจะแตกต่างกันเพียงจำนวนของ hidden layer เท่านั้น ซึ่ง deep learning จะมี hidden layer มากกว่า 2 layer ขึ้นไปโดยจะมีองค์ประกอบดังนี้

<figure><img src="/files/5PbFpDcE5lwWzXJNV3QN" alt=""><figcaption></figcaption></figure>

1. Input layer เป็นชั้นของการรับข้อมูลที่ทำการป้อนเพื่อให้ AI ทำการตัดสินใจหรือเป็นการฝึกสอนให้ AI เข้าใจในสิ่งที่เราสอน
2. Hidden layer เป็นชั้นของการวิเคราห์ข้อมูลซึ่งอาจจะมีการจัดการหรือเตรียมข้อมูลเช่น resize หรือ sorting data เพื่อนำไปทำการ Convolution ในการช่วยให้สามารถตัดสินใจได้ดีขึ้น
3. Output layer เป็นชั้นของการนำข้อมูลที่ผ่านการประมวลผลแล้วไปทำงานในส่วนอื่นต่อ

\
ซึ่งการทำงานเป็นแต่ละ layer แบบนี้เป็นการทำงานในส่วนของ AI ในปัจจุบันโดยจะมีการเติมฟังก์ชั้นที่ช่วยในการจัดการข้อมูล หรือช่วยในการประมวลผลได้ดีขึ้นทั้งในส่วนของชั้นประมวลผล เช่น [Conv](https://machinelearningmastery.com/convolutional-layers-for-deep-learning-neural-networks/), [Gaussian](https://arxiv.org/abs/1904.04620) และชั้นของการนำไปใช้งานต่อ เช่น [Softmax](https://en.wikipedia.org/wiki/Softmax_function),[ReLu](https://machinelearningmastery.com/a-gentle-introduction-to-sigmoid-function/) เป็นต้น&#x20;

\
แต่ก่อนอื่นจะมาทำความเข้าใจพื้นฐานของแต่และเจ้าเม็ดกลมๆ ว่ามันเรียนรู้ยังไงทำไม ซึ่งมันคิดได้เพียงแบบเป็นเหตุเป็นผล ไม่สามารถคิดสร้างสรรค์ได้เหมือนมนุษย์ เพราะว่าพื้นฐานของตัวเจ้าเม็ดกลมๆที่ต่อกันหรือ multi-layer Neural network นั้นมีสิ่งที่เรียกว่า “Backpropagation” โดยเราจะใช้เว็บนี้ประกอบในการสอน -> [Link](https://poloclub.github.io/cnn-explainer/)

<figure><img src="/files/kjStc1p3t7phjf1Gr48V" alt=""><figcaption></figcaption></figure>

ตัวอย่างนี้จะเป็นการอธิบายการทำงาน neural network 3 layer ด้วยอินพุท 2 ตัว โดยในแต่ละ neuron จะประกอบด้วยข้อมูลที่เข้ามา 2 ตัวดังภาพ โดยภายใน f(e) จะถูกเรียกว่า “neuron activation function”

<figure><img src="/files/Sjnsk3KZfhrcc29AmlIe" alt=""><figcaption></figcaption></figure>

โดยการจะสอนให้ neural network เข้าใจในบางสิ่งเราต้องทำการ training ชุดข้อมูลที่เราจะป้อนจากภาพตัวอย่าง

* ชุดข้อมูลที่เราป้อนไปคือ x1,x2&#x20;
* ผลลัพธ์ที่เราคาดหวัง คือ y
* ค่า y=f(e) ซึ่งเป็นค่า non-linear ที่ได้จากผลลัพธ์ของการวิเคราะห์

ในแต่ละรอบจะมีการ weight หรือการปรับข้อมูลให้สามารถรองรับข้อมูลที่เราป้อนหรือข้อมูลใหม่ๆได้&#x20;

<figure><img src="/files/C9TUcqszWyHyVKpREEOT" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/P8hATkViW8B8GKPJ97fl" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/T0mTza3DRRNyzoc40Enr" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/Wn47bKleB6VsOF2HwQZJ" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/tLH3WIvcPcdfAeO7sTWJ" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/dnl8F9em1rKUaA1c7P8t" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/Oa4vcuogi2Uuk1g53AdT" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/RtbLLkqkQ3KYLggeWusN" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/cNA42vIUtLSolC9LR4QU" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/AHhqjydeS7XCpdozG7Wj" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/syyRkVmWmPRhL4fcNhxM" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/mahp1oRdH73uIxRDPCLv" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/ZTzpYZGwibI4h0wbUiIR" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/vFZD0jFtVkajH0XZoEjs" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/dj3L8qyuFD1Z2VVd0wqO" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aic-eec.com/artificial-intelligence-ai/machine-learning/neural-network-layers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
