Class_2022_1

1. 데과기


1.1. Week 1-1


앞으로 다룰 내용 소개

1.1.1. linear algebra

장점: compact representation을 가능하게 해 줌. 예를 들어 선형회귀,linear_regression model with
$\beta_j$ weights, // 가중값,weight
$m$ data points,
$n$ dimensions
의 경우 다음 첫 식을 두번째 식으로 간단하게 표현 가능.
$\sum_{i=1}^m\left( y_i - \left( \beta_0 + \sum_{j=1}^n x_{ij} \beta_j \right) \right)^2$
$||\vec{y}-\vec{X}\vec{\beta}||^2$

In this course, we cover
• Vectors and matrices, their operations
• Span, linear independence, basis, dimension …
• Linear transformations
• Least squares problem
• ...
i.e.
벡터,vector, 행렬,matrix, their operations
생성,span, 선형독립,linear_independence(compare 선형종속,linear_dependence), 기저,basis, 차원,dimension, ...
선형변환,linear_transformation
Srch:least_square


1.1.2. prob / stat

In this course, we cover
• Random variables, probability distribution, expectation, variance
• Common distributions including Bernoulli, Binomial, Geometric,
Poisson, Exponential, Uniform, Gaussian distributions
• Joint and conditional distribution, independency, joint Gaussian
• Basic statistics, confidence interval, hypothesis test, t-test
• …
i.e.
확률변수,random_variable, 확률분포,probability_distribution, 기대값,expected_value, 분산,variance
베르누이_분포,Bernoulli_distribution, 이항분포,binomial_distribution, 기하분포,geometric_distribution, 푸아송_분포,Poisson_distribution, 지수분포,exponential_distribution, 고른분포,uniform_distribution, Gaussian distribution(=정규분포,normal_distribution)
결합확률분포,joint_probability_distribution, Srch:conditional_distribution, 독립성,independence, joint Gaussian
통계,statistics, 신뢰구간,confidence_interval, 가설검정,hypothesis_test, Srch:t-test


1.1.3. multivariable calculus and optimization

In statistics or machine learning, mostly interested in finding models to explain the data
Optimization helps fit machine learning models on the data by choosing the parameters that either maximize or minimize a function like, for example,
• Likelihood of the data // 가능도,likelihood
• Loss function // 손실함수,loss_function
• Error obtained by the model on the (training) data // 오류,error? 오차,error?
• …

In this course, we cover
• Introduction to mathematical programming modeling
• Linear programming and duality // Srch:linear_programming 쌍대성,duality
• Basics of multivariable calculus: derivatives, gradient, Hessian // 미분,derivative, 기울기,gradient, Srch:Hessian
• Convex set and function // Srch:convex_set and 볼록함수,convex_function
• Nonlinear programming, Lagrangian relaxation and KKT conditions
• Numerical optimization algorithms: gradient and Newton’s algorithms // 뉴턴_방법,Newton_method?
• …


1.2. Week 1-2


argmin argmax 는 local에 작성중이고 여기 copy(src: 강의자료)
$\underset{x\in X}{\operatorname{argmin}}f(x):=\left\lbrace x\in X : f(x) \le f(y) \;\forall y\in X \right\rbrace$
$\underset{x\in X}{\operatorname{argmax}}f(x):=\left\lbrace x\in X : f(x) \ge f(y) \;\forall y\in X \right\rbrace$

1.3. Week 2-1

선형방정식,linear_equation
연립일차방정식,system_of_linear_equations
항등행렬,identity_matrix - curr at 단위행렬,unit_matrix
{
Diagonal entries가 모두 1이고 나머지가 모두 0인 정사각행렬,square_matrix.
$I_n\in\mathbb{R}^{n\times n}$
이것은 (행렬에 곱하기 뿐만 아니라) 벡터,vector에 (QQQ 우측에만?) 곱해도 그 벡터를 유지(preserve).
An identity matrix $I_n$ preserves any vector $\vec{x}\in\mathbb{R}^n$ after multiplying $\vec{x}$ by $I_n:$
$\forall\vec{x}\in\mathbb{R}^n,\;\;\; I_n\vec{x}=\vec{x}$
}
역행렬,inverse_matrix
역행렬이 존재하지 않으면? 그 선형방정식계는 해가 없거나 무한히 많은 해가 있다.
선형방정식계 $A\vec{x}=\vec{b}$ 에서, $A$ 가 정사각행렬이 아닌 직사각행렬이라면? $(A\in\mathbb{R}^{m\times n},\;m\ne n)$
방정식,equation의 수 $m$변수,variable의 수 $n$ 에 대해:
$m<n:$ 변수의 수가 더 많음 : 대개, 무한히 많은 해가 있다 - under-determined system
$m>n:$ 방정식의 수가 더 많음 : 대개, 해가 없다 - over-determined system

1.4. Week 2-2

선형결합,linear_combination (of vectors) - 가중값,weight 혹은 계수,coefficient
벡터방정식 form (아래)
생성,span
벡터방정식 해의 보장 조건:
벡터방정식
$\vec{a_1}x_1+\vec{a_2}x_2+\vec{a_3}x_3=\vec{b}$
의 해는 $\vec{b}\in\operatorname{Span}\lbrace\vec{a_1},\vec{a_2},\vec{a_3}}$ 일때만 존재.

