욤미의 개발일지
[DAY 6] Linear Algebra: Lecture 14. 선형대수 기초와 선형 시스템 본문
728x90
반응형
[Lecture 14] 선형대수 기초와 선형 시스템
- Scalar: 숫자 하나
- Vector: 숫자 리스트, 크기와 방향을 가지고 있다.
- $\mathbb{R}$ : 실수 전체집합
- $x=\begin{bmatrix} 1\\ 0 \\ 2 \end{bmatrix} \in \mathbb{R}^3$ : 3차원 벡터, 3차원 전체 실수 집합 중 하나
- $A=\begin{bmatrix} 1 & 6\\ 0 & 4 \\ 5 & 2 \end{bmatrix} \in \mathbb{R}^{3 \times 2}$ , 3rows and 2 columns, 3 by 2
- column vector: 수직(vertical) 벡터 → 수직형태가 default vector
- $x=\begin{bmatrix} x_1\\ x_2 \\ \vdots \\ x_n \end{bmatrix} \in \mathbb{R}^n = \mathbb{R}^{n \times 1}$
- row vector: 수평(horizontal) 벡터
- $x=\begin{bmatrix} x_1\\ x_2 \\ \vdots \\ x_n \end{bmatrix}^T =\begin{bmatrix} x_1 & x_2 & \cdots & x_n \end{bmatrix} \in\mathbb{R}^{1 \times n}$
- square matrix: # rows = # columns, 정사각 행렬
- rectangular matrix: # rows ≠ # columns, 직사각 행렬
- $A^T$ Transpose of matrix: 행,열 전환
- $A_{(i,j)}$: 행렬 $A$의 $(i, j)$ 요소
- $A_{i,:}$: 행렬 $A$의 $i$번째 row vector
- $A_{:,i}$: 행렬 $A$의 $i$번째 column vector
- $C = A+B$: element-wise addition
- $c \textbf{a}$: scalar multiple of vector
- $cA$: scalar multiple of matrix, 행렬 $A$의 모든 원소에 상수$c$를 곱해줌
- $C=AB$: matrix-matrix multiple(행렬곱)
- $AB \ne BA$ 행렬곱은 교환법칙이 성립하지 않는다.
- $A(B+C) =AB +AC$ 분배법칙(Distributive)
- $A(BC)=(AB)C$ 결합법칙(Associated)
- $(AB)^T = B^TA^T$(Property of transpose)
Linear System
- linear equation(선형 방정식)
- $a_1x_1 + a_2x_2 + \cdots +a_nx_n =b$
- 차수가 1이어야 한다. $2xy$는 2차
- 계수$a_n$(혹은 가중치)는 실수이다.
- 위의 방정식을 벡터간의 내적으로 간단하게 표현가능 $\textbf{a}^T\textbf{x} = b$
- $\textbf{x}^T\textbf{a} = b$ 도 동일하다.
- Set of linear Equations = linear system 연립방정식
- 연립방정식을 행렬의 곱으로 나타낼 수 있다.$A=\begin{bmatrix} 60 & 5.5 & 1\\ 65 & 5.0 & 0 \\ 55 & 6.0 & 1 \end{bmatrix}$
- $\textbf{x}=\begin{bmatrix} x_1\\ x_2 \\ x_3 \end{bmatrix} \textbf{b}=\begin{bmatrix} 66\\ 74 \\ 78 \end{bmatrix}$
- $60\cdot x_1 + 5.5\cdot x_2 + 1 \cdot x_1 = 66\\ 65\cdot x_1 + 5.0\cdot x_2 + 0 \cdot x_1 = 74\\ 55\cdot x_1 + 6.0\cdot x_2 + 1 \cdot x_1 = 78$
- Identity Matrix(항등 행렬)
- 정사각 행렬, 1과 0으로 구성
- $I_n\textbf{x} = \textbf{x}$
- $I_3 =\begin{bmatrix} 1& 0&0\\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}$
- Inverse Matrix(역행렬)
- 정사각 행렬이며 $A^{-1}$로 표시, 직사각행렬은 X
- $A^{-1}A = AA^{-1} = I_n$
- $A =\begin{bmatrix} a & b\\ c & d \\ \end{bmatrix}$의 역행렬$A^{-1}$ : ${1 \over ad-bc} \begin{bmatrix} d & -b\\ -c & a \\ \end{bmatrix}$
- $A\textbf{x} =\textbf{b}\\A^{-1}A\textbf{x} =A^{-1}\textbf{b}\\ I_n\textbf{x} = A^{-1}\textbf{b}\\ \textbf{x} = A^{-1}\textbf{b}$
- 역행렬이 존재하지 않는 경우
- 예를 들어 $A =\begin{bmatrix} 1 & 2\\ 3 & 6 \\ \end{bmatrix}$은 ${1 \over ad-bc}$ 의 분모가 0이 된다.
- $detA : ad-bc$ 역행렬이 있는지 판별하는데 사용
- 판별식이 0이 X: 역행렬 있음
- 판별식이 0: 역행렬 없음(해가 아예 없거나, 무수히 많거나 둘중하나)$x+2x=4, 3x+6=13$ 직선 평행하고 겹치지 X → 해가 없다.
- $x+2x=4, 3x+6=12$ 직선이 겹침 → 해가 무수히 많다.
- 직사각 행렬
- 미지수 개수 > 방정식 개수: 해가 무수히 많다.(under-determined system)
- regularization을 활용해서 최적의 가중치를 구한다.
- 미지수 개수 < 방정식 개수: 솔루션이 아예 없다.(over-determined system)
- 딥러닝에서는 최대한 근사하도록 함
- 미지수 개수 > 방정식 개수: 해가 무수히 많다.(under-determined system)
728x90
반응형
'NLP > STUDY' 카테고리의 다른 글
[DAY 7] Linear Algebra: Lecture 15. 선형 독립과 선형 변환 (0) | 2022.11.14 |
---|---|
[DAY 5] Python: Lecture 13. Web (0) | 2022.11.07 |
[DAY 5] Python: Lecture 12. Setting & Exception & Logging (0) | 2022.11.06 |
[DAY 5] Python: Lecture 11. IO (0) | 2022.11.03 |
[DAY 4] Python: Lecture 10. String (0) | 2022.11.02 |
Comments