Skip to content

Commit

Permalink
Notebook updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Benny Avelin committed Jan 2, 2024
1 parent c9012c4 commit 2276a54
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 167 deletions.
Binary file modified Files/LectureNotes1MS041.pdf
Binary file not shown.
Binary file modified Files/first_lecture_and_data.zip
Binary file not shown.
Binary file modified notebooks/.DS_Store
Binary file not shown.
12 changes: 6 additions & 6 deletions notebooks/04-Concentration_and_Limits.html
Original file line number Diff line number Diff line change
Expand Up @@ -13152,10 +13152,10 @@ <h2 id="Concentration-and-limits">Concentration and limits<a class="anchor-link"



<div id="4fb82f25-7823-499e-9f06-1c46f8c77eba"></div>
<div id="f874803c-828a-4a40-ae19-c4b332ab61cb"></div>
<div class="output_subarea output_widget_view ">
<script type="text/javascript">
var element = $('#4fb82f25-7823-499e-9f06-1c46f8c77eba');
var element = $('#f874803c-828a-4a40-ae19-c4b332ab61cb');
</script>
<script type="application/vnd.jupyter.widget-view+json">
{"model_id": "1266cd10c47d4a67bca32a1dee1996bb", "version_major": 2, "version_minor": 0}
Expand Down Expand Up @@ -13212,10 +13212,10 @@ <h2 id="Concentration-and-limits">Concentration and limits<a class="anchor-link"



<div id="870aef81-be4a-4cac-b9f7-7b3844dea453"></div>
<div id="0fbdc5c4-5195-4ecb-af18-d567a8aff735"></div>
<div class="output_subarea output_widget_view ">
<script type="text/javascript">
var element = $('#870aef81-be4a-4cac-b9f7-7b3844dea453');
var element = $('#0fbdc5c4-5195-4ecb-af18-d567a8aff735');
</script>
<script type="application/vnd.jupyter.widget-view+json">
{"model_id": "c2605d5956cb47958a134e70b0eeb5cb", "version_major": 2, "version_minor": 0}
Expand Down Expand Up @@ -13531,10 +13531,10 @@ <h2 id="Being-clever-with-Bennetts-inequality">Being clever with Bennetts inequa



<div id="342c7004-5e15-45fa-8202-bce396358238"></div>
<div id="68b5c012-11ed-43f1-93d5-abced0f9978e"></div>
<div class="output_subarea output_widget_view ">
<script type="text/javascript">
var element = $('#342c7004-5e15-45fa-8202-bce396358238');
var element = $('#68b5c012-11ed-43f1-93d5-abced0f9978e');
</script>
<script type="application/vnd.jupyter.widget-view+json">
{"model_id": "8594730855a746c88fad6b96c79e2fa2", "version_major": 2, "version_minor": 0}
Expand Down
20 changes: 10 additions & 10 deletions notebooks/05-Limits.html
Original file line number Diff line number Diff line change
Expand Up @@ -13848,10 +13848,10 @@ <h3 id="The-$Gaussian(\mu,-\sigma^2)$-or-$Normal(\mu,-\sigma^2)$-RV?">The $Gauss



<div id="5b99df5c-3f0c-49bf-85f2-30787c86c8f7"></div>
<div id="14cb5e1c-12a3-4898-8a32-587da00b7ad2"></div>
<div class="output_subarea output_widget_view ">
<script type="text/javascript">
var element = $('#5b99df5c-3f0c-49bf-85f2-30787c86c8f7');
var element = $('#14cb5e1c-12a3-4898-8a32-587da00b7ad2');
</script>
<script type="application/vnd.jupyter.widget-view+json">
{"model_id": "66d26bba52d14270a8fc4efad4ded4f4", "version_major": 2, "version_minor": 0}
Expand Down Expand Up @@ -14225,10 +14225,10 @@ <h3 id="Weak-Law-of-Large-Numbers">Weak Law of Large Numbers<a class="anchor-lin



