Skip to content

Commit

Permalink
deploy: c884c52
Browse files Browse the repository at this point in the history
  • Loading branch information
dellaert committed Feb 9, 2024
1 parent f6b6a71 commit 834a953
Show file tree
Hide file tree
Showing 51 changed files with 290 additions and 281 deletions.
12 changes: 8 additions & 4 deletions S21_sorter_state.html
Original file line number Diff line number Diff line change
Expand Up @@ -702,15 +702,19 @@ <h3><span class="section-number">2.1.5.1. </span>Cumulative Distribution Functio
each of which is assigned a probability value.
For a random variable <span class="math notranslate nohighlight">\(X\)</span>, the CDF for <span class="math notranslate nohighlight">\(X\)</span> is denoted by <span class="math notranslate nohighlight">\(F_X\)</span>, and is defined as</p>
<div class="math notranslate nohighlight">
\[F_X(\alpha) = P(X \leq \alpha)\]</div>
\[
F_X(\alpha) = P(X \leq \alpha)
\]</div>
<p>It follows immediately that <span class="math notranslate nohighlight">\(0 \leq F_X(\alpha) \leq 1\)</span>,
since <span class="math notranslate nohighlight">\(F_X(\alpha)\)</span> is itself a probability.
In the case of discrete random variables,
say <span class="math notranslate nohighlight">\(X \in \{ x_0, \dots x_{n-1}\}\)</span>, we can compute the CDF
<span class="math notranslate nohighlight">\(F_X(\alpha)\)</span> by summing the probabilities assigned
to all <span class="math notranslate nohighlight">\(x_i \leq \alpha\)</span></p>
<div class="math notranslate nohighlight">
\[F_X(\alpha) = \sum_{x_i \leq \alpha} P(x_i) = \sum_{i=0}^{k-1} P(x_i)\]</div>
\[
F_X(\alpha) = \sum_{x_i \leq \alpha} P(x_i) = \sum_{i=0}^{k-1} P(x_i)
\]</div>
<p>in which the rightmost summation follows if we choose <span class="math notranslate nohighlight">\(k\)</span> such that <span class="math notranslate nohighlight">\(x_{k-1} \leq \alpha &lt; x_k\)</span>.
The terminology <em>Cumulative Distribution Function</em> is due to the fact that <span class="math notranslate nohighlight">\(F_X(\alpha)\)</span>
is the accumulated probability assigned to all outcomes less than or equal to <span class="math notranslate nohighlight">\(\alpha\)</span>,
Expand Down Expand Up @@ -810,7 +814,7 @@ <h3><span class="section-number">2.1.5.2. </span>Example<a class="headerlink" hr
</div>
</div>
<div class="cell_output docutils container">
<img alt="_images/65683d37cbde553ec35a114415141424b5355dd030cbe3161ad6650d8a647388.png" src="_images/65683d37cbde553ec35a114415141424b5355dd030cbe3161ad6650d8a647388.png" />
<img alt="_images/c7dc844bf0bc2c2504a55901fd204564725035b23ed7d1764b00e9cbb8c87b91.png" src="_images/c7dc844bf0bc2c2504a55901fd204564725035b23ed7d1764b00e9cbb8c87b91.png" />
</div>
</div>
<p>Of course, GTSAM has all this machinery built-in:</p>
Expand Down Expand Up @@ -881,7 +885,7 @@ <h2><span class="section-number">2.1.6. </span>GTSAM 101<a class="headerlink" hr
</div>
</div>
<div class="cell_output docutils container">
<img alt="_images/3b95c0cfe61f50484cfdcefeeb53d1a28fb77d57d157daaedf9eb9c9a0a9c6b8.svg" src="_images/3b95c0cfe61f50484cfdcefeeb53d1a28fb77d57d157daaedf9eb9c9a0a9c6b8.svg" /></div>
<img alt="_images/bff00db02039df0e59e0f1042b380d7327114345189d6b4787d77d502141b535.svg" src="_images/bff00db02039df0e59e0f1042b380d7327114345189d6b4787d77d502141b535.svg" /></div>
</div>
<p>Of course, it would be much nicer if we could print out these PMFs in a more readable format, that shows us a name for each variable as well as a pretty name for each. This is where the <code class="docutils literal notranslate"><span class="pre">Variables</span></code> class comes to the rescue. We actually defined a global variable at the top of this notebook, like so:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">VARIABLES</span> <span class="o">=</span> <span class="n">Variables</span><span class="p">()</span>
Expand Down
30 changes: 15 additions & 15 deletions S23_sorter_sensing.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions S24_sorter_perception.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions S26_sorter_learning.html
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ <h2><span class="section-number">2.6.3. </span>Fitting a Gaussian<a class="heade
</div>
</div>
<div class="cell_output docutils container">
<img alt="_images/37aaa7286164099623dab1069f4d2d3763e8d1907f58db0ac0ae34fedf0940c9.png" src="_images/37aaa7286164099623dab1069f4d2d3763e8d1907f58db0ac0ae34fedf0940c9.png" />
<img alt="_images/cf46232233f3d523eba4af9d7dcf7eb322d8ee9bb5aeaebec7269ba10f08a2c9.png" src="_images/cf46232233f3d523eba4af9d7dcf7eb322d8ee9bb5aeaebec7269ba10f08a2c9.png" />
</div>
</div>
<p>The sample mean is easy enough to compute with <code class="docutils literal notranslate"><span class="pre">np.mean</span></code> :</p>
Expand All @@ -776,7 +776,7 @@ <h2><span class="section-number">2.6.3. </span>Fitting a Gaussian<a class="heade
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>198.6340293170214
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>197.80988617492557
</pre></div>
</div>
</div>
Expand All @@ -788,7 +788,7 @@ <h2><span class="section-number">2.6.3. </span>Fitting a Gaussian<a class="heade
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>2962.6911328377964
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>2387.0831525246535
</pre></div>
</div>
</div>
Expand All @@ -805,7 +805,7 @@ <h2><span class="section-number">2.6.3. </span>Fitting a Gaussian<a class="heade
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>2962.6911328377964
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>2387.0831525246535
</pre></div>
</div>
</div>
Expand All @@ -819,7 +819,7 @@ <h2><span class="section-number">2.6.3. </span>Fitting a Gaussian<a class="heade
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>54.43060841877295
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>48.857784973580756
</pre></div>
</div>
</div>
Expand All @@ -838,7 +838,7 @@ <h3><span class="section-number">2.6.3.1. </span>Comparison<a class="headerlink"
</div>
</div>
<div class="cell_output docutils container">
<img alt="_images/1d6500e4974e0c7140e9f92627879df162ce0e7cfa74c712bfdc443376166a04.png" src="_images/1d6500e4974e0c7140e9f92627879df162ce0e7cfa74c712bfdc443376166a04.png" />
<img alt="_images/5eb7ae3f5f412c838ce4a7205a2a3adfa84e68247ab96497fa64e4e6acf5ed6a.png" src="_images/5eb7ae3f5f412c838ce4a7205a2a3adfa84e68247ab96497fa64e4e6acf5ed6a.png" />
</div>
</div>
</section>
Expand Down
4 changes: 3 additions & 1 deletion S35_vacuum_decision.html
Original file line number Diff line number Diff line change
Expand Up @@ -1528,7 +1528,9 @@ <h2><span class="section-number">3.5.10. </span>Policy Iteration<a class="header
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>V(Living Room) ~ 100.00
V(Kitchen) ~ 97.93
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>V(Kitchen) ~ 97.93
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>V(Office) ~ 83.87
Expand Down
26 changes: 13 additions & 13 deletions S36_vacuum_RL.html
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ <h2><span class="section-number">3.6.1. </span>Exploring to get Data<a class="he
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[(0, 3, 0, 10.0), (0, 2, 0, 10.0), (0, 2, 0, 10.0), (0, 1, 1, 0.0), (1, 2, 1, 0.0), (1, 1, 1, 0.0), (1, 0, 1, 0.0), (1, 3, 4, 0.0), (4, 0, 3, 0.0), (3, 2, 0, 10.0)]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[(0, 1, 0, 10.0), (0, 1, 1, 0.0), (1, 3, 4, 0.0), (4, 1, 4, 0.0), (4, 3, 4, 0.0), (4, 3, 4, 0.0), (4, 3, 4, 0.0), (4, 2, 1, 0.0), (1, 3, 4, 0.0), (4, 2, 1, 0.0)]
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -539,11 +539,11 @@ <h2><span class="section-number">3.6.2. </span>Model-based Reinforcement Learnin
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([[31., 30., 18., 28.],
[22., 17., 20., 21.],
[23., 29., 30., 27.],
[32., 22., 37., 29.],
[26., 18., 18., 21.]])
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([[24., 28., 18., 32.],
[29., 35., 27., 34.],
[14., 19., 13., 12.],
[21., 28., 31., 21.],
[30., 25., 29., 29.]])
</pre></div>
</div>
</div>
Expand All @@ -565,9 +565,9 @@ <h2><span class="section-number">3.6.2. </span>Model-based Reinforcement Learnin
[0.2 0. 0. 0.8 0. ]]
estimate:
[[1. 0. 0. 0. 0. ]
[0.23 0.77 0. 0. 0. ]
[0.18 0.82 0. 0. 0. ]
[1. 0. 0. 0. 0. ]
[0.14 0. 0. 0.86 0. ]]
[0.28 0. 0. 0.72 0. ]]
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -648,11 +648,11 @@ <h2><span class="section-number">3.6.3. </span>Model-free Reinforcement Learning
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[86.70211629 73.92560687 84.82451606 75.7382256 ]
[75.0942299 56.43288982 58.33338122 60.55427454]
[57.94347218 69.3559028 57.35058894 57.34364813]
[68.21469875 66.6655402 86.03207937 75.58406713]
[76.55631106 33.77706833 51.86944363 53.49981775]]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[78.93020597 68.43790847 79.2265916 70.19747899]
[77.97001819 65.01556908 66.23088985 62.20487454]
[40.01926133 55.1184683 43.80518768 33.65701515]
[57.60159025 57.09919101 78.79383003 62.18317566]
[64.95435886 55.98356842 66.61619122 55.05141338]]
</pre></div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion S41_logistics_state.html
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ <h2><span class="section-number">4.1.3. </span>A Sampling-based representation.<
</div>
</div>
<div class="cell_output docutils container">
<img alt="_images/633b2d2f81298f39cd99bd54a73ca327ff393b702b76756365ed18e225197119.png" src="_images/633b2d2f81298f39cd99bd54a73ca327ff393b702b76756365ed18e225197119.png" />
<img alt="_images/4f21ebd353861c1d124c14b74b01f5ac7388d0a9ee78bcf9808f02b8388a0b65.png" src="_images/4f21ebd353861c1d124c14b74b01f5ac7388d0a9ee78bcf9808f02b8388a0b65.png" />
</div>
</div>
</section>
Expand Down
28 changes: 14 additions & 14 deletions S44_logistics_perception.html
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,8 @@ <h3><span class="section-number">4.4.3.2. </span>Warehouse Example<a class="head
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>CPU times: user 20 s, sys: 0 ns, total: 20 s
Wall time: 20 s
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>CPU times: user 19.6 s, sys: 0 ns, total: 19.6 s
Wall time: 19.6 s
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -760,8 +760,8 @@ <h3><span class="section-number">4.4.3.2. </span>Warehouse Example<a class="head
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>CPU times: user 6.92 s, sys: 0 ns, total: 6.92 s
Wall time: 6.91 s
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>CPU times: user 6.79 s, sys: 1.12 ms, total: 6.79 s
Wall time: 6.79 s
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -856,7 +856,7 @@ <h3><span class="section-number">4.4.4.1. </span>The Prediction Step<a class="he
</div>
</div>
<div class="cell_output docutils container">
<img alt="_images/cf6faeac6a341c84aa4cbf302d7c2792834b3665cfc937302c27d9f2dbcb6155.png" src="_images/cf6faeac6a341c84aa4cbf302d7c2792834b3665cfc937302c27d9f2dbcb6155.png" />
<img alt="_images/49ec6c0e0a6ed559b5410e2019659fdaf6fd3bf1cc6457e5c41c1a284d33420e.png" src="_images/49ec6c0e0a6ed559b5410e2019659fdaf6fd3bf1cc6457e5c41c1a284d33420e.png" />
</div>
</div>
<p>As you can see the first component is chosen much more often, which is exactly what we expect.</p>
Expand Down Expand Up @@ -903,7 +903,7 @@ <h3><span class="section-number">4.4.4.3. </span>MCL Warehouse Example<a class="
</div>
</div>
<div class="cell_output docutils container">
<img alt="_images/5aaf3686aeaa58ee1a4ad954e12c310647619abce2e467bd9421e24660c3f8c4.png" src="_images/5aaf3686aeaa58ee1a4ad954e12c310647619abce2e467bd9421e24660c3f8c4.png" />
<img alt="_images/4813fe7d1c0667fb57c2642b8bad7df9f11b5c33f67842e28fe6a60591c54773.png" src="_images/4813fe7d1c0667fb57c2642b8bad7df9f11b5c33f67842e28fe6a60591c54773.png" />
</div>
</div>
<p>Compare this sampling-based representation with the Markov localization representation of the prior above, and note they represent the <em>same</em> density, but using vastly different representations. In fact, they also use vastly different resources: for Markov localization we used 5000 cells, and here we use 500 samples, each represented as a two-dimensional vector. In higher-dimensional state spaces this difference is even greater: what would happen if we wanted to represent orientation as well?</p>
Expand All @@ -919,7 +919,7 @@ <h3><span class="section-number">4.4.4.3. </span>MCL Warehouse Example<a class="
</div>
</div>
<div class="cell_output docutils container">
<img alt="_images/84dc5c13257c73380376bf4965af918b79bfd8a79a87f4a0a34427441d226cef.png" src="_images/84dc5c13257c73380376bf4965af918b79bfd8a79a87f4a0a34427441d226cef.png" />
<img alt="_images/1f10cee2af65e9aac62430f7536896a072a1e1146b543aeae15efb04387a0c8f.png" src="_images/1f10cee2af65e9aac62430f7536896a072a1e1146b543aeae15efb04387a0c8f.png" />
</div>
</div>
<p>Note that all samples close to the wall and/or the shelves have disappeared, as they have zero weight. All remaining samples have the same weight.</p>
Expand All @@ -938,8 +938,8 @@ <h3><span class="section-number">4.4.4.3. </span>MCL Warehouse Example<a class="
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>CPU times: user 457 ms, sys: 0 ns, total: 457 ms
Wall time: 456 ms
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>CPU times: user 429 ms, sys: 3.89 ms, total: 433 ms
Wall time: 432 ms
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -996,7 +996,7 @@ <h3><span class="section-number">4.4.4.4. </span>Adding Range Sensing<a class="h
</div>
</div>
<div class="cell_output docutils container">
<img alt="_images/b5f212fdc80f03ed061be24ae19b4983c7e817d1a5278c8a25f81c59d6fe7b6f.png" src="_images/b5f212fdc80f03ed061be24ae19b4983c7e817d1a5278c8a25f81c59d6fe7b6f.png" />
<img alt="_images/cb35ed78b8c3043ea7bbe5670d0122e93281d31b2c440b3727472a9191bd593f.png" src="_images/cb35ed78b8c3043ea7bbe5670d0122e93281d31b2c440b3727472a9191bd593f.png" />
</div>
</div>
<p>The first range measurement happens to be out of range, and we can see the effect on our estimate for the posterior <span class="math notranslate nohighlight">\(p(x_1|z_1)\)</span> quite clearly:</p>
Expand All @@ -1011,7 +1011,7 @@ <h3><span class="section-number">4.4.4.4. </span>Adding Range Sensing<a class="h
</div>
</div>
<div class="cell_output docutils container">
<img alt="_images/53ed83af5291ea884342b1814419470fa01ce36d60ef9bb32700c525bb2b6c51.png" src="_images/53ed83af5291ea884342b1814419470fa01ce36d60ef9bb32700c525bb2b6c51.png" />
<img alt="_images/c845f8d520184ea04a61ac94fce7fe81bb56170b80864c6d9ed756e5c0b71c6f.png" src="_images/c845f8d520184ea04a61ac94fce7fe81bb56170b80864c6d9ed756e5c0b71c6f.png" />
</div>
</div>
<p>As expected, the likelihood has “punched holes” around the beacons, because we <em>know</em> we cannot have been near them. When we combine this with the proximity OFF measurement, we improve our posterior even more:</p>
Expand All @@ -1024,7 +1024,7 @@ <h3><span class="section-number">4.4.4.4. </span>Adding Range Sensing<a class="h
</div>
</div>
<div class="cell_output docutils container">
<img alt="_images/1d2405da1179087d96461b8dbd7fc94b963514b7400868ce674279aabb49575b.png" src="_images/1d2405da1179087d96461b8dbd7fc94b963514b7400868ce674279aabb49575b.png" />
<img alt="_images/732ddd26d39ee20437b3eaa77fba8aa4e0e781d5624378d143dbdc9ef20da686.png" src="_images/732ddd26d39ee20437b3eaa77fba8aa4e0e781d5624378d143dbdc9ef20da686.png" />
</div>
</div>
<p>We are now ready to bring it all together by multiplying <em>two</em> likelihoods in every measurement update phase:</p>
Expand All @@ -1046,8 +1046,8 @@ <h3><span class="section-number">4.4.4.4. </span>Adding Range Sensing<a class="h
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>CPU times: user 489 ms, sys: 0 ns, total: 489 ms
Wall time: 489 ms
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>CPU times: user 466 ms, sys: 0 ns, total: 466 ms
Wall time: 466 ms
</pre></div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions S45_logistics_planning.html
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,8 @@ <h2><span class="section-number">4.5.1. </span>Value Iteration in 2D<a class="he
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>after 86 iterations, error = 0.0
CPU times: user 2.27 s, sys: 0 ns, total: 2.27 s
Wall time: 2.27 s
CPU times: user 2.26 s, sys: 0 ns, total: 2.26 s
Wall time: 2.26 s
</pre></div>
</div>
</div>
Expand Down
Loading

0 comments on commit 834a953

Please sign in to comment.