Updated for Python 3.6
This commit is contained in:
parent
bf04f49fa7
commit
8302572e60
@ -20,7 +20,6 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from __future__ import division, print_function\n",
|
||||
"%matplotlib inline"
|
||||
]
|
||||
},
|
||||
@ -36,7 +35,7 @@
|
||||
" <style>\n",
|
||||
" .output_wrapper, .output {\n",
|
||||
" height:auto !important;\n",
|
||||
" max-height:100000px; \n",
|
||||
" max-height:100000px;\n",
|
||||
" }\n",
|
||||
" .output_scroll {\n",
|
||||
" box-shadow:none !important;\n",
|
||||
@ -582,7 +581,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "6a0f5d2b16e54121bd8a3b11957d0966",
|
||||
"model_id": "69e1cf784fd743ddaeae41d5fa161216",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
@ -758,7 +757,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "5e1bbeaf87af4835869cd7a6676fa209",
|
||||
"model_id": "b7f90f29b9394f82b4c64982c8eab901",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
@ -783,7 +782,7 @@
|
||||
"# make interactive plot\n",
|
||||
"def show_prior(step):\n",
|
||||
" book_plots.bar_plot(predict_beliefs[step-1])\n",
|
||||
" plt.title('Step {}'.format(step))\n",
|
||||
" plt.title(f'Step {step}')\n",
|
||||
"\n",
|
||||
"interact(show_prior, step=IntSlider(value=1, max=len(predict_beliefs)));"
|
||||
]
|
||||
@ -1247,7 +1246,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "9f7338d5d95a4133ae3825b18020b9cd",
|
||||
"model_id": "5e52dc4ac04b4244ad4357a4fd837902",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
@ -1300,7 +1299,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "ffb4353460494a15ab0c0e9299dde120",
|
||||
"model_id": "562f60dcb79f4651953d34fd40c1cab7",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
@ -1382,7 +1381,7 @@
|
||||
" posterior = update(likelihood, prior)\n",
|
||||
" prior = predict(posterior, 1, kernel)\n",
|
||||
" plt.subplot(5, 2, i+1)\n",
|
||||
" book_plots.bar_plot(posterior, ylim=(0, .4), title='step {}'.format(i+1))\n",
|
||||
" book_plots.bar_plot(posterior, ylim=(0, .4), title=f'step {i+1}')\n",
|
||||
" plt.tight_layout()"
|
||||
]
|
||||
},
|
||||
@ -1515,13 +1514,9 @@
|
||||
" index = np.argmax(posterior)\n",
|
||||
"\n",
|
||||
" if do_print:\n",
|
||||
" print('''time {}: pos {}, sensed {}, '''\n",
|
||||
" '''at position {}'''.format(\n",
|
||||
" i, robot.pos, m, track[robot.pos]))\n",
|
||||
"\n",
|
||||
" print(''' estimated position is {}'''\n",
|
||||
" ''' with confidence {:.4f}%:'''.format(\n",
|
||||
" index, posterior[index]*100)) \n",
|
||||
" print(f'time {i}: pos {robot.pos}, sensed {m}, at position {track[robot.pos]}')\n",
|
||||
" conf = posterior[index] * 100\n",
|
||||
" print(f' estimated position is {index} with confidence {conf:.4f}%:') \n",
|
||||
"\n",
|
||||
" book_plots.bar_plot(posterior)\n",
|
||||
" if do_print:\n",
|
||||
@ -1661,7 +1656,7 @@
|
||||
" train_filter(148+i, kernel=[.1, .8, .1], \n",
|
||||
" sensor_accuracy=.8,\n",
|
||||
" move_distance=4, do_print=False)\n",
|
||||
" plt.title ('iteration {}'.format(148+i))"
|
||||
" plt.title (f'iteration {148 + i}')"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -1777,7 +1772,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.6"
|
||||
"version": "3.7.4"
|
||||
},
|
||||
"widgets": {
|
||||
"application/vnd.jupyter.widget-state+json": {
|
||||
|
Loading…
Reference in New Issue
Block a user