Matrix multiplications as Column Combinations
열,column들의 선형결합.
One column on the right
$\begin{bmatrix}1&1&0\\1&0&1\\1&-1&1\end{bmatrix}\begin{bmatrix}1\\2\\3\end{bmatrix}=\begin{bmatrix}1\\1\\1\end{bmatrix}1+\begin{bmatrix}1\\0\\-1\end{bmatrix}2+\begin{bmatrix}0\\1\\1\end{bmatrix}3$
Multi-columns on the right
$\begin{bmatrix}1&1&0\\1&0&1\\1&-1&1\end{bmatrix}\begin{bmatrix}1&-1\\2&0\\3&1\end{bmatrix}=\begin{bmatrix}x_1&y_1\\x_2&y_2\\x_3&y_3\end{bmatrix}=\begin{bmatrix}\vec{x}&\vec{y}\end{bmatrix}$
$\vec{x}=\begin{bmatrix}x_1\\x_2\\x_3\end{bmatrix}=\begin{bmatrix}1\\1\\1\end{bmatrix}1+\begin{bmatrix}1\\0\\-1\end{bmatrix}2+\begin{bmatrix}0\\1\\1\end{bmatrix}3$
$\vec{y}=\begin{bmatrix}y_1\\y_2\\y_3\end{bmatrix}=\begin{bmatrix}1\\1\\1\end{bmatrix}(-1)+\begin{bmatrix}1\\0\\-1\end{bmatrix}0+\begin{bmatrix}0\\1\\1\end{bmatrix}1$
행렬이 왼쪽에, 벡터가 오른쪽에, 이렇게 곱하는 것은 벡터의 열column들을 하나하나씩....? chk
벡터 자리에 행렬이 온다면, 그것들도 열column별로...? chk

Matrix multiplications as Row Combinations
(생략)
행렬이 왼쪽에, 벡터가 오른쪽에, 이렇게 곱하는 것은 벡터의 행row들과 ..? chk
벡터 자리에 행렬이 온다면, 그것들도 행row별로....? chk

1.5. Week 3-1

// 강의자료 Week 3-1 p3 Recall: Linear System
다음 선형계,linear_system
Person ID Weight Height Is_smoking Life-span
1 60kg 5.5ft Yes(=1) 66
2 65kg 5.0ft No(=0) 74
3 55kg 6.0ft Yes(=1) 78

행렬방정식,matrix_equation 표현:
$\begin{bmatrix}60&5.5&1\\65&5.0&0\\55&6.0&1\end{bmatrix}\begin{bmatrix}x_1\\x_2\\x_3\end{bmatrix}=\begin{bmatrix}66\\74\\78\end{bmatrix}$
$A\vec{x}=\vec{b}$

벡터방정식,vector_equation 표현:
$\begin{bmatrix}60\\65\\55\end{bmatrix} x_1 + \begin{bmatrix}5.5\\5.0\\6.0\end{bmatrix} x_2 + \begin{bmatrix}1\\0\\1\end{bmatrix} x_3 = \begin{bmatrix}66\\74\\78\end{bmatrix}$
$\vec{a_1}x_1+\vec{a_2}x_2+\vec{a_3}x_3=\vec{b}$


// p4 Uniqueness of Solution for $A\vec{x}=\vec{b}$ (방정식 $A\vec{x}=\vec{b}$ 에 대한 해,solution유일성,uniqueness)

해는 $\vec{b}\in\operatorname{Span}\lbrace\vec{a_1},\vec{a_2},\vec{a_3}\rbrace$ 일 때만 존재한다.


// p5 Linear Independence
(Practical) Definition:

Given a set of vectors $\vec{v_1},\cdots,\vec{v_p}\in\mathbb{R}^n,$
check if $\vec{v_j}$ can be represented as a linear combination of the previous vectors $\lbrace \vec{v_1},\vec{v_2},\cdots,\vec{v_{j-1}}\rbrace$ for $j=1,\cdots,p,$
e.g.
$\vec{v_j}\in\operatorname{Span}\lbrace \vec{v_1},\vec{v_2},\cdots,\vec{v_{j-1}}\rbrace$ for some $j=1,\cdots,p?$


// p6 Linear Independence
(Formal) Definition:

Consider $x_1\vec{v_1}+x_2\vec{v_2}+\cdots+x_p\vec{v_p}=\vec{0}.$
Obviously, one solution is $\vec{x}=\begin{bmatrix}x_1\\x_2\\ \vdots\\x_p\end{bmatrix}=\begin{bmatrix}0\\0\\ \vdots\\0\end{bmatrix},$
which we call a trivial solution.

  • $\vec{v_1},\cdots,\vec{v_p}$ are linearly independent if this is the only solution.
  • $\vec{v_1},\cdots,\vec{v_p}$ are linearly dependent if this system also has other nontrivial solutions,
    e.g. at least one $x_i$ being nonzero.


// 두 정의는 동등하다.

만약 $\vec{v_1},\cdots,\vec{v_p}$ 이것들이 선형종속이라면, 비자명해를 고려해본다.
In the solution, let's denote $j$ as the last index such that $x_j\ne 0.$
Then, one can write
$x_j\vec{v_j}=-x_1\vec{v_1}-\cdots-x_{j-1}\vec{v_{j-1}},$
and safely divide it by $x_j,$ resulting in
$\vec{v_j}=-\frac{x_1}{x_j}\vec{v_1}-\cdots-\frac{x_{j-1}}{x_j}\vec{v_{j-1}}\in\operatorname{Span}\left\lbrace\vec{v_1},\vec{v_2},\cdots,\vec{v_{j-1}}\right\rbrace$
which means $\vec{v_j}$ can be represented as a linear combination of the previous vectors.

