๐ฌ ML & Data
[๋ผ์ดํธ ๋ฅ๋ฌ๋] n. Backpropagation ์์ ํ์ด ๋ฐ ๊ฒ์ฆ
์ถ์ฒ: https://mattmazur.com/2015/03/17/a-step-by-step-backpropagation-example/ A Step by Step Backpropagation Example Background Backpropagation is a common method for training a neural network. There is no shortage of papers online that attempt to explain how backpropagation works, but few that include an example… mattmazur.com feed forward ๊ณ์ฐ 1. h1 ๊ตฌํ๊ธฐ $$net_{h1} = 0.05 * 0.15 + 0.1 * 0.2 + 0.35..
[MPC] 4. Optimal Control(2) - Taylor Series ์ ์ฉ, Algebraic Riccati Equation(ARE) ๊ตฌํ๊ธฐ
LQR์ ์ ์ฉ $$V^{*}(x(t), t) = \underset{u[t, t+\Delta t]}{min} \{ \Delta t \cdot l[x(t + \alpha \Delta t), u(t + \alpha \Delta t), t + \alpha \Delta t] + V^{*}(x(t + \Delta t), t+\Delta t) \}$$ ์ด ์์์ $V^{*}(x(t + \Delta t), t+\Delta t)$ ๋ถ๋ถ์ ์ Taylor Series๋ก x์ t์ ๋ํด์ ์ ๋ฆฌํด๋ณด์. $x = (x(t), t), v = \Delta t$ ๋ผ๊ณ ์๊ฐํ์. ์ ๋ฆฌํ๋ฉด ์๋์ ๊ฐ๋ค. $$V^{*}(x + v) = V^{*}(x) + f'(x)v + f(x)v' + \frac 12 f''(x)v^{2}+ \frac1..
[MPC] 4. Optimal Control(1) - LQR๊ณผ Taylor Series(ํ ์ผ๋ฌ ๊ธ์)
optimal control ๊ธฐ์ด - LQR(Linear Quadratic Regulator) LQR์ด ๊ธฐ์ด๋ผ์ ์๊ฑธ๋ก system : $\dot x = f(x, u, t), x(t_{0}) = x_{0}$ cost function : $$V(x(t_{0}), u, t_{0}) = \int_{t_{0}}^{T} l[x(\tau), u(\tau), \tau]d\tau + m(x(T))$$ ์ cost function์ ์ต์ํํ๋ ์ ๋ ฅ $u^{*}(t), t_{0}\le t \le T$ ์ฐพ๊ธฐ -> optimal control์ ๋ชฉ์ principle of optimality ์ ๋ฐ๋ผ ํ ํด๊ฐ ์ต์ ์ด๋ฉด sub problem์ ํด๋ ์ต์ ์ด ๋๋ค. $t_{0} < t < t_{1} < T$ ๋ก $t_{1}$ ์ถ๊ฐ..
[MPC] 3. ์ํ(state)์ ์ถ๋ ฅ(output) ์์ธกํด๋ณด๊ธฐ
Input / Output ์ ๋ฆฌ $N_p$ : ์์ธกํ๋ ค๋ ๋ฏธ๋ ์ถ๋ ฅ ์ $N_c$ : ์์ธกํ๋ ค๋ ๋ฏธ๋ ์ ์ด์ ๋ ฅ ์ ๊ฒฝ๋ก ์ถ์ ์ ๊ฒฝ์ฐ, $N_p$๊ฐ ์ ์ tracking ํ๊ธฐ ์ํ $N_c$๊ฐ ์ ์ด ๋ช ๋ น... Control Input $\Delta u(k), \Delta u(k+1), \Delta u(k+2), \cdots, \Delta u(k + N_{c} - 1)$ Output $y(k), y(k+1), \cdots, y(k+N_{p})$ $y(k) = Cx(k)$ ์ด๋ฏ๋ก $y(k+1) = Cx(k+1), y(k+2) = Cx(k+2), \cdots$ ๋ก ํํ ๊ฐ๋ฅ ๋ฐ๋ผ์ ์์ธก state $x(k+1), x(k+2), \cdots, x(k+N_{p})$๋ฅผ ๊ตฌํ๋ฉด ๋จ State variable ๊ตฌํ๊ธฐ $..
[MPC] 2. ์ํ ๊ณต๊ฐ ๋ฐฉ์ ์ ์ ๋
MPC ์ํ ๊ณต๊ฐ ๋ฐฉ์ ์ ์ ๋ ์ํ๊ณต๊ฐ ๋ฐฉ์ ์ + LTI(Linear TimeINvariant, ์ ํ ์๊ฐ ๋ถ๋ณ ์์คํ )์ ๊ฒฝ์ฐ => Continuous-time state-space model ์ํ ๋ฐฉ์ ์ : $$\bar{x} = Ax + Bu$$ ์ถ๋ ฅ ๋ฐฉ์ ์ : $$y = Cx$$ MPC๋ discrete ํ ํ๊ฒฝ => Discrete-time state-space model ์ํ ๋ฐฉ์ ์ : $$x(k+1) = A_{d}x(k) + B_{d}u(k)$$ ์ถ๋ ฅ ๋ฐฉ์ ์ : $$y(k) = C_{d}x(k)$$ MPC ๊ธฐ๋ณธ ๋ชจ๋ธ์ Discrete-time aumented state-space model ์ํ ๋ณ์ ๋์ ์ํ ๋ณ์์ ๋ณํ๋ $\Delta x$ ์ฌ์ฉ ์ํ ๋ฐฉ์ ์ $${x(k+1) - x(k) ..
[MPC] 1. Model Predictive Control Intro
์ ํ๋ธ https://www.youtube.com/watch?v=zU9DxmNZ1ng&list=PLSAJDR2d_AUtkWiO_U-p-4VpnXGIorrO-&index=1 ๋ธ๋ก๊ทธ https://sunggoo.tistory.com/65 ์ ์๋ฃ๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ๊ณต๋ถํ ๋ด์ฉ์ ๊ฐ๋ณ๊ฒ ์ ๋ฆฌํ๋ ค๊ณ ํฉ๋๋ค. ์์ ์ฆ๋ช ์ด ๋ง๊ฒ ๊ณ , ๊ทธ ๋ค๋ก๋ ๋ชฉ์ ์ ๋ฐ๋ผ ๋ ผ๋ฌธ์ด๋ ์ฝ๋ ๊ตฌํ์ ๋ณด๋ฉด์ ์ถ๊ฐํด๋ณด๊ฒ ์ต๋๋ค. MPC(Model Predictive Control)์ ์ปจ์ ๊ธฐ๊ธฐ ์ํ ๋ณํ(dynamics) + ์ฃผ๋ณ ํ๊ฒฝ ์์ => cost function ์ ์ด๊ณตํ ๋น์ ํ / ๋น๋ณผ๋ก(Non-linear, Non-convex) ๋์ ๊ณต๋ถํ๋ฉด์ ๋๋ผ๊ธฐ์๋ ๊ฐํํ์ต์ ํฅ๊ธฐ๊ฐ ์ข ์์ Flow k-1 ์ผ ๋์ ์ํ ๋ณ์๋ฅผ ๊ธฐ๋ฐ์ผ๋ก k+1 ~ ..
[Math] Mathematics for Machine Learning 2. Linear Algebra
๊ทผ๋์ ์ ๋ง์ด์ง ์ํ ๊ณต๋ถ์ ํ์์ฑ์ ๋๊ปด์ MML ์ด๋ผ๋ ๋จธ์ ๋ฌ๋ ์ํ์ ๋ฐ์ด๋ธ ๊ฐ์ ์ฑ ์ผ๋ก ๊ณต๋ถ๋ฅผ ์์ํ๋๋ฐ... ์ผ๋จ ์์ด๊ณ (!), ์ฉ์ด๊ฐ ๋๋ฌด ๋ง๊ณ (!), ๋ด์ฉ๋ ์ด๋ ค์์ ์์ฃผ ์ ๋ฅผ ๋จน๊ณ ์๋ค. ์ด์ฐ์ ์ฐ ์ดํดํ๋ค๊ณ ์๊ฐํ๋๋ฐ ์ฐ์ต๋ฌธ์ ๋ฅผ ๋ณด๋๊น ๋ ์ด์ผ~ ๋ชจ๋ฅด๊ฒ ๊ณ ๋๋ฆฌ๋ค... ๋ต์์ง๋ฅผ ๋ด๋ ์ดํด๊ฐ ์ด๋ ค์ด ๋ถ๋ถ์ด ๋ง์์ ๊ผผ๊ผผํ๊ฒ ๊ฐ์ด๋ ๋ฐ๋ผ ๋์ธ๋ฒ ํ์ด๋ด์ผ ์ดํด๊ฐ ๋์ง ์ถ๋ค. ๊ทผ๋ฐ ๋๋ฌด ์ด๋ ต๋ค ใ ใ ... ์ ํ๋์ ๊ฐ์๋ฅผ ์๊ฐํ์๋๋ฐ๋ ๋ด๊ฐ ๋ค์๋ ์ ํ๋์ ๊ฐ์์ ๋ฒ์๋ณด๋ค ๋ ๋์ ๋ฏ ํ๋ค. ์๋ฌดํผ ์๋ ๋งํฌ๋ ์ฐธ๊ณ ํ ์ฌ์ดํธ ๋ฑ. ํ๊ตญ์ด ๋ฒ์ญ ํด์ฃผ์ ์ค๋ณ๋ ์ ๋ง ๊ฐ์ฌํฉ๋๋ค... ๋น๊ตํ๋ฉฐ ๋ณด๊ณ ์์ต๋๋ค... ๊ต์ฌ - pdf ๋ฌด๋ฃ ๊ณต๊ฐ(https://mml-book.github.io/book/mml-boo..
[๋ผ์ดํธ ๋ฅ๋ฌ๋] 1. ๋์ ์๊ฐ์ผ๋ก ๋ณด๋ ๋จธ์ ๋ฌ๋ ๊ฐ๊ด
2022๋ 11์ Chat GPT๊ฐ ๋์ค์ ์ผ๋ก ๊ต์ฅํ ๋๊ฒ ์๋ ค์ง๋ฉด์ ์์ํ ๋ถ์ด ์ค๊ณ ์๋ ์ธ๊ณต์ง๋ฅ ์์ฅ์ด ๊ทธ์ผ๋ง๋ก ์ ์ฑ๊ธฐ๋ฅผ ๋ง์ดํ๋ค๋ ์๊ฐ์ด ๋๋ ์์ฆ์ ๋๋ค. LLM(Large Language Model) ๋ฟ๋ง ์๋๋ผ CV(Computer Vision) ๋ถ์ผ์์๋ ์ ์๊ถ ๋ฌธ์ ๊ฐ ๋๋๋๊ณ ์๊ธฐ๋ ํ์ง๋ง ์ฌ์ง๊ณผ ๊ทธ๋ฆผ์ฒด๋ฅผ ํ์ต์์ผ ๊ทธ๋ฆผ์ฒด๋ฅผ ์ ์ ์๋ก์ด ๊ทธ๋ฆผ์ ๋ง๋ค์ด๋ด๊ณ , ์์ฑํฉ์ฑ ๋ถ์ผ์์๋ ์ธ๊ณต์ง๋ฅ์ ํ์ฉํด TTS๊ฐ ๋ ธ๋๋ฅผ ๋ถ๋ฅด๊ฒ ํ๊ธฐ๋ ํฉ๋๋ค. ๋์ ๋ณด์ด๋ ์๋น์ค๋ฅผ ์ ๊ณตํ๋ ์์ ๊ฐ์ ๋ถ์ผ๋ฅผ ์ ์ธํ๊ณ ๋ ์ธ๊ณต์ง๋ฅ์ ํตํ ์ด์ํ์ง ์๋ฃจ์ , ๊ฐํํ์ต์ ํ์ฉํ ๊ฒ์ ๋ด(Bot) ์์ฑ ๋ฑ ์์ง ์ ๋ ์๋ฒฝํ ์ฐ์์ ๋ค ์์ง ๋ชปํ๋ ๋ฌด๊ถ๋ฌด์งํ ๋ถ์ผ์์ ๋ฅ๋ฌ๋์ด ์ฌ์ฉ๋๊ณ ์์ต๋๋ค. ์ด๋ฒ ํฌ์คํ ์์๋ AI๋ฅผ ๊ณต๋ถํ๊ธฐ๋ก ..
[๊ฐํํ์ต] Dealing with Sparse Reward Environments - ํฌ๋ฐํ ๋ณด์ ํ๊ฒฝ์์ ํ์ตํ๊ธฐ
โป ์๋ ๋งํฌ์ ๋ด์ฉ์ ๊ณต๋ถํ๋ฉฐ ํ๊ตญ์ด๋ก ์ ๋ฆฌํ ๋ด์ฉ์ ๋๋ค. Reinforcement Learning: Dealing with Sparse Reward Environments Reinforcement Learning (RL) is a method of machine learning in which an agent learns a strategy through interactions with its environment… medium.com 1. Sparse Reward Sparse Reward(ํฌ๋ฐํ ๋ณด์) : Agent๊ฐ ๋ชฉํ ์ํฉ์ ๊ฐ๊น์์ก์ ๋๋ง ๊ธ์ ๋ณด์์ ๋ฐ๋ ๊ฒฝ์ฐ ํ์ฌ ์คํ ํ๊ฒฝ ์ธํ ๊ณผ ๊ฐ์ Curiosity-Driven method agent๊ฐ ๊ด์ฌ์ฌ ๋ฐ์ ํ๊ฒฝ์๋ ๋๊ธฐ๋ฅผ ๋ฐ๋๋ก Curric..
[๊ฐํํ์ต] DDPG(Deep Deterministic Policy Gradient)
DQN์ ์ฐจ์์ ์ ์ฃผ ๋ฌธ์ (๊ณ ์ฐจ์ action์ ๋ค๋ฃจ๋ ๊ฒฝ์ฐ ์ฐ์ฐ ์๋๊ฐ ๋๋ ค์ง๊ณ memory space๋ฅผ ๋ง์ด ์ํจ)๋ฅผ off-policy actor critic ๋ฐฉ์์ผ๋ก ํ์ด๋ธ๋ค. ๊ธฐ์กด DQN ๋ฐฉ์์ insight๋ค์ batch normalization replay buffer target Q network Actor-critic ํ๋ผ๋ฏธํฐํ ๋ actor function์ ๊ฐ์ง actor function : state์์ ํน์ action์ผ๋ก mappingํ์ฌ ํ์ฌ policy๋ฅผ ์ง์ policy gradient ๋ฐฉ์์ผ๋ก ํ์ต ์ฌ๊ธฐ์์ J๊ฐ Objective Function(๋ชฉํํจ์) actor function์ด ๋ชฉํ ํจ์๋ฅผ gradient asent๋ก ์ต๋ํ→ ์ด ๋์ policy parameter..