<div id="49ba46b5-c024-4f36-9efa-aa1eca43939b"></div>
<div id="5a68785a-dd1a-4570-8b6b-9df46237c3b2"></div>
<div class="output_subarea output_widget_view ">
<script type="text/javascript">
var element = $('#49ba46b5-c024-4f36-9efa-aa1eca43939b');
var element = $('#5a68785a-dd1a-4570-8b6b-9df46237c3b2');
</script>
<script type="application/vnd.jupyter.widget-view+json">
{"model_id": "3f4abef7dcee463aa6484ccbae1492c0", "version_major": 2, "version_minor": 0}
Expand Down Expand Up @@ -14275,10 +14275,10 @@ <h3 id="Weak-Law-of-Large-Numbers">Weak Law of Large Numbers<a class="anchor-lin



<div id="13801b63-8a11-4846-8570-dfd7e686e4e2"></div>
<div id="1d2fedc4-dd27-434a-b631-1eeebf29a166"></div>
<div class="output_subarea output_widget_view ">
<script type="text/javascript">
var element = $('#13801b63-8a11-4846-8570-dfd7e686e4e2');
var element = $('#1d2fedc4-dd27-434a-b631-1eeebf29a166');
</script>
<script type="application/vnd.jupyter.widget-view+json">
{"model_id": "ffc75c33fb7a4dce8c18c3a8d4b61631", "version_major": 2, "version_minor": 0}
Expand Down Expand Up @@ -14347,10 +14347,10 @@ <h2 id="Central-Limit-Theorem">Central Limit Theorem<a class="anchor-link" href=



<div id="1be06433-e5a3-4094-ae65-3f0adbb8af35"></div>
<div id="d46e57ce-fafb-4fa2-8cc1-cb5852b1eb2c"></div>
<div class="output_subarea output_widget_view ">
<script type="text/javascript">
var element = $('#1be06433-e5a3-4094-ae65-3f0adbb8af35');
var element = $('#d46e57ce-fafb-4fa2-8cc1-cb5852b1eb2c');
</script>
<script type="application/vnd.jupyter.widget-view+json">
{"model_id": "4234073f0a0c49b4b26320bbe62733ac", "version_major": 2, "version_minor": 0}
Expand Down Expand Up @@ -14409,10 +14409,10 @@ <h2 id="YouTry">YouTry<a class="anchor-link" href="#YouTry">&#182;</a></h2><p>Tr



<div id="589f0739-f489-4aae-84c9-846e815867d1"></div>
<div id="fb17a68b-9246-4336-8e2f-465a2f00cc3f"></div>
<div class="output_subarea output_widget_view output_execute_result">
<script type="text/javascript">
var element = $('#589f0739-f489-4aae-84c9-846e815867d1');
var element = $('#fb17a68b-9246-4336-8e2f-465a2f00cc3f');
</script>
<script type="application/vnd.jupyter.widget-view+json">
{"model_id": "b3f81d07b3fc4893aca0dfb76f4bcd39", "version_major": 2, "version_minor": 0}
Expand Down
12 changes: 6 additions & 6 deletions notebooks/07-Estimation_Likelihood.html
Original file line number Diff line number Diff line change
Expand Up @@ -13740,10 +13740,10 @@ <h4 id="YouTry">YouTry<a class="anchor-link" href="#YouTry">&#182;</a></h4><p>Tr



<div id="6d60a427-d685-4dc3-8657-f60ced5e8937"></div>
<div id="45637717-cbc1-411e-8383-f46f8a51ccae"></div>
<div class="output_subarea output_widget_view ">
<script type="text/javascript">
var element = $('#6d60a427-d685-4dc3-8657-f60ced5e8937');
var element = $('#45637717-cbc1-411e-8383-f46f8a51ccae');
</script>
<script type="application/vnd.jupyter.widget-view+json">
{"model_id": "43c4a0f3a1a842dc8f80c28bef7b86cb", "version_major": 2, "version_minor": 0}
Expand Down Expand Up @@ -13915,10 +13915,10 @@ <h4 id="YouTry-in-class">YouTry in class<a class="anchor-link" href="#YouTry-in-