1.6. Week 3-2


1.7. Week 4-2

// 여기엔 임시로. 나중에 최소제곱,least_square으로 mv. //

원래
$A \vec{x} = \vec{b}$
식이 성립하는 것이 이상적인 상황(?) 하지만 x값이 완전하지 않아서 오차,error를 만들기 때문에 이렇게 부등호가 붙는다.
$A \vec{x} \ne \vec{b}$
우리 목표는 최대한 근사,approximation하는 것이다. 이렇게.
$A \vec{x} \simeq \vec{b}$

그리고 여기서 오차(errors - 벡터이므로 복수형?)는
$\vec{b}-A\vec{x}$ 이다.
Now, the SSE - sum_of_squared_error s:
$||\vec{b}-A\vec{x}||$

Definition.
Given an overdetermined system $A\vec{x} \simeq \vec{b}$
where $A\in\mathbb{R}^{m\times n},\; \vec{b}\in\mathbb{R}^n,\;$ and $m\gg n,$
a least_squares solution $\hat{x}$ is defined as
$\hat{x}=\underset{\vec{x}}{\operatorname{argmin}}||\vec{b}-A\vec{x}||$

즉 error_vector 의 노름,norm을 최소화하는 x를 조심스럽게 선택하는 것이 목표.

  • 이 least-squares problem에서 가장 중요한 측면(aspect)은, 어떤 $\vec{x}$ 를 선택하느냐에 상관없이, 벡터 $A\vec{x}$ will necessarily be in the 열공간,column_space $\operatorname{Col}A.$
  • Thus, we seek for $\vec{x}$ that makes $A\vec{x}$ as the closest point in $\operatorname{Col}A$ to $\vec{b}.$

1.8. week 5-1

1.9. week 5-2


1.10. week 6-1

기대값,expected_value
표본평균,sample_mean - 기대값과 다른, 기대값에 가까워질 수 있는 (큰 수의 법칙)
분산,variance

1.11. week 6-2


1.15. Week 9-2

조건부,conditional
조건부확률,conditional_probability
조건부확률분포,conditional_probability_distribution
{
// 데과기 Week 9-2 p2
  • $X|Y=y$ : conditional random variable $X$ given $Y=y$ /// ... (처음 봤을때 잠깐 모호했는데, $(X|Y)=y$ 라는 게 아니라 $X|(Y=y)$ 를 뜻한다)
    Random event of $X$ when $Y$ is determined as $y$
  • Conditional PMF and PDF
    $P_{X|Y}(x|y)$
    $=\text{Pr}[X=x|Y=y]$
    $=\frac{\text{Pr}[X=x,Y=y]}{\text{Pr}[Y=y]}$
    $=\frac{P_{X,Y}(x,y)}{P_Y(y)}$
  • $f_{X|Y}(x|y)$
    $=\frac{f_{X,Y}(x,y)}{f_Y(y)}$
    // conditional pdf = joint pdf / marginal pdf
}
조건부확률질량함수,conditional_probability_mass_function,conditional_PMF
조건부확률밀도함수,conditional_probability_density_function,conditional_PDF
베이즈_정리,Bayes_theorem
{
// 데과기 Week 9-2 p3
$P_{X|Y}(x|y)$
$=\frac{P_{X,Y}(x,y)}{P_Y(y)}$
(여기에 $P_{Y|X}(y|x)=\frac{P_{X,Y}(x,y)}{P_X(x)}$$P_{X,Y}(x,y)=P_{Y|X}(y|x)P_X(x)$ 를 적용하면)
$=\frac{P_{Y|X}(y|x)P_X(x)}{P_Y(y)}$
(여기에 $P_Y(y)=\sum_u P_{X,Y}(u,y)=\sum_u P_{Y|X}(y|u) P_X(u)$ 를 적용하면)
$=\frac{P_{Y|X}(y|x)P_X(x)}{\sum_u P_{Y|X}(y|u) P_X(u)}$

$f_{X|Y}(x|y)$
$=\frac{f_{X,Y}(x,y)}{f_Y(y)}$
$=\frac{f_{Y|X}(y|x)f_X(x)}{f_Y(y)}$
$=\frac{f_{Y|X}(y|x)f_X(x)}{\int f_{Y|X}(y|u) f_X(u) du}$
}
조건부기대값,conditional_expected_value
{
// 데과기 Week 9-2 p4
$\text{E}[X|Y=y]$
$=\sum_x xP_{X|Y}(x,y)$
or
$=\int x f_{X|Y} (x|y)dx$
}
조건부분산,conditional_variance
{
// 데과기 Week 9-2 p4
$\text{Var}[X|Y=y]$
$=\text{E}[(X-\text{E}[X|Y=y])^2|Y=y]$
$=\text{E}[X^2|Y=y]-\text{E}[X|Y=y]^2$
}

Example: when $f_{X,Y}(x,y)=c$ for $0<x<y<2$ and $0$ otherwise, find $c,\;f_{X|Y}(x|y),\;\text{E}[X|Y=y]$

p6부터계속

확률변수의 독립: See 확률변수,random_variable#s-2 and 독립성,independence#s-3
X와 Y가 독립이면 X와 Y는 상관 관계가 없다.
하지만 역은 성립하지 않는다.
상관관계가 없다고 독립인 것은 아니다.

