[Deep Neural Network] part 1 - 1

2023. 1. 22. 12:08
๐Ÿง‘๐Ÿป‍๐Ÿ’ป์šฉ์–ด ์ •๋ฆฌ

Deep Neural Network
Perceptron
Decision Boundary
Input Feature space

 

 

Deep Neural Network (์‹ฌ์ธต ์‹ ๊ฒฝ๋ง)

  • ๋‘๋‡Œ ์† ๋‰ด๋Ÿฐ ํ˜น์€ ์‹ ๊ฒฝ ์„ธํฌ๋ฅผ ๋ณธ ๋”ฐ์„œ, ๊ทธ ์‹ ๊ฒฝ ์„ธํฌ๋“ค์ด ์„œ๋กœ ์—ฐ๊ฒฐ ๊ด€๊ณ„์— ์žˆ์œผ๋ฉฐ ์ •๋ณด๋ฅผ ๋” ๊ณ ์ˆ˜์ค€์˜ ์ •๋ณด๋กœ ์ฒ˜๋ฆฌํ•˜๊ณ  ์—ฌ๋Ÿฌ ์ง€๋Šฅ์ ์ธ task๋ฅผ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋Š” ์‹ ์ฒด ๋‚ด ๋‘๋‡Œ์˜ ๋™์ž‘ ๊ณผ์ •์„ ๋ชจ๋ฐฉํ•˜์—ฌ ์ˆ˜ํ•™์  ์•Œ๊ณ ๋ฆฌ์ฆ˜์œผ๋กœ ๋งŒ๋“  ๊ฒƒ์ž…๋‹ˆ๋‹ค.
  • Deep Learning Algorithm์ด๋ผ๊ณ  ๋ถ€๋ฆ…๋‹ˆ๋‹ค.
  • ํ•™์Šต Data์— ๊ธฐ๋ฐ˜ํ•œ ๊ธฐ๊ณ„ํ•™์Šต Algorithm ์ค‘ ํ•˜๋‚˜์ž…๋‹ˆ๋‹ค.
  • ์‹ ๊ฒฝ ์„ธํฌ ํ•˜๋‚˜๋Š” ๋‹ค๋ฅธ ์‹ ๊ฒฝ ์„ธํฌ๋“ค๊ณผ ์—ฐ๊ฒฐ๋˜์–ด์ ธ ์žˆ์Šต๋‹ˆ๋‹ค.
    • ๋‹ค๋ฅธ ์‹ ๊ฒฝ์„ธํฌ๋“ค๋กœ๋ถ€ํ„ฐ ์ „๊ธฐ ์‹ ํ˜ธ๋ฅผ ์ž…๋ ฅ์œผ๋กœ ๋ฐ›๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
    • ๋‹ค๋ฅธ ์‹ ๊ฒฝ์„ธํฌ๋“ค๋กœ๋ถ€ํ„ฐ ๋„˜์–ด์˜จ ์ „๊ธฐ ์‹ ํ˜ธ๋“ค์„ ์‹ ๊ฒฝ์„ธํฌ ํ•˜๋‚˜์—์„œ๋Š” ํŠน์ •ํ•œ ๊ฐ’์„ ๊ณฑํ•ด์„œ ๋‚˜๋ฆ„์˜ ๋ณ€ํ™˜๋œ ์ „๊ธฐ์‹ ํ˜ธ๋ฅผ ๋˜ ๋งŒ๋“ค์–ด๋ƒ…๋‹ˆ๋‹ค.
    • ์ด ์ „๊ธฐ ์‹ ํ˜ธ๋ฅผ ์‹ ๊ฒฝ์„ธํฌ๊ฐ€ ์—ฐ๊ฒฐ๋˜์–ด ์žˆ๋Š” ๋‹ค๋ฅธ ์‹ ๊ฒฝ์„ธํฌ๋“ค์—๊ฒŒ ์ „๋‹ฌํ•ด์ฃผ๋Š” ๊ณผ์ •์œผ๋กœ ์ง„ํ–‰๋ฉ๋‹ˆ๋‹ค.
    • ์ด ์ž…๋ ฅ ์‹ ํ˜ธ๋ฅผ ์ œ๊ณตํ•ด ์ฃผ๋Š” ์‹ ๊ฒฝ์„ธํฌ๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ์ž…๋ ฅ ๊ฐ’์„ x1, x2, ... ์ด๋ ‡๊ฒŒ ์ •์˜ํ•˜๊ณ , ์ด ์‹ ๊ฒฝ์„ธํฌ๋Š” ์ž…๋ ฅ์— ์–ด๋– ํ•œ ๊ฐ€์ค‘์น˜๋ฅผ ๊ณฑํ•˜์—ฌ, ๊ทธ ๊ฐ’๋“ค์„ ๋‹ค ๋”ํ•˜๊ณ  ์—ฌ๊ธฐ์— ํŠน์ • ์ƒ์ˆ˜๊นŒ์ง€ ๋”ํ•œ ๊ฒฐํ•ฉ์‹์œผ๋กœ ์ƒˆ๋กœ์šด ์‹ ํ˜ธ๋ฅผ ๋งŒ๋“ค์–ด๋‚ด๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
    • ๊ทธ๋ฆฌ๊ณ , ๊ทธ ํ›„, Activation function(ReLU, Sigmoid, tanh ๋“ฑ)์„ ์ตœ์ข…์ ์œผ๋กœ ํ†ต๊ณผํ•ด์„œ ์ตœ์ข… Output์„ ๋งŒ๋“ค์–ด๋ƒ…๋‹ˆ๋‹ค.
    • ์ด ์‹ ํ˜ธ๋ฅผ ๋‰ด๋Ÿฐ์ด ์—ฐ๊ฒฐ๋˜์–ด ์žˆ๋Š” ๋‹ค๋ฅธ ๋‰ด๋Ÿฐ๋“ค์—๊ฒŒ ์ž…๋ ฅ์„ ์ œ๊ณตํ•ด๋‹น ๋‰ด๋Ÿฐ๋“ค์—๊ฒŒ ์ตœ์ข… Output์„ ์ „๋‹ฌํ•ด์ฃผ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
    • ์ด๋Ÿฌํ•œ ๋‰ด๋Ÿฐ๋“ค์ด ๋ชจ์—ฌ ํ•˜๋‚˜์˜ ์‹ ๊ฒฝ๋ง์„ ๊ตฌ์„ฑํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
    • ํ•œ layer์— ์—ฌ๋Ÿฌ ๋‰ด๋Ÿฐ๋“ค์ด ๊ฐ ์ž…๋ ฅ์— ๋Œ€ํ•ด ๊ฐ๊ธฐ ๋‹ค๋ฅธ ์ถœ๋ ฅ์„ ๋‚ด๊ณ , ๊ทธ ์ถœ๋ ฅ์ด ์ž…๋ ฅ์ด ๋˜์–ด ๋‹ค์‹œ ๋‹ค๋ฅธ Layer์— ๋“ค์–ด๊ฐ€๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

 

