Linear Algebra/Basic_LinearAlgebra(KAIST 기계공학과 윤용진 교수님)

Week 1 : Introduction of AI

지혜의 시작 2022. 6. 19. 16:51
728x90

인공지능이란

1. 인간과 닮은 지능을 가진 기계나 시스템 

2. 목적을 달성하기 위해 만든 인간 지능과 닮은 기술

 

CPU vs GPU

- CPU--> 성능이 좋지만 한번에 하나씩 운반, 하나의 비행기와 비슷 

- GPU--> 단순 연산을 위한 것이지만, 병렬 계산이 가능하여 한번에 여러개를 운반, 여러개의 기차와 비슷 (AI에 적합)

 

4차 산업혁명

: Cyber(AI) x Physical(Factory, home, car...etc)

 

"Traditional Computer Program" vs "Machine Learning"

Data + Program(연산, 함수, 시스템, Matrix) --> Computer --> Output

 

Data + Output --> Computer --> Program(연산, 함수, 시스템, Matrix)

: (3, 5 ==> 8), (2, 3 ==> 5) ====??  The program is 'PLUS'!!!

 

분류, 회귀, 예측(Supervised Learning)

: Label O

 

그룹화, 이상값 탐지(Unsupervised Learning)

: Label X, Data feature가 중요!!

 

강화학습(Reinforcement Learning)

1. Agent--------> Environment : ACTION

2. Environment--------> Agent : STATE

3. 바뀐 state가 내가 원하는 정답에 가까우면 보상을 준다.

 

Artificial Neural Network (인공 신경망, ANN)

Dendrite: 전기적 신호를 통해 입력 신호를 받는 기능을 수행. Artificial neuron에서는 벡터의 형태로 입력된 데이터 x=[x1 x2... xM] 를 전달받는 역할을 함

 

Soma: dendrite를 통해 전달받은 입력을 합산하는 기능을 수행. Artificial neuron에서는 각각의 dendrite의 입력에 weight라고 하는 w=[w1w2...xM] 를 곱하여 합산함. 이때 b는 bias라고 하는 linear function의 상수항.

 

Axon: soma에서 계산된 값을 출력. Artificial neuron에서는 soma에서 출력된 값을 activation function 'f'에 입력하여 계산된 output 'y'를 전달.

 

Single Layer ANN(Shallow NN)

입력층 : 수면시간, 운동시간, 식사량 ; [x1, x2, x3] ----> [6, 3, 2500]

출력층 : 체중, 혈압 ; [y1, y2] ----> [70, 110]

(1x3) [???]  = (1x2) ------> [???] : 3x2의 Matrix

우리가 구해야 하는 것 : [???]

1. 임의추정 : 3x2 matrix에는 6개의 element가 있으므로 6개의 element에 아무거나 넣는다.

2. 추정 출력값을 계산한다. [100, 180]

3. 추정치와 정답 사이의 차이 계산 [100, 180] <----> [70, 110]  

4. matrix의 element를 바꿔가면서 정답과의 차이를 줄여나가는 학습 진행

5. 최적화(미분) 진행 : gradient == 0 <--- 벡터 미적분학 사용!

 

Deep NN

     Input              Hidden1              Hidden2          Output

[x1, x2, x3]  ---->   [A, B]    ---->   [C, D, E, F] ----> [y1, y2]

    (1x3)      (3x2)   (1x2)    (2x4)       (1x4)     (4x2)  (1x2)

                     |---------------------Deep----------------|

 

우리가 구해야 할 Black Box : (3x2), (2x4), (4x2) matrix 총 3개

구하는 방식은 Shallow NN처럼!

 

Support Vector Machine(SVM)

- good generalization performance for classification of highdimensional data sets and its training can be framed as solving a quadratic(2차식) programming Problem.

- Usually we try to maximize classification performance for the training data

- However, if the classifier is too fit for the training data(Overfitting), the [classification ability for unknown data = generalization ability] is degraded

- SVM is trained so that the direct decision function maximizes the generalization ability

- SVM --> Classification Problem

 

Which line will classify the unseen data well?

- 2차원:직선, 3차원:평면, 4차원 이상:Hyperplane

- Hyperplane의 일반식 : W(transpose)X + b = 0

- Where, W : normal vector(법선벡터) of Hyperplane

- b : bias(절편)

 

2차원(x,y) 좌표에서의 직선 : ax+by+c=0

W(transpose) = [a b], X = [x y](transpose), c=b(bias)

 

3차원(x,y,z) 좌표에서의 평면 : ax+by+cz+d=0

W(transpose) = [a b c], X = [x y z](transpose), d=b(bias)

 

Two class Classification Problem

- 두 class를 나누는 hyperplane은 무한히 많다

- 어떤 hyperplane이 가장 좋은 hyperplane인가?

- "좋다"는 것의 기준은?

-->Maximizing margin over the training set 

= good prediction performance

 

So What is Margin?

- SVM에서 어느정도 떨어져있을때 각 그룹에서 제일 처음 만나는 점(SVM과 가장 가까운)들 : Support Vectors(벡터는 공간의 점)

 

- Support Vectors

1. Plus plane(support vector plane에서 +1, W(transpose)X + b = 1)

2. Minus plane(support vector plane에서 -1, W(transpose)X + b = -1)

* Margin : 그 사이의 간격

 

Margin을 최대화 하는 "W(transpose)X + b = 0"을 찾자!

- 점과 직선사이의 거리; Distance of a point (u, v) from Ax+By+C=0, is given by |Au+Bv+C|/||n|| Where ||n|| is norm of vector n(A,B)

- Ax+By+C=0 의 법선벡터 : (A,B)

- Distance of hyperplane from origin = |b| / ||W||

- A, B ==> Support Vectors

- Distance of point A from origin = |b+1| / ||W||

- Distance of point B from Origin = |b-1| / ||W||

- Distance between points A and B (Margin) = 2 / ||W||

 

Margin 최대화 -> 수식

max 2 / ||W|| = min W(transpose)W / 2  : 목적식

W(transpose)W = (||W||)(square) 

결국 우리는 (||W||)(square)를 최소화하는 것과 마찬가지이므로 "Convex quadratic optimization problem"이다!

 

--->> we need Linear Algebra & Vector Calculus

 

728x90