joint Gaussian (normal) distribution - 결합,joint 정규분포,normal_distribution - 결합정규분포,joint_normal_distribution
식이 복잡해서 생략, 3차원 종 모양.
See WpEn:Multivariate_normal_distribution Google:multivariate normal distribution
각각의 marginal도 Gaussian. (i.e. 대충, 종 모양 곡면surface을 두(? 정확히) 평면에서 보면, 종 모양 곡선curve이 나타나는)
성질. X와 Y가 joint Gaussian이면,
  • X도 Y도 Gaussian; 하지만 역은 참이 아님.
    X ~ N(…) and Y ~ N(…)
  • conditional도 Gaussian. X|Y의 경우 평균은 x, y에 모두 영향을 받는데 분산은 y에 무관.
    X|Y = y ~ N((여기 평균 부분에: y에 대한 식이 있음), (여기 분산 부분은: y의 값에 무관))
  • X와 Y의 선형결합 즉 aX+bY도 Gaussian.
    aX+bY ~ N(…)
  • X와 Y가 독립 iff 둘의 (공분산,covariance이 0, 또는 '상관관계가 없음')
    X ⊥ Y ↔ σX,Y=0
    보통 화살표에서 → 부분은 참이지만 ← 부분은 항상 참이 아니다. 하지만 joint Gaussian일 경우 역도 참이 된다.
    즉, joint Gaussian일 때는 독립성과 무상관관계가 동일하다. 이것은 Gaussian이 인기가 있는 이유 중 하나라고.

1.16. Week 10-1

random_sampling (kms: 임의추출, 확률추출)
random_sample (kms: 확률표본, 임의표본)
- RR:i.i.d. RVs from the same population.
- 같은 모집단,population에서 온 iid 확률변수,random_variables들.
표본,sample
통계량,statistic
A statistic is a value calculated from the observed random samples to say something about the whole population.
관찰된 random_samples에서 계산된 값 - whole population에 대해 말하기 위해서.
여기서 something은 보통 mean이나 average. - 평균,mean,average
true_mean = 모평균,population_mean
표본평균,sample_mean
true_variance = 모분산,population_variance σ2
표본분산,sample_variance S2
표본표준편차,sample_standard_deviation
$S=\sqrt{S^2}$
S.D. (줄여서)
S.E. (표준오차,standard_error라고도 한다. - chk: Google:standard.deviation standard.error )
신뢰구간,confidence_interval p7
{
}
표본평균 $\bar{X}$ 의 경우,
$\text{Var}[\bar{X}]=\frac{\sigma^2}{n}$ 여야 하는데
그런데 실제 분산(true variance = 모분산)을 알 방법이 없으므로, 대신 추정된 표본분산으로 추정한다.
$\text{Var}[\bar{X}]=\frac{S^2}{n}$

// Confidence Interval of Sample Mean - 표본평균,sample_mean신뢰구간,confidence_interval - X̅의 C.I.

The sample mean is a common estimator of the true mean.
우리가 관심있는 건 확률이 $p$ 인 신뢰구간 - (p×100)% confidence interval
$p=\text{Pr}\left[\bar{X}-k\frac{s}{\sqrt{n}} < \mu < \bar{X} + k\frac{s}{\sqrt{n}} \right] = \text{Pr}\left[ -k < \frac{\bar{X}-\mu}{\frac{S}{\sqrt{n}}} < k\right]$
True mean(모평균)이 이 구간,interval 안에 들어 있을 확률,probability$p.$
다시 말해 위 식을 한번 더 해석해보면 $\bar{X}$ 가 range [X̅ − k·SE[X̅], X̅ + k·SE[X̅]] 사이에 있을 확률이 p라는 얘기. (SD = SE는 standard deviation = standard error)
By the 중심극한정리,central_limit_theorem,CLT,
$\frac{\bar{X}-\mu}{\frac{S}{\sqrt{n}}}\sim\text{N}(0,1)$
(바로 위에서 한 가정: X̅는 iid인 여러 확률변수들의 합. 식으로 나타내면 →) $\bar{X}=\frac1n\left( X_1+X_2+\cdots+X_n\right)$


$n$ 이 충분히 크지 않으면 정규분포를 따른다고 가정하기 어렵다. i.e. $t=\frac{\bar{X}-\mu}{S/\sqrt{n}}$ is not normal.
t분포,t-distribution가 이를 위해 개발된 것.
t분포는 $n$ 에 대한 parameter를 갖는다. 보통 $n-1$ 을 매개변수로 한다. 이것은 자유도,degree_of_freedom이다.
$t\sim \text{T}(n-1)$
t분포에서 $n$ 이 무한으로 가면 표준정규분포,standard_normal_distribution와 같다.

1.17. Week 10-2

가설검정,hypothesis_test
귀무가설,null_hypothesis
영분포 null_distribution
영가설(귀무가설)이 참일 때 모집단? 전체집단? 의 분포
a distribution of the whole population when the null hypothesis is true
대립가설,alternative_hypothesis

오류,error
type_1_error
null hypothesis가 사실 참인데, 기각해버리는 오류.
Type 1 error의 확률 = $\alpha$ = level of significance. // 유의수준,significance_level (자막에선 '중요도 수준')
보통 1% level, 5% level and 10% level을 사용함.
Significance level이 높으면, type I error의 확률도 커짐.

p값,p-value = 유의확률,significance_probability - WpKo:유의_확률
(자막) 영분포,null_distribution에서 관측 값을 초과하는 통계량,statistic이 나올 확률 - CHK
the probability that a statistic exceeding the observed one (toward the alternative hypothesis) is from the null distribution
(from other source) 귀무가설이 맞다고 가정하고 얻는 (가상의?) 결과보다, 극단적인 결과가 (실제로) 관측될 확률.