<div id="ad6b0c0f-95a2-41cc-b9c1-79131b3f7778"></div>
<div id="d8a4273c-0aae-40da-9b60-02fd077e6edc"></div>
<div class="output_subarea output_widget_view ">
<script type="text/javascript">
var element = $('#ad6b0c0f-95a2-41cc-b9c1-79131b3f7778');
var element = $('#d8a4273c-0aae-40da-9b60-02fd077e6edc');
</script>
<script type="application/vnd.jupyter.widget-view+json">
{"model_id": "ca12c09c89614e33ba09f58d4494dd88", "version_major": 2, "version_minor": 0}
Expand Down Expand Up @@ -13987,10 +13987,10 @@ <h4 id="YouTry-in-class">YouTry in class<a class="anchor-link" href="#YouTry-in-



<div id="e691f7c4-77b4-44a5-9ef9-59eedbf1530c"></div>
<div id="c98deada-5ce2-4228-90b7-182f33fffb35"></div>
<div class="output_subarea output_widget_view ">
<script type="text/javascript">
var element = $('#e691f7c4-77b4-44a5-9ef9-59eedbf1530c');
var element = $('#c98deada-5ce2-4228-90b7-182f33fffb35');
</script>
<script type="application/vnd.jupyter.widget-view+json">
{"model_id": "cace62e58b87449189885f33f1f54f01", "version_major": 2, "version_minor": 0}
Expand Down
8 changes: 4 additions & 4 deletions notebooks/09-Markov_chains.html
Original file line number Diff line number Diff line change
Expand Up @@ -13582,10 +13582,10 @@ <h3 id="Predicting-the-weather-with-our-Dry-Wet-chain">Predicting the weather wi



<div id="1f9acfb4-1aff-4863-a961-423f7a5fa46a"></div>
<div id="5c47ca70-4c51-45bc-a276-7fc729b5ed1d"></div>
<div class="output_subarea output_widget_view ">
<script type="text/javascript">
var element = $('#1f9acfb4-1aff-4863-a961-423f7a5fa46a');
var element = $('#5c47ca70-4c51-45bc-a276-7fc729b5ed1d');
</script>
<script type="application/vnd.jupyter.widget-view+json">
{"model_id": "47fb44f558074ecdb73147e7c1858bba", "version_major": 2, "version_minor": 0}
Expand Down Expand Up @@ -13883,10 +13883,10 @@ <h2 id="Working-with-real-data">Working with real data<a class="anchor-link" hre



<div id="6af6df4e-6208-406c-8fc3-ee8d58d0955f"></div>
<div id="2d3a08d1-11af-4ee9-964c-b7e71fd0ac01"></div>
<div class="output_subarea output_widget_view ">
<script type="text/javascript">
var element = $('#6af6df4e-6208-406c-8fc3-ee8d58d0955f');
var element = $('#2d3a08d1-11af-4ee9-964c-b7e71fd0ac01');
</script>
<script type="application/vnd.jupyter.widget-view+json">
{"model_id": "9f9e3413863b4879bcb32bb3c04dada2", "version_major": 2, "version_minor": 0}
Expand Down
4 changes: 2 additions & 2 deletions notebooks/10-Pattern_Recognition.html
Original file line number Diff line number Diff line change
Expand Up @@ -13265,10 +13265,10 @@ <h2 id="The-perceptron-algorithm">The perceptron algorithm<a class="anchor-link"



<div id="711e7e9c-a2f1-4be7-be86-b7961813781f"></div>
<div id="0445955b-fb3b-42ba-9014-fe9be5b81e15"></div>
<div class="output_subarea output_widget_view ">
<script type="text/javascript">
var element = $('#711e7e9c-a2f1-4be7-be86-b7961813781f');
var element = $('#0445955b-fb3b-42ba-9014-fe9be5b81e15');
</script>
<script type="application/vnd.jupyter.widget-view+json">
{"model_id": "21cd7bac51104427a6eea63be96040cc", "version_major": 2, "version_minor": 0}
Expand Down
4 changes: 2 additions & 2 deletions notebooks/15-Extra_Topics.html
Original file line number Diff line number Diff line change
Expand Up @@ -14622,10 +14622,10 @@ <h1 id="Concentration">Concentration<a class="anchor-link" href="#Concentration"



