From ddf9cf2ab3a6e3433992d625fe1d2e1f40117af3 Mon Sep 17 00:00:00 2001 From: craisin Date: Thu, 8 Oct 2026 20:47:51 -0700 Subject: [PATCH 1/5] add action --- .gitea/workflows/update_site.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .gitea/workflows/update_site.yml diff --git a/.gitea/workflows/update_site.yml b/.gitea/workflows/update_site.yml new file mode 100644 index 0000000..3923c7c --- /dev/null +++ b/.gitea/workflows/update_site.yml @@ -0,0 +1,27 @@ +name: Update Website + +on: + push: + branches: master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + path: content + - name: Clone repository + run: | + git clone https://github.com/craisined/public-notes.git + rm public-notes/content/* + mv content/* public-notes/content/ + cd public-notes + git config user.name "craisined" + git config user.email "kahkaicyap@gmail.com" + git add . + git commit -m "Update content" + git push origin master + env: + GITHUB_TOKEN: ${{secrets.GH_TOKEN}} \ No newline at end of file From 05f483490bdc14c1ef3278ac81de985da1490d42 Mon Sep 17 00:00:00 2001 From: craisin Date: Thu, 8 Oct 2026 20:52:22 -0700 Subject: [PATCH 2/5] fix action --- .gitea/workflows/update_site.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/update_site.yml b/.gitea/workflows/update_site.yml index 3923c7c..290d638 100644 --- a/.gitea/workflows/update_site.yml +++ b/.gitea/workflows/update_site.yml @@ -14,14 +14,18 @@ jobs: path: content - name: Clone repository run: | - git clone https://github.com/craisined/public-notes.git - rm public-notes/content/* - mv content/* public-notes/content/ - cd public-notes + git clone https://x-access-token:${GH_TOKEN}@github.com/craisined/public-notes-quartz.git + rm -rf public-notes-quartz/content/* + cp -a content/. public-notes-quartz/content/ + cd public-notes-quartz git config user.name "craisined" git config user.email "kahkaicyap@gmail.com" git add . + if git diff --cached --quiet; then + echo "No changes to commit" + exit 0 + fi git commit -m "Update content" git push origin master env: - GITHUB_TOKEN: ${{secrets.GH_TOKEN}} \ No newline at end of file + GH_TOKEN: ${{secrets.GH_TOKEN}} \ No newline at end of file From d3bb0435b5391abe90783b17cee385afe3efd886 Mon Sep 17 00:00:00 2001 From: craisin Date: Thu, 8 Oct 2026 20:57:22 -0700 Subject: [PATCH 3/5] change branch --- .gitea/workflows/update_site.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/update_site.yml b/.gitea/workflows/update_site.yml index 290d638..2694245 100644 --- a/.gitea/workflows/update_site.yml +++ b/.gitea/workflows/update_site.yml @@ -12,7 +12,7 @@ jobs: uses: actions/checkout@v4 with: path: content - - name: Clone repository + - name: Update repository run: | git clone https://x-access-token:${GH_TOKEN}@github.com/craisined/public-notes-quartz.git rm -rf public-notes-quartz/content/* @@ -26,6 +26,6 @@ jobs: exit 0 fi git commit -m "Update content" - git push origin master + git push env: GH_TOKEN: ${{secrets.GH_TOKEN}} \ No newline at end of file From d682998578cf34c88d5ec0c079a74385a3202a2c Mon Sep 17 00:00:00 2001 From: craisin Date: Sun, 15 Nov 2026 09:55:36 -0800 Subject: [PATCH 4/5] vault backup: 2026-11-15 09:55:36 --- Gradient Descent and Modeling.md | 57 ++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Gradient Descent and Modeling.md diff --git a/Gradient Descent and Modeling.md b/Gradient Descent and Modeling.md new file mode 100644 index 0000000..4ac5858 --- /dev/null +++ b/Gradient Descent and Modeling.md @@ -0,0 +1,57 @@ +# Models + +We can view a model as a function $f(x, p_1, p_2, \dots, p_n)$, and we can judge a model's performance via training error $E(f, \hat{f})$, where $\hat{f}$ is what we expect the model to output. +## Convexity and Updating + +Assume $E$ is convex over all $p_1 \dots p_n$. Then, any local decrease in $E$ caused by a change in $p_i$ is toward the local minima of $E$. This local decrease is in the direction opposite of the derivative, so to update parameter $p_i$: + +$$p_{\text{new}} \rightarrow p_{\text{old}} - \alpha \frac{\partial E}{\partial p_i}$$ + +*(where $\alpha$ is a small number, the learning rate)* + +## Line of Best Fit + +As a simple case, take $f(x, m, b) = mx + b$ and $E(f, \hat{f}) = (f - \hat{f})^2$. Then: + +$$ +\begin{aligned} +m_{\text{new}} &\rightarrow m_{\text{old}} - \alpha \frac{\partial E}{\partial m} \\ +&= m_{\text{old}} - \alpha \frac{\partial E}{\partial f} \frac{\partial f}{\partial m} \\ +&= m_{\text{old}} - \alpha \cdot 2(f - \hat{f}) \cdot x +\end{aligned} +$$ + +$$ +\begin{aligned} +b_{\text{new}} &\rightarrow b_{\text{old}} - \alpha \frac{\partial E}{\partial b} \\ +&= b_{\text{old}} - \alpha \frac{\partial E}{\partial f} \cdot \frac{\partial f}{\partial b} \\ +&= b_{\text{old}} - \alpha \cdot 2(f - \hat{f}) +\end{aligned} +$$ + +# More Complicated Models + +We can add complexity to a model by expressing it as a composition of simple functions: + +$$f = l_1(l_2(l_3(x, p_1, p_2, \dots), q_1, q_2, \dots), r_1, r_2, \dots)$$ + +Note how this makes updates very convenient: + +$$r_1 \rightarrow r_1 - \alpha \frac{\partial E}{\partial l_1} \cdot \frac{\partial l_1}{\partial r_1}$$ + +$$q_1 \rightarrow q_1 - \alpha \frac{\partial E}{\partial l_1} \cdot \frac{\partial l_1}{\partial l_2} \cdot \frac{\partial l_2}{\partial q_1}$$ + +Note that: +1. $\frac{\partial E}{\partial l_1}$ and $\frac{\partial l_1}{\partial l_2}$ are easy to compute for easily differentiable $E$ and $l$. +2. Different parameter updates share factors, so it is convenient to keep track of $\frac{\partial E}{\partial l_1}, \frac{\partial E}{\partial l_2}, \dots$ updating parameters going from $l_1$ to $l_2$ to $l_3 \dots$ + +## Linearity + +Note that if $l_1$ and $l_2$ are linear, $l_1 \circ l_2$ is also linear. Therefore, a model composed of linear functions can still only represent a linear relationship. + +To resolve this, add non-linearity! Some options are: +* $l = \max(0, x)$ — *(known as ReLU)* +* $l = \frac{1}{1 + e^{-x}}$ — *(known as sigmoid)* +* $l = \arctan(x)$ + +However, note that these non-linear functions do not guarantee convexity! \ No newline at end of file From f8b4a741f39898b1fce40728760a996cf5a5d8ed Mon Sep 17 00:00:00 2001 From: craisin Date: Sun, 15 Nov 2026 09:58:53 -0800 Subject: [PATCH 5/5] vault backup: 2026-11-15 09:58:52 --- Gradient Descent and Modeling.md | 44 ++++++++++---------------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/Gradient Descent and Modeling.md b/Gradient Descent and Modeling.md index 4ac5858..3af9160 100644 --- a/Gradient Descent and Modeling.md +++ b/Gradient Descent and Modeling.md @@ -1,57 +1,39 @@ # Models - -We can view a model as a function $f(x, p_1, p_2, \dots, p_n)$, and we can judge a model's performance via training error $E(f, \hat{f})$, where $\hat{f}$ is what we expect the model to output. +We can view a model as a function $f(x, p_1, p_2, \dots, p_n)$, and we can judge a model's performance via training error $\varepsilon(f, \hat{f})$, where $\hat{f}$ is what we expect the model to output. ## Convexity and Updating - -Assume $E$ is convex over all $p_1 \dots p_n$. Then, any local decrease in $E$ caused by a change in $p_i$ is toward the local minima of $E$. This local decrease is in the direction opposite of the derivative, so to update parameter $p_i$: - -$$p_{\text{new}} \rightarrow p_{\text{old}} - \alpha \frac{\partial E}{\partial p_i}$$ - +Assume $\varepsilon$ is convex over all $p_1 \dots p_n$. Then, any local decrease in $\varepsilon$ caused by a change in $p_i$ is toward the local minima of $\varepsilon$. This local decrease is in the direction opposite of the derivative, so to update parameter $p_i$: +$$p_{\text{new}} \rightarrow p_{\text{old}} - \alpha \frac{\partial \varepsilon}{\partial p_i}$$ *(where $\alpha$ is a small number, the learning rate)* - ## Line of Best Fit - -As a simple case, take $f(x, m, b) = mx + b$ and $E(f, \hat{f}) = (f - \hat{f})^2$. Then: +As a simple case, take $f(x, m, b) = mx + b$ and $\varepsilon(f, \hat{f}) = (f - \hat{f})^2$. Then: $$ \begin{aligned} -m_{\text{new}} &\rightarrow m_{\text{old}} - \alpha \frac{\partial E}{\partial m} \\ -&= m_{\text{old}} - \alpha \frac{\partial E}{\partial f} \frac{\partial f}{\partial m} \\ +m_{\text{new}} &\rightarrow m_{\text{old}} - \alpha \frac{\partial \varepsilon}{\partial m} \\ +&= m_{\text{old}} - \alpha \frac{\partial \varepsilon}{\partial f} \frac{\partial f}{\partial m} \\ &= m_{\text{old}} - \alpha \cdot 2(f - \hat{f}) \cdot x \end{aligned} $$ - $$ \begin{aligned} -b_{\text{new}} &\rightarrow b_{\text{old}} - \alpha \frac{\partial E}{\partial b} \\ -&= b_{\text{old}} - \alpha \frac{\partial E}{\partial f} \cdot \frac{\partial f}{\partial b} \\ +b_{\text{new}} &\rightarrow b_{\text{old}} - \alpha \frac{\partial \varepsilon}{\partial b} \\ +&= b_{\text{old}} - \alpha \frac{\partial \varepsilon}{\partial f} \cdot \frac{\partial f}{\partial b} \\ &= b_{\text{old}} - \alpha \cdot 2(f - \hat{f}) \end{aligned} $$ - -# More Complicated Models - +# More Complicated Models We can add complexity to a model by expressing it as a composition of simple functions: - $$f = l_1(l_2(l_3(x, p_1, p_2, \dots), q_1, q_2, \dots), r_1, r_2, \dots)$$ - Note how this makes updates very convenient: - -$$r_1 \rightarrow r_1 - \alpha \frac{\partial E}{\partial l_1} \cdot \frac{\partial l_1}{\partial r_1}$$ - -$$q_1 \rightarrow q_1 - \alpha \frac{\partial E}{\partial l_1} \cdot \frac{\partial l_1}{\partial l_2} \cdot \frac{\partial l_2}{\partial q_1}$$ - +$$r_1 \rightarrow r_1 - \alpha \frac{\partial \varepsilon}{\partial l_1} \cdot \frac{\partial l_1}{\partial r_1}$$ +$$q_1 \rightarrow q_1 - \alpha \frac{\partial \varepsilon}{\partial l_1} \cdot \frac{\partial l_1}{\partial l_2} \cdot \frac{\partial l_2}{\partial q_1}$$ Note that: -1. $\frac{\partial E}{\partial l_1}$ and $\frac{\partial l_1}{\partial l_2}$ are easy to compute for easily differentiable $E$ and $l$. -2. Different parameter updates share factors, so it is convenient to keep track of $\frac{\partial E}{\partial l_1}, \frac{\partial E}{\partial l_2}, \dots$ updating parameters going from $l_1$ to $l_2$ to $l_3 \dots$ - +1. $\frac{\partial \varepsilon}{\partial l_1}$ and $\frac{\partial l_1}{\partial l_2}$ are easy to compute for easily differentiable $\varepsilon$ and $l$. +2. Different parameter updates share factors, so it is convenient to keep track of $\frac{\partial \varepsilon}{\partial l_1}, \frac{\partial \varepsilon}{\partial l_2}, \dots$ updating parameters going from $l_1$ to $l_2$ to $l_3 \dots$ ## Linearity - Note that if $l_1$ and $l_2$ are linear, $l_1 \circ l_2$ is also linear. Therefore, a model composed of linear functions can still only represent a linear relationship. - To resolve this, add non-linearity! Some options are: * $l = \max(0, x)$ — *(known as ReLU)* * $l = \frac{1}{1 + e^{-x}}$ — *(known as sigmoid)* * $l = \arctan(x)$ - However, note that these non-linear functions do not guarantee convexity! \ No newline at end of file