유의수준,significance_level을 정해 놓고 (보통 5% = 0.05)
그것과 p값을 비교하는 것이다.
(이하 단측검정만 고려한 서술)

이하 두 줄 not sure; chk, 정확히.
p 값이 낮으면/작으면 - 영분포를 따른다는 가정 하에(영가설이 맞다는 가정 하에) - 그걸 벗어나는 극단적인 경우가 충분히 있음 significant - 영가설을 거부/기각. and 대립가설을 채택.
p 값이 높으면/크면 - 영분포를 따른다는 가정 하에(영가설이 맞다는 가정 하에) - 그걸 벗어나는 극단적인 경우가 충분하지 않음 not significant - 귀무가설을 기각하지 않음. (and 대립가설을 기각?)
암튼 확실한 것은
유의수준,significance_level의 값과 p값,p-value을 비교해서
p값이 작다 - 귀무가설을 기각
p값이 크다 - 귀무가설을 기각하지 않음

생각: p값이 단순히 작다 크다로 생각하면 헷갈리고, 거기에 추가해 얼마나 deviate되었느냐(얼마나 significant한가)로 생각해야 덜 헷갈리는 듯?

1.19. Week 11-2

p4

최적화 모형의 구성요소 네 가지
  • 결정변수,decision_variable
    Controllable variables (decision maker가 제어 가능)
  • 목적함수,objective_function (of the decision variables)
    Measure(s) to evaluate system performance
  • 제약,constraint
    Restrictions on the decision variables
    Restricted by business or physical rules - 예를 들어 생산량은 반드시 0 혹은 그 이상
  • 매개변수,parameter
    Uncontrollable variables - 제어할 수 없음
    최적화에서 매개변수란, 일반적으로 수리계획법 모델 상에서의 상수값들을 뜻한다.
    (반면, 통계 혹은 머신러닝에서 매개변수란 그 모형의 일부 수치적 특성을 뜻한다. 예를 들어 정규분포,normal_distribution는 평균 μ와 표준편차 σ로 특징지어지는데, 이 μ와 σ가 바로 매개변수.)

최적화는 최적화모형,optimization_model을 통해,
모든 제약식(제약,constraint 식,expression)들을 만족하는
의사결정변수(결정변수,decision_variable)값 들 중에서
목적함수,objective_function를 최대화 혹은 최소화하는 의사결정변수 값을 결정한다.


p6

$\bar{x}=x_1,x_2,\cdots,x_n$ : set of decision variables - 결정변수,decision_variables들의 집합
$f(\bar{x})$ : 목적함수,objective_function
그리고 제약 함수 constraint_function 들이 있다, 예를 들어
$g_i(\bar{x})\le G_i$
$h_j(\bar{x})=H_j$
$l_k(\bar{x})\ge L_k$
그리고 $\bar{x}$ 는 이 모든 조건들을 만족해야 한다.
그럴 때,
Find $\bar{x}$ to maximize(or minimize) $f(\bar{x})$ subject to (저 조건들).


p7

feasible solution - 자막에선 '실행가능해'로 번역 ... 해,solution
$\bar{x}=(x_1,x_2,\cdots,x_n)$ 이 모든 제약조건을 만족.
feasible set
set of all feasible solutions
optimal solution $\bar{x}^*$
feasible solution임과 동시에,
$f(\bar{x}^*) \le f(\bar{x})$ for every feasible solution $\bar{x}$ for minimization problem // minimization_problem


p8

선형함수,linear_function
(여기서 말하는) 선형함수는 a 다항식,polynomial of degree one or less
그리고 그 그래프는 직선straight_line.

$f(x)=ax+b$
$f(x_1,\cdots,x_k)=a_1x_1+\cdots+a_kx_k+b$

식에서
$a,a_1,\cdots,a_k,b$ : 상수,constant
$x,x_1,\cdots,x_k$ : 변수,variable


p9

수리계획법에는 다양한 모형들이 있지만, 본 과목에선 다음 세 가지 유형에 대해서만 다룬다.
정수계획법(IP)은 선형계획법(LP)과 거의 같은데 차이는
즉 의사결정변수가 실수값만을 허용하는가, 정수값도 허용하는가 여부.


p10

비선형계획법의 예 examples of non-linear programming

quadratic programming
Minimize
$\sum_{j=1}^n c_j x_j + \sum_{i=1}^m \sum_{j=1}^n q_{ij} x_i x_j$
subject to
$\sum_{j=1}^n a_{ij} x_j = b_i \;\;\;(i=1,2,\cdots,m)$
$x_j \ge 0 \;\;\;(j=1,2,\cdots,p)$
2차 계획법: 두 결정변수의 곱 $(x_ix_j)$ 으로 되어 있다는 의미.

quadratic constrained programming
Minimize
$\sum_{j=1}^n c_j x_j + \sum_{i=1}^m \sum_{j=1}^n q_{ij} x_i x_j$
subject to
$\sum_{j=1}^n a_{ij} x_j + \sum_{i=1}^m \sum_{j=1}^n h_{ij} x_i x_j = b_i \;\;\;(i=1,2,\cdots,m)$
$x_j\ge 0 \;\;\;(j=1,2,\cdots,p)$
2차 제약조건 계획법: 목적함수 및 제약식 내 함수들이 모두 2차식인 경우. (quadratic objective and quadratic constraints)



p11