๋‰ด๋Ÿฐ์˜ ๋™์ž‘ ๊ณผ์ •์„ ์ˆ˜ํ•™์ ์œผ๋กœ ๋ณธ ๋”ฐ์„œ ๋งŒ๋“  Algorithm์„ Perceptron์ด๋ผ๊ณ  ํ•œ๋‹ค.

 

๊ณผ์ •

  • ํ•˜๋‚˜์˜ ๋‰ด๋Ÿฐ์ด ์–ด๋–ค ๋‹ค๋ฅธ ๋‘ ๊ฐœ์˜ ๋‰ด๋Ÿฐ์œผ๋กœ๋ถ€ํ„ฐ ์ž…๋ ฅ ์‹ ํ˜ธ๋ฅผ ๋ฐ›๊ณ  ์žˆ๋‹ค๋ฉด, ๊ทธ ์ž…๋ ฅ ์‹ ํ˜ธ x1, x2๋ฅผ ๋‰ด๋Ÿฐ์ด ์ •๋ณด๋ฅผ ์ž˜ ์ฒ˜๋ฆฌํ•˜์—ฌ ์ถœ๋ ฅ ์‹ ํ˜ธ y๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
  • ๋‚ด๋ถ€์ ์œผ๋กœ W์˜ ๊ฐ€์ค‘์น˜๋„ ๊ฐ€์ง€๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
  • ์ด ํŠน์ • ๋‰ด๋Ÿฐ, perceptron์€ ์ž…๋ ฅ ์ •๋ณด๋ฅผ ๊ฐ€์ค‘์น˜์™€ ๊ณฑํ•˜์—ฌ ๊ฐ€์ค‘ํ•ฉ์„ ๋งŒ๋“ค์–ด๋‚ด๊ณ  Activation function์„ ํ†ตํ•ด ์ตœ์ข… ์ถœ๋ ฅ ์‹ ํ˜ธ๋ฅผ ๋งŒ๋“ค์–ด์ฃผ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
  • ์ด ๋•Œ, ์ถœ๋ ฅ ์‹ ํ˜ธ๋Š” ๊ทธ ๋‹ค์Œ ๊ณ„์ธต์˜ ๋‰ด๋Ÿฐ๋“ค์—๊ฒŒ ํ•ด๋‹น ์ถœ๋ ฅ์„ ์ „๋‹ฌํ•ด์ฃผ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

 

 

 

  • Single Layer Perceptron for AND Gate
  • Single Layer Perceptron for OR Gate
  • Single Layer Perceptron for XOR Gate

 

  • input feature space๋Š” decision boundary์— ๋Œ€ํ•ด์„œ ์–‘๋ถ„๋˜๊ณ , ํ•œ ์ชฝ์€ ์ตœ์ข… Output์ด 1, ๋˜ ๋‹ค๋ฅธ ํ•œ ์ชฝ์€ ์ตœ์ข… Output์ด 0์ž…๋‹ˆ๋‹ค.
  • ๊ทธ๋Ÿฌ๋‚˜ ์œ„ ๊ฒฝ์šฐ XOR problem์—์„œ๋Š” decision boundary์— ๋Œ€ํ•ด Input feature space๋ฅผ ์–‘๋ถ„ํ•  ์ˆ˜ ์—†๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.
    • ์ด๊ฒƒ์„ ์—ฌ๋Ÿฌ ๋‹จ๊ณ„๋ฅผ ๊ฑฐ์ณ์„œ ๊ตฌ์„ฑํ–ˆ์„ ๋•Œ, ์ด XOR problem์„ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. 

 