<div id="640d88e4-8d89-4380-926c-b88c370a6709"></div>
<div id="9b286497-da7d-41ff-a1eb-43dd37e58f44"></div>
<div class="output_subarea output_widget_view ">
<script type="text/javascript">
var element = $('#640d88e4-8d89-4380-926c-b88c370a6709');
var element = $('#9b286497-da7d-41ff-a1eb-43dd37e58f44');
</script>
<script type="application/vnd.jupyter.widget-view+json">
{"model_id": "669736559f30476891eac84e140248a6", "version_major": 2, "version_minor": 0}
Expand Down
95 changes: 6 additions & 89 deletions notebooks/Assignment_2.html
Original file line number Diff line number Diff line change
Expand Up @@ -13387,7 +13387,7 @@ <h2 id="Assignment-2,-PROBLEM-2">Assignment 2, PROBLEM 2<a class="anchor-link" h
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[2]:</div>
<div class="prompt input_prompt">In&nbsp;[&nbsp;]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="c1"># Part 4</span>
Expand All @@ -13407,33 +13407,6 @@ <h2 id="Assignment-2,-PROBLEM-2">Assignment 2, PROBLEM 2<a class="anchor-link" h
</div>
</div>

<div class="output_wrapper">
<div class="output">


<div class="output_area">

<div class="prompt"></div>


<div class="output_subarea output_text output_error">
<pre>
<span class="ansi-red-fg">---------------------------------------------------------------------------</span>
<span class="ansi-red-fg">NameError</span> Traceback (most recent call last)
<span class="ansi-green-fg">/var/folders/5g/369s7l6x1g583_lv3wwblvr00000gq/T/ipykernel_5369/343110048.py</span> in <span class="ansi-cyan-fg">&lt;cell line: 5&gt;</span><span class="ansi-blue-fg">()</span>
<span class="ansi-green-intense-fg ansi-bold"> 3</span>
<span class="ansi-green-intense-fg ansi-bold"> 4</span> <span class="ansi-red-fg"># Initialize your PoissonRegression model</span>
<span class="ansi-green-fg">----&gt; 5</span><span class="ansi-red-fg"> </span>problem2_model <span class="ansi-blue-fg">=</span> XXX
<span class="ansi-green-intense-fg ansi-bold"> 6</span>
<span class="ansi-green-intense-fg ansi-bold"> 7</span> <span class="ansi-red-fg"># Fit your initialized model on the training data</span>

<span class="ansi-red-fg">NameError</span>: name &#39;XXX&#39; is not defined</pre>
</div>
</div>

</div>
</div>

</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
Expand Down Expand Up @@ -13480,7 +13453,7 @@ <h2 id="Random-variable-generation-and-transformation">Random variable generatio
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[8]:</div>
<div class="prompt input_prompt">In&nbsp;[&nbsp;]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">problem3_LCG</span><span class="p">(</span><span class="n">size</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">seed</span> <span class="o">=</span> <span class="mi">0</span><span class="p">):</span>
Expand Down Expand Up @@ -13509,7 +13482,7 @@ <h2 id="Random-variable-generation-and-transformation">Random variable generatio
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[9]:</div>
<div class="prompt input_prompt">In&nbsp;[&nbsp;]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">problem3_uniform</span><span class="p">(</span><span class="n">generator</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">period</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">seed</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span>
Expand Down Expand Up @@ -13541,7 +13514,7 @@ <h2 id="Random-variable-generation-and-transformation">Random variable generatio
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[10]:</div>
<div class="prompt input_prompt">In&nbsp;[&nbsp;]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">problem3_accept_reject</span><span class="p">(</span><span class="n">uniformGenerator</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">n_iterations</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">seed</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span>
Expand Down Expand Up @@ -13585,7 +13558,7 @@ <h4 id="Local-Test-for-Assignment-2,-PROBLEM-3">Local Test for Assignment 2, PRO
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[16]:</div>
<div class="prompt input_prompt">In&nbsp;[&nbsp;]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="c1"># If you managed to solve all three parts you can test the following code to see if it runs</span>
Expand All @@ -13608,48 +13581,10 @@ <h4 id="Local-Test-for-Assignment-2,-PROBLEM-3">Local Test for Assignment 2, PRO
</div>
</div>