제약,constraint의 세 유형
  • less-than (≤) constraints
    자원resources이나 용량capacities의 가용성availability을 표현
    (e.g.) Number of products in production ≤ production capacity
    ex. 생산중인 제품 수 ≤ production capacity (생산최대량?)
    자막 - '생산량은 생산용량보다 작거나 같다'같이 나타낼 수 있는데 이는 생산용량보다 많이 생산을 할 수 없기 때문.
  • greater-than (≥) constraints
    문턱threshold이나 commitments를 표현
    자막 - 충족시켜야 하는 한계점 혹은 일종의 약속 등을 나타낸다.
    (e.g.) Number of products produced ≥ number of products ordered
    ex. 생산된 제품 수 ≥ 주문받은 제품 수
    자막 - '생산량은 주문량보다 크거나 같다'로 표현할 수 있는데, 이는 수요를 만족시키기 위해서는 수요량 이상 생산이 이루어져야 하기 때문.
  • equal-to (=) constraints
    balance나 consistency를 표현
    자막 - 균형 또는 일관성을 나타냄
    (e.g.) Products manufactured + products purchased = products in stock
    자막 - '(생산량 + 구매량)은 현 재고량과 같다'고 나타낼 수 있다


p12

2차함수quadratic_function가 있을 때 최적화
https://i.imgur.com/t7XdhKy.png


(그림 왼쪽)
여기서 의사결정변수(결정변수,decision_variable) : $x$
이차함수(목적함수,objective_function)는 $(x-2)^2+1$
그리고 $x\in\mathbb{R}$ 이고 그 외의 constraint는 없다.

(그림 오른쪽)
기계학습,machine_learning 기법 중 하나인 서포트벡터머신,support_vector_machine,SVM 기법을 수리계획법 모형으로 표현한 예시.
목적함수는 두 벡터의 곱 - 2차함수quadratic_function.
아랫줄은 제약조건.
SVM은 앞서 살펴본 비선형계획법 중 2차계획법 모형임을 알 수 있다.


p13

선형회귀,linear_regression 예.
일반적으로 선형함수linear_function는
$\hat{y}=\beta_0+\beta_1 x$
여기서
$x$ : 변수
$\beta_0$ : y절편
$\beta_1$ : 기울기,slope
직선을 찾는다는 것은 $\beta_0$$\beta_1$ 의 값을 찾는다는 것과 동일.
산점도 내 data points와 추정회귀선 사이 거리를 계산하는 방식은 다양 - 가로로(수평거리), 세로로(수직거리), 회귀선에 수직인 거리.
예측오차,prediction_error(예측,prediction 오차,error)는 위에서 두번째인 수직 거리.
Data point 중에서 $(6,2.5)$ 를 예로 들면, 오차 계산은 다음과 같이 한다.
$\epsilon=2.5-(\beta_0 + 6\cdot\beta_1)$
예측오차들의 합,sum을 근접성closeness을 평가하는 지표measure(측도,measure)로 활용할 수 있다.
추정회귀선보다 data point가 위에 있으면 양의 오차
추정회귀선보다 data point가 밑에 있으면 음의 오차
이것을 그냥 더하게 되면 서로 상쇄되어 예측오차들의 합을 과소평가하게 되는 상황이 발생 가능하므로 오차의 절대값,absolute_value이나 제곱,square을 사용.

1.20. Week 12-1

선형계획법,linear_programming - 수리계획법의 특별한 경우로,
  • 단일 목적함수
  • 제약 식 함수가 모두 선형
  • 모든 결정변수가 실수
  • <, > 안됨. ≤ ≥ = 만 됨.

LP Example 1 - Product-mix Problem
공장 생산라인에서 P, Q를 각각 몇개 생산해야 하는가
Google:product-mix.problem

LP Example 2 - Diet Problem - 1930-40년대 최초의 LP 응용 사례
최소 비용으로 꼭 필요한 영양분nutrient을 충족시키려면 어떤 음식들을 사야 하는가
Google:diet.problem

선형프로그래밍 SW에는 Google:CPLEX, Google:Gurobi등이 있으며 R, Excel도 사용 가능.

1.21. Week 12-2


// Motivation
어떤 feasible_solution을 찾았다. objective_function 값이 124인. 그런데 최적의optimal objective_function 값은 모른다.
이 상황에서 최적값이 가질 수 있는 상한값 150을 누군가 찾았다. - 여기서 알 수 있는 것은 최적값이 124와 150 사이에 있다는 것.
이 상황에서 최적값의 상한값 142를 누군가 찾았다. - 상한값이 updated - 최적값은 124와 142 사이에 있다.
그 다음에 최적값의 상한값이 124임을 누군가 찾았다. - 최적값이 바로 124임을 찾았다.
따라서 최대화,maximization 문제에서는 최대한 낮은 상한값upper_bound 정보를 찾는 것이 중요하다.
(maybe rel. 해석학에서 상계,upper_bound. 그리고 최저의 상한값 = 최소상계 = least upper bound = lub = 상한,supremum)

이하 부등식들을 조작하여 UB(upper bound)를 줄여가는 예제,
duality 설명,
duality theorems: 대충,
  • weak_duality - 부등식이 성립하는
  • strong_duality - 등식이 성립하는
  • complementary_slackness
    • 원 문제의 제약과 연관된 쌍대변수 값이 0이 아니면, 원 문제 제약은 등식을 만족해야
    • 한 제약이 등식을 만족하지 않으면, 이 제약에 상응하는 쌍대변수는 0이어야
optimality_condition

1.22. Week 13-1


