[Advanced Classification] part 5 - 1

2023. 1. 19. 14:16
๐Ÿง‘๐Ÿป‍๐Ÿ’ป์šฉ์–ด ์ •๋ฆฌ

SVM
Hard Margin SVM
Soft Margin SVM
Nonlinear transform & kernel trick

Advanced Classification

 

hyper plane์„ ์ค‘๊ฐ„์— ๊ธ‹๋Š”๋ฐ ๋งŽ์€ ์„ ํƒ์˜ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

 

์—ฌ๋Ÿฌ ๊ฐ€์ง€ hyper plane

์œ„ ์‚ฌ์ง„๊ณผ ๊ฐ™์ด ์—ฌ๋Ÿฌ ๊ฐœ์˜ hyper plane๋“ค ์ค‘์—์„œ๋Š” sample data์—๋Š” ์ ํ•ฉํ•˜์ง€๋งŒ, new test data๊ฐ€ ๋“ค์–ด์™”์„ ๋•Œ, ์ ํ•ฉํ•˜์ง€ ์•Š์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

positive sample๊ณผ negative sample ์‚ฌ์ด์—์„œ ์–ด๋””์— hyper plane์„ ๊ทธ์–ด์•ผ ๊ฐ€์žฅ ์ ํ•ฉํ• ์ง€๋ฅผ ์•Œ์•„์•ผํ•ฉ๋‹ˆ๋‹ค.

 

์ด๊ฒƒ์ด model ์ˆ˜๋ฆฝ์—์„œ ์ค‘์š”ํ•œ ์š”์ ์ž…๋‹ˆ๋‹ค.

 

์ด๋Ÿฌํ•œ ๋ฌธ์ œ๋“ค์„ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด์„œ, 

SVM(Support Vector Machine)

์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

 

SVM์—์„œ๋Š” margin์ด๋ผ๊ณ  ํ•˜๋Š” ๊ฒƒ์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค.

 

์œ„ ๊ทธ๋ฆผ์—์„œ ์ฃผ์–ด์ง„ ์—ฌ๋Ÿฌ hyper plane ์ค‘์—์„œ ์–ด๋–ค ๊ฒƒ์„ ์„ ํƒํ• ์ง€,

 

positive sample์„ ์ง€๋‚˜๋Š” ์„ ๊ณผ negative sample์„ ์ง€๋‚˜๋Š” ์„  ์ค‘์—์„œ ๋‘˜ ์‚ฌ์ด ์„œ๋กœ ๊ฐ„์˜ ์œ„์น˜๊ฐ€ ๋™์ผํ•œ hyper plane์ด ์ด ๋‘˜, positive sample๊ณผ negative sample ์‚ฌ์ด์— ์ตœ๋Œ€ margin์„ ํ™•๋ณดํ•  ์ˆ˜ ์žˆ๋Š” ์ตœ์ ํ™” ๋ฐฉ์‹์ด ๋˜๊ฒŒ ๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค.

 

Support vector machine์—์„œ๋Š” ์ด๋Ÿฌํ•œ ๊ฐœ๋…์„ ์„ค๋ช…ํ•˜๊ธฐ ์œ„ํ•ด์„œ

Support vector

๋ผ๊ณ  ํ•˜๋Š” ๊ฒƒ์„ ์ •์˜ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

 

positive sample๊ณผ hyper plane ์‚ฌ์ด์— ์žˆ๋Š” ๊ฒƒ๋“ค ์ค‘์—์„œ ๊ฐ€์žฅ ๊ฐ€๊นŒ์šด sample๋“ค์„ ์˜๋ฏธํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
๊ฐ€์žฅ ๊ฐ€๊นŒ์šด margin์„ ๊ฐ–๋Š” vector์ž…๋‹ˆ๋‹ค. ์„ฑ๋Šฅ์„ ๊ฐ€์žฅ ์ขŒ์ง€์šฐ์ง€ ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฏผ๊ฐํ•œ data point ์ž…๋‹ˆ๋‹ค.

