chain_rules
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| chain_rules [2025/08/04 12:16] – hkimscil | chain_rules [2026/03/10 22:11] (current) – [e.g.] hkimscil | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| y & =& f(g(x)) \\ | y & =& f(g(x)) \\ | ||
| \frac {dy}{dx} & = & \frac {dy}{dt} * \frac {dt}{dx} | \frac {dy}{dx} & = & \frac {dy}{dt} * \frac {dt}{dx} | ||
| - | & & \frac {dy}{dt} = f'(t) = f' | + | & & \frac {dy}{dt} = f'(t) = f' |
| - | & & \because{ | + | & & \frac {dt}{dx} = g'(x) \\ |
| - | & & \frac {dy}{dx} = f' | + | \therefore{ \;\; } \frac {dy}{dx} |
| \end{eqnarray*} | \end{eqnarray*} | ||
| + | ====== E.g ====== | ||
| \begin{eqnarray*} | \begin{eqnarray*} | ||
| y & = & (2x^2 + 1)^2 \\ | y & = & (2x^2 + 1)^2 \\ | ||
| Line 15: | Line 16: | ||
| y & = & t^2 \\ | y & = & t^2 \\ | ||
| t & = & 2x^2 + 1 \\ | t & = & 2x^2 + 1 \\ | ||
| - | \frac{dy}{dt} & = & 2t \\ | + | \\ |
| - | & = & 2 (2x^2 + 1) \\ | + | & |
| - | & = & (4x^2 + 2) \\ | + | &\phantom{=}\, & = 2 (2x^2 + 1) \\ |
| - | \frac{dt}{dx} & = & 4x \\ | + | &\phantom{=}\, & = (4x^2 + 2) \\ |
| - | \therefore{} | + | \\ |
| + | & | ||
| + | \\ | ||
| \frac{dy}{dx} & = & \frac{dy}{dt}*\frac{dt}{dx} \\ | \frac{dy}{dx} & = & \frac{dy}{dt}*\frac{dt}{dx} \\ | ||
| & = & (4x^2 + 2) * 4x \\ | & = & (4x^2 + 2) * 4x \\ | ||
| & = & 16x^3 + 8x \\ | & = & 16x^3 + 8x \\ | ||
| \end{eqnarray*} | \end{eqnarray*} | ||
| + | |||
| + | ====== e.g. ====== | ||
| + | see [[:gradient descent]] | ||
| + | \begin{eqnarray*} | ||
| + | \because{ \;\; } \text{predicted value } \; \hat{y} & = & a + b x \\ | ||
| + | \text{and }\;\; \text{residual} & = & y - \hat{y} \\ | ||
| + | \therefore{} \;\; \text{residual}^2 & = & (y - (a + b x)) \\ | ||
| + | \therefore{} \sum{\text{residual}^2} & = & \sum{(y - (a + b x))^2} \\ | ||
| + | & = & \text{SSE, | ||
| + | \\ | ||
| + | \dfrac{\text{dSSE}}{\text{da}} & = & \\ | ||
| + | \end{eqnarray*} | ||
| + | |||
| + | intercept, a 에 대한 SSR의 미분은 | ||
| + | \begin{eqnarray*} | ||
| + | \widehat{y} & = & a + b * x \\ | ||
| + | \text{a} & = & \text{intercept} \\ | ||
| + | \text{residual} & = & (y - \widehat{y}) \\ | ||
| + | \text{SSR} & = & \sum {\text{residual}^2} = \sum{(y - (a + b x))^2} | ||
| + | \dfrac{\text{d.SSR}}{\text{d.a}} & = & | ||
| + | \dfrac{\text{d.SSR}}{\text{d.Res}} * \dfrac{\text{d.Res}}{\text{d.a}} \\ | ||
| + | & = & (2 * \text{residual}) * \dfrac{ \text{d.Res}} {\text{d.intercept}} \\ | ||
| + | & = & (2 * \text{residual}) * \dfrac{y - (a + b * x)} {\text{d.intercept}} \\ | ||
| + | & = & 2 * \text{residual} * -1 \\ | ||
| + | & = & -2 * \text{residual} \\ | ||
| + | & = & -2 * (y - (a + b * x)) \\ | ||
| + | & = & -2 * (y - \widehat{y}) \\ | ||
| + | \end{eqnarray*} | ||
| + | |||
| + | slope, b 에 대한 SSR의 미분은 | ||
| + | \begin{eqnarray*} | ||
| + | \widehat{y} & = & a + b * x \\ | ||
| + | \text{b} & = & \text{slope} \\ | ||
| + | \text{residual} & = & (y - \widehat{y}) \\ | ||
| + | \text{SSR} & = & \sum {\text{residual}^2} = \sum{(y - (a + b x))^2} | ||
| + | \dfrac{\text{d.SSR}}{\text{d.a}} & = & | ||
| + | \dfrac{\text{d.SSR}}{\text{d.Res}} * \dfrac{\text{d.Res}}{\text{d.b}} \\ | ||
| + | & = & (2 * \text{residual}) * \dfrac{ \text{d.Res}} {\text{d.b}} \\ | ||
| + | & = & (2 * \text{residual}) * \dfrac{y - (a + b * x)} {\text{d.b}} \\ | ||
| + | & = & 2 * \text{residual} * -x \\ | ||
| + | & = & -2 x * \text{residual} \\ | ||
| + | & = & -2 x * (y - (a + b * x)) \\ | ||
| + | & = & -2 x * (y - \widehat{y}) \\ | ||
| + | \end{eqnarray*} | ||
| + | |||
| + | |||
chain_rules.1754309761.txt.gz · Last modified: by hkimscil