The 1st order (linear) approximation of $f$ at $x_0$ // 선형근사,linear_approximation
$f(x) \approx f(x_0) + f'(x_0) (x-x_0)$ where $x \approx x_0$

The 2nd order (quadratic) approximation of $f$ at $x_0$ // quadratic_approximation
$f(x) \approx f(x_0) + f'(x_0) (x-x_0) + \frac{f''(x_0)}{2} (x-x_0)^2$ where $x \approx x_0$


기울기,gradient
Suppose $f:\mathbb{R}^n \to \mathbb{R}$
Gradient $\nabla f(\vec{x})$
$\nabla f = \left[ \frac{\partial f}{\partial x_1} \; \cdots \; \frac{\partial f}{\partial x_n} \right]$
  • A vector containing the partial derivatives of the function $f$ at certain point $\vec{x}$
  • 가장 가파른 상승steepest ascent방향,direction (i.e., 함수 $f$ 의 최대 증가maximum increase) from $\vec{x}$
    따라서, $-\nabla f$ 는 가장 가파른 하강steepest descent의 방향(최대 감소maximum decrease)

Hessian, 헤세_행렬,Hessian_matrix
Suppose $f:\mathbb{R}^n \to \mathbb{R}$
$\nabla^2 f = \begin{bmatrix}\frac{\partial^2 f}{\partial x_1^2}&\cdots&\frac{\partial^2 f}{\partial x_1\partial x_n}\\ \vdots & \ddots & \vdots \\ \frac{\partial^2 f}{\partial x_n\partial x_1}&\cdots&\frac{\partial^2 f}{\partial x_n^2}\end{bmatrix}$

테일러_정리,Taylor_theorem
Suppose $f:\mathbb{R} \to \mathbb{R}$ (일변수함수의 경우,)
$f(x)=c_0+c_1(x-x_0)+c_2(x-x_0)^2 + c_3(x-x_0)^3 + \cdots$
한 번 미분해보면 $f'(x)=c_1+2c_2(x-x_0)+\cdots$ 이므로 $x$$x_0$ 를 대입하면 $f'(x_0)=c_1,$
두 번 미분해보면 $\cdots$ 등등 이렇게 계수를 정할 수 있으므로
$f(x)=f(x_0)+\frac{f'(x_0)}{1!}(x-x_0) + \frac{f''(x_0)}{2!} (x-x_0)^2 + \frac{f'''(x_0)}{3!} (x-x_0)^3 + \cdots$

Suppose $f:\mathbb{R}^n \to \mathbb{R}$ (다변수함수의 경우로 확장하면,)
$f(\vec{x})=f(\vec{x_0}) + \nabla f (\vec{x_0})(\vec{x}-\vec{x_0}) + \frac12 (\vec{x}-\vec{x_0})^T \nabla^2 f(\vec{x_0})(\vec{x}-\vec{x_0})+\cdots$
이렇게 gradient와 Hessian 등이 들어간다.

1.23. Week 13-2

볼록집합,convex_set
볼록성,convexity
A set of points 𝑋 is a convex set if every line segment joining two points of the set 𝑋 is entirely in the set.
A set $S$ is convex if
$tx+(1-t)y \in X$
$\forall x,y\in X,$ and $\forall t\in[0,1].$

볼록집합의 성질
  • X가 볼록이면, ∀a, {x+a|x∈X}도 볼록.
  • X가 볼록이면, ∀a, {ax|x∈X}도 볼록.
  • X와 Y가 볼록이면, X∩Y도 볼록.


볼록함수,convex_function
$f(x)$ is convex if
$f(tx_1+(1-t)x_2) \le tf(x_1)+(1-t) f(x_2)$
for any $x_1,x_2$ and $t\in[0,1]$
그래프에서는 $x_1,x_2$ 를 잇는 할선,secant_line(RHS)이 항상 $x_1,x_2$ 사이의 함수 그래프(LHS) 위에 있는.


Convex function over $X$ .....X 위로의 볼록함수?
$f(x)$ is convex over $S$ if
$f(tx_1+(1-t)x_2) \le tf(x_1)+(1-t) f(x_2)$
for any $x_1,x_2$ $\color{red}\in X$ and $t\in[0,1]$

...(some skips, tbw. or remove this line.)...



다변수함수 multivariable_function $f(\vec{x})$ for $\vec{x}\in X$ 를 고려한다.
이것의 헤세_행렬,Hessian_matrix이 모든 $\vec{x}\in X$ 에 대해 존재한다면,
  • $f(\vec{x})$ is strictly convex over $X$
    if its Hessian matrix is positive definite for any $\vec{x}\in X$
  • $f(\vec{x})$ is convex over $X$
    if its Hessian matrix is positive semi-definite for any $\vec{x}\in X$
  • $f(\vec{x})$ is strictly concave over $X$
    if its Hessian matrix is negative definite for any $\vec{x}\in X$
  • $f(\vec{x})$ is concave over $X$
    if its Hessian matrix is negative semi-definite for any $\vec{x}\in X$

(tmp, tip) 특정 행렬의 PD/PSD/... 여부 파악:
[https]{{1,1},{1,1}} positive definite