<div class="output_wrapper">
<div class="output">


<div class="output_area">

<div class="prompt"></div>


<div class="output_subarea output_stream output_stdout output_text">
<pre>LCG output: [1, 65539, 393225, 1769499, 7077969, 26542323, 95552217, 334432395, 1146624417, 1722371299]
</pre>
</div>
</div>

<div class="output_area">

<div class="prompt"></div>


<div class="output_subarea output_text output_error">
<pre>
<span class="ansi-red-fg">---------------------------------------------------------------------------</span>
<span class="ansi-red-fg">NameError</span> Traceback (most recent call last)
<span class="ansi-green-fg">/var/folders/5g/369s7l6x1g583_lv3wwblvr00000gq/T/ipykernel_6208/3162269102.py</span> in <span class="ansi-cyan-fg">&lt;cell line: 10&gt;</span><span class="ansi-blue-fg">()</span>
<span class="ansi-green-intense-fg ansi-bold"> 8</span> print<span class="ansi-blue-fg">(</span><span class="ansi-blue-fg">&#34;LCG output: %s&#34;</span> <span class="ansi-blue-fg">%</span> problem3_LCG<span class="ansi-blue-fg">(</span>size<span class="ansi-blue-fg">=</span><span class="ansi-cyan-fg">10</span><span class="ansi-blue-fg">,</span> seed <span class="ansi-blue-fg">=</span> <span class="ansi-cyan-fg">1</span><span class="ansi-blue-fg">)</span><span class="ansi-blue-fg">)</span>
<span class="ansi-green-intense-fg ansi-bold"> 9</span>
<span class="ansi-green-fg">---&gt; 10</span><span class="ansi-red-fg"> </span>period <span class="ansi-blue-fg">=</span> XXX
<span class="ansi-green-intense-fg ansi-bold"> 11</span>
<span class="ansi-green-intense-fg ansi-bold"> 12</span> print<span class="ansi-blue-fg">(</span><span class="ansi-blue-fg">&#34;Uniform sampler %s&#34;</span> <span class="ansi-blue-fg">%</span> problem3_uniform<span class="ansi-blue-fg">(</span>generator<span class="ansi-blue-fg">=</span>problem3_LCG<span class="ansi-blue-fg">,</span> period <span class="ansi-blue-fg">=</span> period<span class="ansi-blue-fg">,</span> size<span class="ansi-blue-fg">=</span><span class="ansi-cyan-fg">10</span><span class="ansi-blue-fg">,</span> seed<span class="ansi-blue-fg">=</span><span class="ansi-cyan-fg">1</span><span class="ansi-blue-fg">)</span><span class="ansi-blue-fg">)</span>

<span class="ansi-red-fg">NameError</span>: name &#39;XXX&#39; is not defined</pre>
</div>
</div>

</div>
</div>

</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[17]:</div>
<div class="prompt input_prompt">In&nbsp;[&nbsp;]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="c1"># If however you did not manage to implement either part 1 or part 2 but still want to check part 3, you can run the code below</span>
Expand All @@ -13667,24 +13602,6 @@ <h4 id="Local-Test-for-Assignment-2,-PROBLEM-3">Local Test for Assignment 2, PRO
</div>
</div>

<div class="output_wrapper">
<div class="output">


<div class="output_area">

<div class="prompt"></div>


<div class="output_subarea output_stream output_stdout output_text">
<pre>Accept-Reject sampler [0.13436424411240122, 0.8474337369372327, 0.763774618976614, 0.2550690257394217, 0.651592972722763, 0.7887233511355132, 0.0938595867742349, 0.8357651039198697, 0.43276706790505337, 0.762280082457942, 0.4453871940548014, 0.7215400323407826, 0.22876222127045265, 0.030589983033553536]
</pre>
</div>
</div>

</div>
</div>

</div>
</div>
</div>
Expand Down
Loading

0 comments on commit 2276a54

Please sign in to comment.