Skip to content

Commit

Permalink
Built site for gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Quarto GHA Workflow Runner committed Nov 12, 2023
1 parent 44d392b commit e564689
Show file tree
Hide file tree
Showing 46 changed files with 99 additions and 97 deletions.
2 changes: 1 addition & 1 deletion .nojekyll
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1261e754
226e8234
Binary file modified labs/06/scf.pdf
Binary file not shown.
Binary file modified labs/09/collab_with_git.pdf
Binary file not shown.
Binary file modified labs/lab0-setup.pdf
Binary file not shown.
Binary file modified labs/lab1-submission.pdf
Binary file not shown.
Binary file modified labs/lab2-testing.pdf
Binary file not shown.
Binary file modified labs/lab3-debugging.pdf
Binary file not shown.
Binary file modified labs/lab5-codereview.pdf
Binary file not shown.
Binary file modified labs/py_vs_R.pdf
Binary file not shown.
Binary file modified ps/ps1.pdf
Binary file not shown.
Binary file modified ps/ps2.pdf
Binary file not shown.
Binary file modified ps/ps3.pdf
Binary file not shown.
Binary file modified ps/ps4.pdf
Binary file not shown.
Binary file modified ps/ps5.pdf
Binary file not shown.
Binary file modified ps/ps6.pdf
Binary file not shown.
Binary file modified ps/ps7.pdf
Binary file not shown.
Binary file modified ps/regex.pdf
Binary file not shown.
14 changes: 7 additions & 7 deletions search.json

Large diffs are not rendered by default.