๋”ฐ๋ผ์„œ, ์šฐ๋ฆฌ๊ฐ€ ํ•ด์•ผํ•  ๊ฒƒ์€,

์ด๋Ÿฌํ•œ Supoort vector๋“ค ๋ผ๋ฆฌ์˜ ๊ฑฐ๋ฆฌ๋ฅผ ๊ฐ€์žฅ ์ตœ๋Œ€ํ™”ํ•˜๋Š” Maximum margin์„ ์„ค์ •ํ•˜๋Š” ๊ฒƒ์ด ์šฐ๋ฆฌ์˜ ์ตœ์ ํ™” ์ „๋žต์ด ๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค.

 

outlier๋“ค์— ๋Œ€ํ•ด์„œ๋„ ์•ˆ์ •์ ์ด๊ฒŒ ํ•˜๋Š” ์ตœ์ ํ™” ๋ฐฉ์‹์ด ๋ฉ๋‹ˆ๋‹ค.

 

๐Ÿ’ก ์–ด๋–ป๊ฒŒ margin์„ ๊ณ„์‚ฐํ•  ์ˆ˜ ์žˆ์„๊นŒ์š”?

 

  • ๊ฐ€์šด๋ฐ์— ์žˆ๋Š” hyper plane์€ h(x) == 0์ธ hyper plane์ž…๋‹ˆ๋‹ค.
  • hyper plane์—์„œ ๊ฐ€์žฅ ๊ฐ€๊นŒ์šด support vector ๊ฐ„ ๊ฑฐ๋ฆฌ๋Š” ํ•œ vector์˜ ๊ธธ์ด์˜ ๋‘ ๋ฐฐ๋ผ๊ณ  ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • model parameter W๋Š” hyper plane์˜ normalํ•œ ๋ฐฉํ–ฅ์œผ๋กœ ์„ค์ •์ด ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

 

margin distance

 

margin, ์ฆ‰ hyper plane์œผ๋กœ๋ถ€ํ„ฐ, ๋–จ์–ด์ ธ ์žˆ๋Š” support vector ๊ฐ„ ๊ฑฐ๋ฆฌ๋ฅผ ์ตœ์†Œํ™”ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” SVM์—์„œ ๋‹ค์–‘ํ•œ ์ตœ์ ํ™” ๋ฐฉ์‹์„ ์ด์šฉํ•ฉ๋‹ˆ๋‹ค.

 

 

Optimization

- Hard Margin SVM

     -> hyper plane์ด ์žˆ๊ณ , support vector๋ฅผ ์ž‡๋Š” ์„  ๋ผ๋ฆฌ ์‚ฌ์ด์˜ ์˜์—ญ์— ๋Œ€ํ•ด์„œ๋Š” ์–ด๋– ํ•œ sample๋„ ์žˆ์ง€ ์•Š๋Š” ๊ฒƒ์„ ์˜๋งˆํ•ฉ๋‹ˆ๋‹ค.

 

- Soft Margin SVM

     -> ์–ด๋Š์ •๋„์˜ error๋ฅผ ์šฉ์ธํ•˜๋Š” ๊ธฐ๋ฒ•

 

- Nonlinear transform & kernel trick

     -> linearํ•œ ๊ฒฝ์šฐ์—๋งŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ์„ ๊ทน๋ณตํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

     -> 2์ฐจ์›์˜ sample๋“ค์„ ๋ณด๋‹ค ๋” ๋†’์€ ๊ณ ์ฐจ์› sample ๋“ค๋กœ mappingํ•˜๋Š” ํ•จ์ˆ˜๋“ค์„ ์ด์šฉํ•ฉ๋‹ˆ๋‹ค.

 

 

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

[Advanced Classification] part 5 - 3  (0) 2023.01.19
[Advanced Classification] part 5 - 2  (0) 2023.01.19
[Linear Classification] part 4 - 3  (0) 2023.01.19
[Linear Classification] part 4 - 2  (0) 2023.01.19
[Linear Classification] part 4 - 1  (2) 2023.01.19

BELATED ARTICLES

more