..... 주소행렬식,principal_minor note.txt에 작성중. .....
{ // tmp, delme
주 소행렬식

nxn행렬의 주소행렬식은
1st principal minor(s),
2nd principal minor(s), ...,
n-th principal minor 이렇게 있다.
이것들은 각각 1x1, 2x2, ..., nxn 행렬의 행렬식이다.

행렬 H의 k번째 주소행렬식 $\Delta_k$
(n-k) 행과
(n-k) 열을 삭제하여 얻는 $k\times k$ 행렬의 행렬식,determinant과 같다.

leading_principal_minor =,leading_principal_minor .
{
주 소행렬식중 특별히 '선도 주 소행렬식'이 있고 D_k 로 표기.

마지막 행과 열을 삭제하여 만드는.

// 데과기 13-2 35:50
The k-th leading principal minor of matrix H (denoted by D_k)
is the determinant of k×k matrix
obtained by deleting the last (n-k) rows and the last (n-k) columns of the matrix.


// 38m
H가 n×n 대칭행렬,symmetric_matrix이라 하면,
  • H is positive definite iff
    $D_k>0$ for all leading principal minors
  • H is positive semi-definite iff
    $\Delta_k\ge 0$ for all principal minors
  • H is negative definite iff
    $(-1)^k D_k > 0$ for all leading principal minors
  • H is negative semi-definite iff
    $(-1)^k \Delta_k \ge 0$ for all principal minors

} // leading_principal_minor
} // principal_minor

1.24. Week 14-1


Optima: Minima, Maxima

최적,optimum
{
pl. optima

Sub:
국소 최적 - 국소최적,local_optimum
local_minimum
local_maximum
전역 최적 - 전역최적,global_optimum
global_minimum
global_maximum
}

Suppose:
feasible_set $(X\in\mathbb{R}^n)$ 에서 실수 $(\mathbb{R})$ 로 가는 함수 $f$ 를 가정.
$f:\mathbb{R}^n \to \mathbb{R}$

근방,neighborhood이란:
$x_0\in\mathbb{R}^n$ 에 대해, 그 근방 $B(x_0,\epsilon)$ 은 다음과 같은 공,ball이다.
$\left\lbrace x\in\mathbb{R}^n \, : \, ||x-x_0|| \le \epsilon \right\rbrace$

local_minimum:
어떤 근방 $B(x,\epsilon)$ 안에서
모든 $y\in X$ 에 대해
$f(x)\le f(y)$ 이면
$f$local minimum$x.$

local_maximum: // (위와 부등호 방향만 반대)
어떤 근방 $B(x,\epsilon)$ 안에서
모든 $y\in X$ 에 대해
$f(x)\ge f(y)$ 이면
$f$local maximum$x.$

local_extremum (pl. local extrema)은 그것의 근방,neighborhood 안에서 최고의 해(best solution)이다.

(당연하지만)
global_minimum 은 local_minimum 들 중에서 찾는 것.
global_maximum 은 local_maximum 들 중에 있는 것.


Stationary Points and Local Optima

정류점,stationary_point (writing, 나중에 저기로 copy)

• For a single variable function 𝑓(𝑥), 𝑥0 is a stationary point if
𝑓′(𝑥0) = 0
• For a multi-variable function 𝑓(𝒙), 𝒙𝟎 is a stationary point if
𝛻𝑓(𝒙𝟎) = 𝟎

각각
기울기,slope = 0
기울기,gradient = 0 ? chk

• For a single variable function 𝑓(𝑥),
• Stationary point 𝑥0 with 𝑓′′(𝑥0) > 0 must be a local minimum
• Stationary point 𝑥0 with 𝑓′′(𝑥0) < 0 must be a local maximum
• For a multi-variable function 𝑓(𝒙), // 헤세_행렬,Hessian_matrix을 가지고 판별. 𝛻2라플라시안,Laplacian이 아니고 헤시안임.
• Stationary point 𝒙𝟎 with positive definite 𝛻2𝑓(𝒙𝟎) must be a local minimum
• Stationary point 𝒙𝟎 with negative definite 𝛻2𝑓(𝒙𝟎) must be a local maximum


Saddle Points

안장점,saddle_point: A 정류점,stationary_point that is neither local maximum nor local minimum.

...

다음 constrained NLP를 생각
Maximize $z=f(\vec{x})$
Subject to $g_j(\vec{x}) \le b_j \;\;\;\text{for }\; j=1,2,\ldots,k$
그러면 NLP의 Lagrangian function은 이렇게 정의.
$L(\vec{x},\vec{\lambda})=f(\vec{x})+\sum_{j=1}^k \lambda_j \left[ b_j - g_j(\vec{x}) \right]$ with $\lambda_j \ge 0$ for $\forall j$
우변의 오른쪽의 시그마 항은 'penalty term'으로 해석된다.


Karush-Kuhn-Tucker (KKT) Conditions


한 점 $\vec{x_0}$ 는 다음 네 가지가 만족하면 KKT조건을 만족하는 것.

$\bullet\;\nabla f(\vec{x_0})-\sum_{j=1}^k \lambda_j \nabla g_j (\vec{x_0})=0$
$\leftarrow \; \nabla_x L(\vec{x},\vec{\lambda})=0$

$\bullet\;\lambda_j\left( b_j - g_j(\vec{x_0}) \right) = 0$
$\bullet\;\lambda_j \ge 0$
$\text{for }\;j=1,2,\cdots,k$ (feasibility constraint)

$\bullet\;g_j(\vec{x_0}) \le b_j$
$\text{for }\;j=1,2,\cdots,k$ (feasibility constraint)

모든 NLP에서 최적,optimum은 KKT조건을 만족.
KKT조건을 만족한다고 해서 항상 최적인 것은 아님. (e.g. 안장점,saddle_point)
i.e.
어떤 조건을 만족하면 충분조건,sufficient_condition이 될 수 있음. - tbw

1.25. Week 14-2