์ถœ์ฒ˜ : https://medium.com/analytics-vidhya/understanding-basics-of-deep-learning-by-solving-xor-problem-cb3ff6a18a06

 

์„œ๋กœ ๊ฐ๊ธฐ ๋‹ค๋ฅธ ์—ญํ• ์„ ํ•˜๋Š” ์—ฌ๋Ÿฌ ๋‰ด๋Ÿฐ๋“ค์„ ์—ฐ๊ฒฐํ•˜์—ฌ ์—ฌ๋Ÿฌ ๊ณ„์ธต์— ๊ฑธ์ณ์„œ ์ •๋ณด๋ฅผ ์ฒ˜๋ฆฌํ•˜๋Š” neural network๋ฅผ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

๊ทธ๋ฆฌ๊ณ , ์ด๋Ÿฌํ•œ neural network๋Š” ๊ต‰์žฅํžˆ ๋ณต์žกํ•œ task ๋“ค๋„ ๋ฌธ์ œ ์—†์ด ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ๋Š” ๋Šฅ๋ ฅ์„ ๊ฐ€์ง‘๋‹ˆ๋‹ค.

 

 

Neural Network Layer ๊ตฌ์กฐ

 

๊ตฌ์กฐ์— ๋”ฐ๋ผ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ถ€๋ฆ…๋‹ˆ๋‹ค.

 

Input layer   -   Hidden Layer   -   Output Layer

 

-> 1-hidden-layer Neural Network

-> 2-layer Neural Network

 

Input layer   -   Hidden Layer  1  -   Hidden Layer  2   -   Output Layer

 

-> 2-hidden-layer Neural Network

-> 3-layer Neural Network

 

https://playground.tensorflow.org/

 

Tensorflow — Neural Network Playground

Tinker with a real neural network right here in your browser.

playground.tensorflow.org

์œ„ ์‚ฌ์ดํŠธ์—์„œ ์ฃผ์–ด์ง„ task ๋“ค์„ ํ’€ ์ˆ˜ ์žˆ๋‹ค.

'Artificial Intelligence > Deep Learning' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[Training Neural Networks] part 2  (0) 2023.01.24
[Deep Neural Network] part 1 - 2  (0) 2023.01.22
[Machine Learning] ์‹ ๊ฒฝ๋ง ๊ธฐ์ดˆ 1  (0) 2023.01.17
more clever function  (0) 2021.12.19
Supervised learning examples && more clever  (0) 2021.12.16

BELATED ARTICLES

more