84 changes: 42 additions & 42 deletions sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,170 +2,170 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/publish.html</loc>
<lastmod>2023-11-08T19:45:10.223Z</lastmod>
<lastmod>2023-11-12T17:35:56.845Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/office_hours.html</loc>
<lastmod>2023-11-08T19:45:09.387Z</lastmod>
<lastmod>2023-11-12T17:35:55.993Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/units/unit9-sim.html</loc>
<lastmod>2023-11-08T19:45:00.584Z</lastmod>
<lastmod>2023-11-12T17:35:47.297Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/units/test.html</loc>
<lastmod>2023-11-08T19:44:28.568Z</lastmod>
<lastmod>2023-11-12T17:35:15.953Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/units/unit10-linalg.html</loc>
<lastmod>2023-11-08T19:44:17.960Z</lastmod>
<lastmod>2023-11-12T17:35:05.505Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/units/unit11-optim.html</loc>
<lastmod>2023-11-08T19:43:57.900Z</lastmod>
<lastmod>2023-11-12T17:34:45.953Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/units/unit6-parallel.html</loc>
<lastmod>2023-11-08T19:43:39.632Z</lastmod>
<lastmod>2023-11-12T17:34:28.221Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/units/unit8-numbers.html</loc>
<lastmod>2023-11-08T19:43:19.560Z</lastmod>
<lastmod>2023-11-12T17:34:08.465Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/rubric.html</loc>
<lastmod>2023-11-08T19:43:16.592Z</lastmod>
<lastmod>2023-11-12T17:34:05.585Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/labs/lab0-setup.html</loc>
<lastmod>2023-11-08T19:43:05.144Z</lastmod>
<lastmod>2023-11-12T17:33:54.281Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/labs/py_vs_R.html</loc>
<lastmod>2023-11-08T19:42:58.208Z</lastmod>
<lastmod>2023-11-12T17:33:47.353Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/labs/lab3-debugging.html</loc>
<lastmod>2023-11-08T19:42:51.448Z</lastmod>
<lastmod>2023-11-12T17:33:40.673Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/labs/06/scf.html</loc>
<lastmod>2023-11-08T19:42:41.276Z</lastmod>
<lastmod>2023-11-12T17:33:30.605Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/ps/ps6.html</loc>
<lastmod>2023-11-08T19:42:34.656Z</lastmod>
<lastmod>2023-11-12T17:33:24.025Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/ps/ps2.html</loc>
<lastmod>2023-11-08T19:42:28.756Z</lastmod>
<lastmod>2023-11-12T17:33:18.485Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/ps/ps3.html</loc>
<lastmod>2023-11-08T19:42:22.504Z</lastmod>
<lastmod>2023-11-12T17:33:12.305Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/ps/ps1.html</loc>
<lastmod>2023-11-08T19:42:16.428Z</lastmod>
<lastmod>2023-11-12T17:33:06.333Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/howtos/accessingUnixCommandLine.html</loc>
<lastmod>2023-11-08T19:42:14.800Z</lastmod>
<lastmod>2023-11-12T17:33:04.757Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/howtos/quartoInstall.html</loc>
<lastmod>2023-11-08T19:42:14.132Z</lastmod>
<lastmod>2023-11-12T17:33:04.101Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/howtos/gitInstall.html</loc>
<lastmod>2023-11-08T19:42:13.448Z</lastmod>
<lastmod>2023-11-12T17:33:03.421Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/howtos/windowsInstall.html</loc>
<lastmod>2023-11-08T19:42:12.776Z</lastmod>
<lastmod>2023-11-12T17:33:02.773Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/syllabus.html</loc>
<lastmod>2023-11-08T19:42:12.052Z</lastmod>
<lastmod>2023-11-12T17:33:02.045Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/howtos/accessingPython.html</loc>
<lastmod>2023-11-08T19:42:13.124Z</lastmod>
<lastmod>2023-11-12T17:33:03.105Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/howtos/ps-submission.html</loc>
<lastmod>2023-11-08T19:42:13.856Z</lastmod>
<lastmod>2023-11-12T17:33:03.817Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/howtos/RandRStudioInstall.html</loc>
<lastmod>2023-11-08T19:42:14.444Z</lastmod>
<lastmod>2023-11-12T17:33:04.417Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/howtos/windowsAndLinux.html</loc>
<lastmod>2023-11-08T19:42:15.416Z</lastmod>
<lastmod>2023-11-12T17:33:05.349Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/ps/ps4.html</loc>
<lastmod>2023-11-08T19:42:19.484Z</lastmod>
<lastmod>2023-11-12T17:33:09.325Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/ps/ps5.html</loc>
<lastmod>2023-11-08T19:42:25.788Z</lastmod>
<lastmod>2023-11-12T17:33:15.573Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/ps/regex.html</loc>
<lastmod>2023-11-08T19:42:31.740Z</lastmod>
<lastmod>2023-11-12T17:33:21.149Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/ps/ps7.html</loc>
<lastmod>2023-11-08T19:42:37.528Z</lastmod>
<lastmod>2023-11-12T17:33:26.857Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/labs/lab1-submission.html</loc>
<lastmod>2023-11-08T19:42:48.564Z</lastmod>
<lastmod>2023-11-12T17:33:37.817Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/labs/lab5-codereview.html</loc>
<lastmod>2023-11-08T19:42:55.312Z</lastmod>
<lastmod>2023-11-12T17:33:44.509Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/labs/lab2-testing.html</loc>
<lastmod>2023-11-08T19:43:02.420Z</lastmod>
<lastmod>2023-11-12T17:33:51.565Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/labs/09/collab_with_git.html</loc>
<lastmod>2023-11-08T19:43:09.288Z</lastmod>
<lastmod>2023-11-12T17:33:58.349Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/index.html</loc>
<lastmod>2023-11-08T19:43:16.912Z</lastmod>
<lastmod>2023-11-12T17:34:05.889Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/units/unit7-bigData.html</loc>
<lastmod>2023-11-08T19:43:30.400Z</lastmod>
<lastmod>2023-11-12T17:34:19.133Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/units/unit4-goodPractices.html</loc>
<lastmod>2023-11-08T19:43:47.924Z</lastmod>
<lastmod>2023-11-12T17:34:36.317Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/units/unit2-dataTech.html</loc>
<lastmod>2023-11-08T19:44:06.716Z</lastmod>
<lastmod>2023-11-12T17:34:54.625Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/units/unit3-bash.html</loc>
<lastmod>2023-11-08T19:44:24.136Z</lastmod>
<lastmod>2023-11-12T17:35:11.569Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/units/unit5-programming.html</loc>
<lastmod>2023-11-08T19:44:44.208Z</lastmod>
<lastmod>2023-11-12T17:35:31.181Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/units/unit1-intro.html</loc>
<lastmod>2023-11-08T19:45:05.816Z</lastmod>
<lastmod>2023-11-12T17:35:52.405Z</lastmod>
</url>
<url>
<loc>https://github.com/berkeley-stat243/stat243-fall-2023/schedule.html</loc>
<lastmod>2023-11-08T19:45:09.891Z</lastmod>
<lastmod>2023-11-12T17:35:56.513Z</lastmod>
</url>
</urlset>
Binary file modified units/test.pdf
Binary file not shown.
Binary file modified units/unit1-intro.pdf
Binary file not shown.
Binary file modified units/unit10-linalg.pdf
Binary file not shown.
48 changes: 25 additions & 23 deletions units/unit11-optim.html
Original file line number Diff line number Diff line change
Expand Up @@ -651,15 +651,15 @@ <h4 class="anchored" data-anchor-id="divergence">Divergence</h4>
<p><img src="unit11-optim_files/figure-html/cell-2-output-2.png" width="600" height="449"></p>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>/tmp/ipykernel_1391300/3161030548.py:58: RuntimeWarning:
<pre><code>/tmp/ipykernel_3661545/3161030548.py:58: RuntimeWarning:

divide by zero encountered in double_scalars

/tmp/ipykernel_1391300/3161030548.py:6: RuntimeWarning:
/tmp/ipykernel_3661545/3161030548.py:6: RuntimeWarning:

invalid value encountered in double_scalars

/tmp/ipykernel_1391300/3161030548.py:10: RuntimeWarning:
/tmp/ipykernel_3661545/3161030548.py:10: RuntimeWarning:

invalid value encountered in double_scalars
</code></pre>
Expand Down Expand Up @@ -905,29 +905,31 @@ <h2 class="anchored" data-anchor-id="profiling">Profiling</h2>
<h2 class="anchored" data-anchor-id="newton-raphson-newtons-method-1">Newton-Raphson (Newton’s method)</h2>
<p>For multivariate <span class="math inline">\(x\)</span> we have the Newton-Raphson update <span class="math inline">\(x_{t+1}=x_{t}-f^{\prime\prime}(x_{t})^{-1}f^{\prime}(x_{t})\)</span>, or in our other notation, <span class="math display">\[x_{t+1}=x_{t}-H_{f}(x_{t})^{-1}\nabla f(x_{t}).\]</span></p>
<p>Let’s consider a very simple example of nonlinear least squares. We’ll use the famous Mauna Loa atmospheric carbon dioxide record.</p>
<p>Let’s suppose (I have no real reason to think this) that we think that the data can be well-represented by this nonlinear model: <span class="math display">\[Y_{i}=\beta_{0}+\beta_{1}\exp(t_i/\beta_{2}+\epsilon_{i}.\]</span></p>
<p>Let’s suppose (I have no real reason to think this) that we think that the data can be well-represented by this nonlinear model: <span class="math display">\[Y_{i}=\beta_{0}+\beta_{1}\exp(t_i/\beta_{2})+\epsilon_{i}.\]</span></p>
<p>Some of the things we need to worry about with Newton’s method in general about are (1) good starting values, (2) positive definiteness of the Hessian, and (3) avoiding errors in deriving the derivatives.</p>
<p>A note on the positive definiteness: since the Hessian may not be positive definite (although it may well be, provided the function is approximately locally quadratic), one can consider modifying the Cholesky decomposition of the Hessian to enforce positive definiteness by adding diagonal elements to <span class="math inline">\(H_{f}\)</span> as necessary.</p>
<div class="cell" data-execution_count="6">
<div class="sourceCode cell-code" id="cb9"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> pandas <span class="im">as</span> pd</span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> statsmodels.api <span class="im">as</span> sm</span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a>data <span class="op">=</span> pd.read_csv(<span class="st">'co2_annmean_mlo.csv'</span>, header <span class="op">=</span> <span class="dv">0</span>, names <span class="op">=</span> [<span class="st">'year'</span>,<span class="st">'co2'</span>,<span class="st">'unc'</span>])</span>
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-5"><a href="#cb9-5" aria-hidden="true" tabindex="-1"></a>plt.scatter(data.year, data.co2)</span>
<span id="cb9-6"><a href="#cb9-6" aria-hidden="true" tabindex="-1"></a>plt.xlabel(<span class="st">'year'</span>)</span>
<span id="cb9-7"><a href="#cb9-7" aria-hidden="true" tabindex="-1"></a>plt.ylabel(<span class="st">"CO2"</span>)</span>
<span id="cb9-8"><a href="#cb9-8" aria-hidden="true" tabindex="-1"></a>plt.show()</span>
<span id="cb9-9"><a href="#cb9-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-10"><a href="#cb9-10" aria-hidden="true" tabindex="-1"></a><span class="co">## Center years for better numerical behavior</span></span>
<span id="cb9-11"><a href="#cb9-11" aria-hidden="true" tabindex="-1"></a>data.year <span class="op">=</span> data.year <span class="op">-</span> np.mean(data.year)</span>
<span id="cb9-12"><a href="#cb9-12" aria-hidden="true" tabindex="-1"></a><span class="co">### Linear fit - not a good model</span></span>
<span id="cb9-13"><a href="#cb9-13" aria-hidden="true" tabindex="-1"></a>X <span class="op">=</span> sm.add_constant(data.year) </span>
<span id="cb9-14"><a href="#cb9-14" aria-hidden="true" tabindex="-1"></a>model <span class="op">=</span> sm.OLS(data.co2, X).fit()</span>
<span id="cb9-15"><a href="#cb9-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-16"><a href="#cb9-16" aria-hidden="true" tabindex="-1"></a>plt.scatter(data.year, data.co2)</span>
<span id="cb9-17"><a href="#cb9-17" aria-hidden="true" tabindex="-1"></a>plt.plot(data.year, model.fittedvalues, <span class="st">'-'</span>)</span>
<span id="cb9-18"><a href="#cb9-18" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-19"><a href="#cb9-19" aria-hidden="true" tabindex="-1"></a>plt.show()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="sourceCode cell-code" id="cb9"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> os</span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> pandas <span class="im">as</span> pd</span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> statsmodels.api <span class="im">as</span> sm</span>
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a>data <span class="op">=</span> pd.read_csv(os.path.join(<span class="st">'..'</span>,<span class="st">'data'</span>, <span class="st">'co2_annmean_mlo.csv'</span>),</span>
<span id="cb9-5"><a href="#cb9-5" aria-hidden="true" tabindex="-1"></a> header <span class="op">=</span> <span class="dv">0</span>, names <span class="op">=</span> [<span class="st">'year'</span>,<span class="st">'co2'</span>,<span class="st">'unc'</span>])</span>
<span id="cb9-6"><a href="#cb9-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-7"><a href="#cb9-7" aria-hidden="true" tabindex="-1"></a>plt.scatter(data.year, data.co2)</span>
<span id="cb9-8"><a href="#cb9-8" aria-hidden="true" tabindex="-1"></a>plt.xlabel(<span class="st">'year'</span>)</span>
<span id="cb9-9"><a href="#cb9-9" aria-hidden="true" tabindex="-1"></a>plt.ylabel(<span class="st">"CO2"</span>)</span>
<span id="cb9-10"><a href="#cb9-10" aria-hidden="true" tabindex="-1"></a>plt.show()</span>
<span id="cb9-11"><a href="#cb9-11" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-12"><a href="#cb9-12" aria-hidden="true" tabindex="-1"></a><span class="co">## Center years for better numerical behavior</span></span>
<span id="cb9-13"><a href="#cb9-13" aria-hidden="true" tabindex="-1"></a>data.year <span class="op">=</span> data.year <span class="op">-</span> np.mean(data.year)</span>
<span id="cb9-14"><a href="#cb9-14" aria-hidden="true" tabindex="-1"></a><span class="co">### Linear fit - not a good model</span></span>
<span id="cb9-15"><a href="#cb9-15" aria-hidden="true" tabindex="-1"></a>X <span class="op">=</span> sm.add_constant(data.year) </span>
<span id="cb9-16"><a href="#cb9-16" aria-hidden="true" tabindex="-1"></a>model <span class="op">=</span> sm.OLS(data.co2, X).fit()</span>
<span id="cb9-17"><a href="#cb9-17" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-18"><a href="#cb9-18" aria-hidden="true" tabindex="-1"></a>plt.scatter(data.year, data.co2)</span>
<span id="cb9-19"><a href="#cb9-19" aria-hidden="true" tabindex="-1"></a>plt.plot(data.year, model.fittedvalues, <span class="st">'-'</span>)</span>
<span id="cb9-20"><a href="#cb9-20" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-21"><a href="#cb9-21" aria-hidden="true" tabindex="-1"></a>plt.show()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display">
<p><img src="unit11-optim_files/figure-html/cell-7-output-1.png" width="593" height="429"></p>
</div>
Expand Down
Binary file modified units/unit11-optim.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified units/unit2-dataTech.pdf
Binary file not shown.
Binary file modified units/unit3-bash.pdf
Binary file not shown.
Binary file modified units/unit4-goodPractices.pdf
Binary file not shown.
Binary file modified units/unit5-programming.pdf
Binary file not shown.
Loading

0 comments on commit e564689

Please sign in to comment.