Skip to content

Commit

Permalink
Automated updates to slides.
Browse files Browse the repository at this point in the history
  • Loading branch information
schrimpf committed Dec 6, 2023
1 parent e07882c commit f809a38
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 32 deletions.
2 changes: 1 addition & 1 deletion paul/feed.html
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ <h3 class="no-anchor listing-title">
</a>
</div>
</div>
<div class="quarto-post image-right" data-index="6" data-listing-file-modified-sort="1701894779411" data-listing-reading-time-sort="9">
<div class="quarto-post image-right" data-index="6" data-listing-file-modified-sort="1701894953811" data-listing-reading-time-sort="9">
<div class="thumbnail">
<p><a href="./neuralnets.html"> <div class="listing-item-img-placeholder card-img-top" >&nbsp;</div> </a></p>
</div>
Expand Down
23 changes: 13 additions & 10 deletions paul/neuralnets.html
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ <h2>Single Layer Perceptron</h2>
</section>
<section id="activation-functions" class="slide level2">
<h2>Activation functions</h2>
<div class="cell" data-execution_count="1">
<div class="cell" data-execution_count="2">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1"></a><span class="im">import</span> numpy <span class="im">as</span> np</span>
Expand Down Expand Up @@ -498,7 +498,7 @@ <h2>Activation functions</h2>
</section>
<section id="single-layer-perceptron-1" class="slide level2">
<h2>Single Layer Perceptron</h2>
<div class="cell" data-execution_count="2">
<div class="cell" data-execution_count="3">
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb2-1"><a href="#cb2-1"></a><span class="im">import</span> torch.nn <span class="im">as</span> nn</span>
<span id="cb2-2"><a href="#cb2-2"></a><span class="im">import</span> torch</span>
<span id="cb2-3"><a href="#cb2-3"></a><span class="kw">class</span> SingleLayerPerceptron(nn.Module):</span>
Expand Down Expand Up @@ -588,7 +588,7 @@ <h2>Computing Gradients</h2>
</section>
<section id="gradient-descent-1" class="slide level2">
<h2>Gradient Descent</h2>
<div class="cell" data-execution_count="3">
<div class="cell" data-execution_count="4">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb3-1"><a href="#cb3-1"></a>n <span class="op">=</span> <span class="dv">100</span></span>
Expand Down Expand Up @@ -629,7 +629,7 @@ <h2>Gradient Descent</h2>
</section>
<section id="multi-layer-perceptron" class="slide level2">
<h2>Multi Layer Perceptron</h2>
<div class="cell" data-execution_count="4">
<div class="cell" data-execution_count="5">
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb4-1"><a href="#cb4-1"></a><span class="kw">def</span> multilayer(d,width,depth,activation<span class="op">=</span>nn.ReLU()):</span>
<span id="cb4-2"><a href="#cb4-2"></a> mlp <span class="op">=</span> nn.Sequential(</span>
<span id="cb4-3"><a href="#cb4-3"></a> nn.Linear(d,width),</span>
Expand All @@ -651,7 +651,7 @@ <h2>Multi Layer Perceptron</h2>
</section>
<section id="multi-layer-perceptron-1" class="slide level2">
<h2>Multi Layer Perceptron</h2>
<div class="cell" data-execution_count="5">
<div class="cell" data-execution_count="6">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb5-1"><a href="#cb5-1"></a>mlp <span class="op">=</span> multilayer(<span class="dv">1</span>,<span class="dv">4</span>,<span class="dv">4</span>,nn.ReLU())</span>
Expand Down Expand Up @@ -700,7 +700,7 @@ <h2>Overparameterization</h2>
</section>
<section id="double-descent" class="slide level2">
<h2>Double Descent</h2>
<div class="cell" data-execution_count="6">
<div class="cell" data-execution_count="7">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb7-1"><a href="#cb7-1"></a><span class="im">from</span> joblib <span class="im">import</span> Parallel, delayed</span>
Expand Down Expand Up @@ -753,7 +753,7 @@ <h2>Double Descent</h2>
</section>
<section id="double-descent-1" class="slide level2">
<h2>Double Descent</h2>
<div class="cell" data-execution_count="7">
<div class="cell" data-execution_count="8">
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb8-1"><a href="#cb8-1"></a>f <span class="op">=</span> <span class="kw">lambda</span> x: np.exp(x[<span class="dv">0</span>]<span class="op">-</span>x[<span class="dv">1</span>])</span>
<span id="cb8-2"><a href="#cb8-2"></a>n <span class="op">=</span> <span class="dv">20</span></span>
<span id="cb8-3"><a href="#cb8-3"></a>torch.manual_seed(<span class="dv">1234</span>)</span>
Expand Down Expand Up @@ -781,7 +781,7 @@ <h2>Double Descent</h2>
</section>
<section id="double-descent-2" class="slide level2">
<h2>Double Descent</h2>
<div class="cell" data-execution_count="8">
<div class="cell" data-execution_count="9">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb10"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb10-1"><a href="#cb10-1"></a><span class="kw">def</span> plotdd(losses, nonoise):</span>
Expand Down Expand Up @@ -822,7 +822,7 @@ <h2>Double Descent</h2>
</section>
<section id="double-descent-low-noise" class="slide level2">
<h2>Double Descent: Low Noise</h2>
<div class="cell" data-execution_count="9">
<div class="cell" data-execution_count="10">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb11"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb11-1"><a href="#cb11-1"></a>sigma <span class="op">=</span> <span class="fl">0.01</span></span>
Expand All @@ -843,7 +843,10 @@ <h2>Double Descent: Low Noise</h2>
width 9</code></pre>
</div>
</div>
<div class="cell" data-execution_count="10">
</section>
<section id="double-descent-low-noise-1" class="slide level2">
<h2>Double Descent: Low Noise</h2>
<div class="cell" data-execution_count="11">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb13"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb13-1"><a href="#cb13-1"></a>fig<span class="op">=</span>plotdd(ddlowsig[<span class="dv">0</span>].mean(axis<span class="op">=</span><span class="dv">2</span>), ddlowsig[<span class="dv">1</span>].mean(axis<span class="op">=</span><span class="dv">2</span>))</span>
Expand Down
48 changes: 28 additions & 20 deletions paul/neuralnets.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@
"\n",
"## Activation functions"
],
"id": "4957f000-ff0a-492c-8efe-3dbc30d92244"
"id": "53c4f568-9f75-46ca-a1ad-0c3853c06e51"
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -105,11 +105,11 @@
"source": [
"## Single Layer Perceptron"
],
"id": "5da90a40-6bd4-4b95-a821-98f635ebfe1f"
"id": "2e58ce2f-9f27-4015-bbf0-dbc336e89b07"
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -192,11 +192,11 @@
"\n",
"## Gradient Descent"
],
"id": "fd906e5d-d4d0-4d3d-a17a-ad32966192cc"
"id": "efc4c581-8655-479a-9c11-6e4bea960b79"
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -256,11 +256,11 @@
"source": [
"## Multi Layer Perceptron"
],
"id": "22930f9b-80a0-4d1c-8709-521e0ad43410"
"id": "a198e0d9-8431-416b-9a48-12068229c7c3"
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -290,11 +290,11 @@
"source": [
"## Multi Layer Perceptron"
],
"id": "70c44de8-9633-4391-a2b4-720942bf79d1"
"id": "ab393fd1-525c-44ef-b643-4f06ec222be7"
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -361,11 +361,11 @@
"\n",
"## Double Descent"
],
"id": "8fa64d79-8dc8-40d6-92c5-ebb56992d37a"
"id": "e1218968-0a39-47f5-8c5b-892ee962dc7e"
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -423,11 +423,11 @@
"source": [
"## Double Descent"
],
"id": "e9499d85-7e0a-40df-8d85-f3164c60058c"
"id": "cdbfecb6-bf54-4040-a831-ad2420471dfc"
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -468,11 +468,11 @@
"source": [
"## Double Descent"
],
"id": "cad31d98-0ec1-48d4-b279-a52adaae5b9c"
"id": "d3e10b5d-f836-43a9-bdd1-62c7682b5984"
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -532,11 +532,11 @@
"source": [
"## Double Descent: Low Noise"
],
"id": "4cc50cbd-ea6f-4ed6-bde7-e5cc6c161609"
"id": "72fb9360-3ac3-4670-a543-d555421b73b0"
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -564,9 +564,17 @@
],
"id": "32463926"
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Double Descent: Low Noise"
],
"id": "aaea0b57-9a41-40aa-b9bd-071fa1eed38c"
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 11,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -677,7 +685,7 @@
"networks, but neural networks are commonly used as one of the parts of\n",
"diffusion models."
],
"id": "77382f92-41ce-4737-a4c1-cdf01766f1c2"
"id": "c8e49d84-1321-4dad-891c-21dec26e319a"
}
],
"nbformat": 4,
Expand Down
9 changes: 8 additions & 1 deletion paul/search.json
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,7 @@
"href": "neuralnets.html#double-descent-low-noise",
"title": "Neural Networks",
"section": "Double Descent: Low Noise",
"text": "Double Descent: Low Noise\n\n\nCode\nsigma = 0.01\ny = f(x.T) + sigma*torch.randn(x.shape[0])\nytest = f(xtest.T) + sigma*torch.randn(xtest.shape[0])\nddlowsig = doubledescentdemo(x,y,xtest,ytest,f, lr=0.05)\n\n\nwidth 0\nwidth 1\nwidth 2\nwidth 3\nwidth 4\nwidth 5\nwidth 6\nwidth 7\nwidth 8\nwidth 9\n\n\n\n\nCode\nfig=plotdd(ddlowsig[0].mean(axis=2), ddlowsig[1].mean(axis=2))\nfig.show()"
"text": "Double Descent: Low Noise\n\n\nCode\nsigma = 0.01\ny = f(x.T) + sigma*torch.randn(x.shape[0])\nytest = f(xtest.T) + sigma*torch.randn(xtest.shape[0])\nddlowsig = doubledescentdemo(x,y,xtest,ytest,f, lr=0.05)\n\n\nwidth 0\nwidth 1\nwidth 2\nwidth 3\nwidth 4\nwidth 5\nwidth 6\nwidth 7\nwidth 8\nwidth 9"
},
{
"objectID": "neuralnets.html#double-descent-3",
Expand Down Expand Up @@ -1475,5 +1475,12 @@
"title": "Neural Networks",
"section": "Other Architectures",
"text": "Other Architectures\n\nMulti-layer perceptrons / feed forward networks are the simplest neural networks, many extensions and variations exist\nTricks to help with vanishing gradients and numeric stability:\n\nNormalization\nResidual connections\n\nVariations motivated by sequential data:\n\nRecurrent\nTransformers\n\nVariations motivated by images:\n\nConvolutions\nGAN\nDiffusion1\n\n\nThe motivating idea of diffusion models is different than neural networks, but neural networks are commonly used as one of the parts of diffusion models."
},
{
"objectID": "neuralnets.html#double-descent-low-noise-1",
"href": "neuralnets.html#double-descent-low-noise-1",
"title": "Neural Networks",
"section": "Double Descent: Low Noise",
"text": "Double Descent: Low Noise\n\n\nCode\nfig=plotdd(ddlowsig[0].mean(axis=2), ddlowsig[1].mean(axis=2))\nfig.show()"
}
]

0 comments on commit f809a38

Please sign in to comment.