{
 "metadata": {
  "name": "",
  "signature": "sha256:95c1c7e7d8e05c5083e2c87d6ec8af7a1d7b140105ad8ac41a8f558311c8e42f"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "[Table of Contents](http://nbviewer.ipython.org/github/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/table_of_contents.ipynb)"
     ]
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Discrete Bayes Filter"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#format the book\n",
      "%matplotlib inline\n",
      "from __future__ import division, print_function\n",
      "import matplotlib.pyplot as plt\n",
      "import sys\n",
      "sys.path.insert(0, '../code') # allow us to format the book\n",
      "import book_format\n",
      "book_format.load_style()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "html": [
        "<style>\n",
        "@import url('http://fonts.googleapis.com/css?family=Source+Code+Pro');\n",
        "@import url('http://fonts.googleapis.com/css?family=Vollkorn');\n",
        "@import url('http://fonts.googleapis.com/css?family=Arimo');\n",
        "\n",
        "    div.cell{\n",
        "        width: 850px;\n",
        "        margin-left: 0% !important;\n",
        "        margin-right: auto;\n",
        "    }\n",
        "    div.text_cell code {\n",
        "        background: transparent;\n",
        "        color: #000000;\n",
        "        font-weight: 600;\n",
        "        font-size: 11pt;\n",
        "        font-style: bold;\n",
        "        font-family:  'Source Code Pro', Consolas, monocco, monospace;\n",
        "   }\n",
        "    h1 {\n",
        "        font-family: 'Open sans',verdana,arial,sans-serif;\n",
        "\t}\n",
        "\t\n",
        "    div.input_area {\n",
        "        background: #F6F6F9;\n",
        "        border: 1px solid #586e75;\n",
        "    }\n",
        "\n",
        "    .text_cell_render h1 {\n",
        "        font-weight: 200;\n",
        "        font-size: 30pt;\n",
        "        line-height: 100%;\n",
        "        color:#c76c0c;\n",
        "        margin-bottom: 0.5em;\n",
        "        margin-top: 1em;\n",
        "        display: block;\n",
        "        white-space: wrap;\n",
        "    } \n",
        "    h2 {\n",
        "        font-family: 'Open sans',verdana,arial,sans-serif;\n",
        "    }\n",
        "    .text_cell_render h2 {\n",
        "        font-weight: 200;\n",
        "        font-size: 20pt;\n",
        "        font-style: italic;\n",
        "        line-height: 100%;\n",
        "        color:#c76c0c;\n",
        "        margin-bottom: 0.5em;\n",
        "        margin-top: 1.5em;\n",
        "        display: block;\n",
        "        white-space: nowrap;\n",
        "    } \n",
        "    h3 {\n",
        "        font-family: 'Open sans',verdana,arial,sans-serif;\n",
        "    }\n",
        "    .text_cell_render h3 {\n",
        "        font-weight: 300;\n",
        "        font-size: 18pt;\n",
        "        line-height: 100%;\n",
        "        color:#d77c0c;\n",
        "        margin-bottom: 0.5em;\n",
        "        margin-top: 2em;\n",
        "        display: block;\n",
        "        white-space: nowrap;\n",
        "    }\n",
        "    h4 {\n",
        "        font-family: 'Open sans',verdana,arial,sans-serif;\n",
        "    }\n",
        "    .text_cell_render h4 {\n",
        "        font-weight: 300;\n",
        "        font-size: 16pt;\n",
        "        color:#d77c0c;\n",
        "        margin-bottom: 0.5em;\n",
        "        margin-top: 0.5em;\n",
        "        display: block;\n",
        "        white-space: nowrap;\n",
        "    }\n",
        "    h5 {\n",
        "        font-family: 'Open sans',verdana,arial,sans-serif;\n",
        "    }\n",
        "    .text_cell_render h5 {\n",
        "        font-weight: 300;\n",
        "        font-style: normal;\n",
        "        color: #1d3b84;\n",
        "        font-size: 16pt;\n",
        "        margin-bottom: 0em;\n",
        "        margin-top: 1.5em;\n",
        "        display: block;\n",
        "        white-space: nowrap;\n",
        "    }\n",
        "    div.text_cell_render{\n",
        "        font-family: 'Arimo',verdana,arial,sans-serif;\n",
        "        line-height: 135%;\n",
        "        font-size: 125%;\n",
        "        width:750px;\n",
        "        margin-left:auto;\n",
        "        margin-right:auto;\n",
        "        text-align:justify;\n",
        "        text-justify:inter-word;\n",
        "    }\n",
        "    div.output_subarea.output_text.output_pyout {\n",
        "        overflow-x: auto;\n",
        "        overflow-y: scroll;\n",
        "        max-height: 50000px;\n",
        "    }\n",
        "    div.output_subarea.output_stream.output_stdout.output_text {\n",
        "        overflow-x: auto;\n",
        "        overflow-y: scroll;\n",
        "        max-height: 50000px;\n",
        "    }\n",
        "    code{\n",
        "      font-size: 70%;\n",
        "    }\n",
        "    .rendered_html code{\n",
        "    background-color: transparent;\n",
        "    }\n",
        "    ul{\n",
        "        margin: 2em;\n",
        "    }\n",
        "    ul li{\n",
        "        padding-left: 0.5em; \n",
        "        margin-bottom: 0.5em; \n",
        "        margin-top: 0.5em; \n",
        "    }\n",
        "    ul li li{\n",
        "        padding-left: 0.2em; \n",
        "        margin-bottom: 0.2em; \n",
        "        margin-top: 0.2em; \n",
        "    }\n",
        "    ol{\n",
        "        margin: 2em;\n",
        "    }\n",
        "    ol li{\n",
        "        padding-left: 0.5em; \n",
        "        margin-bottom: 0.5em; \n",
        "        margin-top: 0.5em; \n",
        "    }\n",
        "    ul li{\n",
        "        padding-left: 0.5em; \n",
        "        margin-bottom: 0.5em; \n",
        "        margin-top: 0.2em; \n",
        "    }\n",
        "    a:link{\n",
        "       font-weight: bold;\n",
        "       color:#447adb;\n",
        "    }\n",
        "    a:visited{\n",
        "       font-weight: bold;\n",
        "       color: #1d3b84;\n",
        "    }\n",
        "    a:hover{\n",
        "       font-weight: bold;\n",
        "       color: #1d3b84;\n",
        "    }\n",
        "    a:focus{\n",
        "       font-weight: bold;\n",
        "       color:#447adb;\n",
        "    }\n",
        "    a:active{\n",
        "       font-weight: bold;\n",
        "       color:#447adb;\n",
        "    }\n",
        "    .rendered_html :link {\n",
        "       text-decoration: underline; \n",
        "    }\n",
        "    .rendered_html :hover {\n",
        "       text-decoration: none; \n",
        "    }\n",
        "    .rendered_html :visited {\n",
        "      text-decoration: none;\n",
        "    }\n",
        "    .rendered_html :focus {\n",
        "      text-decoration: none;\n",
        "    }\n",
        "    .rendered_html :active {\n",
        "      text-decoration: none;\n",
        "    }\n",
        "    .warning{\n",
        "        color: rgb( 240, 20, 20 )\n",
        "    } \n",
        "    hr {\n",
        "      color: #f3f3f3;\n",
        "      background-color: #f3f3f3;\n",
        "      height: 1px;\n",
        "    }\n",
        "    blockquote{\n",
        "      display:block;\n",
        "      background: #fcfcfc;\n",
        "      border-left: 5px solid #c76c0c;\n",
        "      font-family: 'Open sans',verdana,arial,sans-serif;\n",
        "      width:680px;\n",
        "      padding: 10px 10px 10px 10px;\n",
        "      text-align:justify;\n",
        "      text-justify:inter-word;\n",
        "      }\n",
        "      blockquote p {\n",
        "        margin-bottom: 0;\n",
        "        line-height: 125%;\n",
        "        font-size: 100%;\n",
        "      }\n",
        "</style>\n",
        "<script>\n",
        "    MathJax.Hub.Config({\n",
        "                        TeX: {\n",
        "                           extensions: [\"AMSmath.js\"]\n",
        "                           },\n",
        "                tex2jax: {\n",
        "                    inlineMath: [ ['$','$'], [\"\\\\(\",\"\\\\)\"] ],\n",
        "                    displayMath: [ ['$$','$$'], [\"\\\\[\",\"\\\\]\"] ]\n",
        "                },\n",
        "                displayAlign: 'center', // Change this to 'center' to center equations.\n",
        "                \"HTML-CSS\": {\n",
        "                    styles: {'.MathJax_Display': {\"margin\": 4}}\n",
        "                }\n",
        "        });\n",
        "</script>\n"
       ],
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 1,
       "text": [
        "<IPython.core.display.HTML at 0x7fb632fca4e0>"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "The Kalman filter belongs to a family of filters called *bayesian filters*. Most textbook treatments of the Kalman filter present the Bayesian formula, perhaps shows how it factors into the Kalman filter equations, but mostly keeps the discussion at a very abstract level. \n",
      "\n",
      "That approach requires a fairly sophisticated understanding of several fields of mathematics, and it still leaves much of the work of understanding and forming an intuitive grasp of the situation in the hands of the reader.\n",
      "\n",
      "I will use a different way to develop the topic, to which I owe the work of Dieter Fox and Sebastian Thrun a great debt. It depends on building an intuition on how Bayesian statistics work by tracking an object through a hallway - they use a robot, I use a dog (I like dogs). The first published example of this that I can find seems to be Fox 1999 [1], with a fuller example in Fox [2] 2003. Sebastian Thrun also uses this formulation in his excellent Coursera course Artificial Intelligence for Robotics [3] In fact, if you like watching videos, I highly recommend pausing reading this book in favor of first few lessons of that course, and then come back to this book for a deeper dive into the topic.\n",
      "\n",
      "Let's now use a simple thought experiment, much like we did with the g-h filter, to see how we might reason about the use of probabilities for filtering and tracking."
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Tracking a Dog"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Let us begin with a simple problem. We have a dog friendly workspace, and so people bring their dogs to work. However, occasionally the dogs wander out of your office and down the halls. We want to be able to track them. So during a hackathon somebody created a little sonar sensor to attach to the dog's collar. It emits a signal, listens for the echo, and based on how quickly an echo comes back we can tell whether the dog is in front of an open doorway or not. It also senses when the dog walks, and reports in which direction the dog has moved. It connects to our network via wifi and sends an update once a second.\n",
      "\n",
      "I want to track my dog Simon, so I attach the device to his collar and then fire up Python, ready to try to write code to track him through the building. At first blush this may appear impossible. If I start listening to the sensor of Simon's collar I might read 'door', 'hall', 'hall', and so on. How can I use that information to determine where Simon is?\n",
      "\n",
      "To keep the problem small, we will assume that there are only 10 positions in a single hallway to consider, which we will number 0 to 9, where 1 is to the right of 0, 2 is to the right of 1, and so on. For reasons that will be clear later, we will also assume that the hallway is circular or rectangular. If you move right from position 9, you will be at position 0.  \n",
      "\n",
      "When I begin listening to the sensor I have no reason to believe that Simon is at any particular position in the hallway. He is equally likely to be in any position. The probability that he is in each position is therefore 1/10. \n",
      "\n",
      "Let us represent our belief of his position at any time in a numpy array."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np\n",
      "\n",
      "pos = np.array([.1, .1, .1, .1, .1, .1, .1, .1, .1, .1])"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Now let's create a map of the hallway in another list. Suppose there are first two doors close together, and then another door quite a bit further down the hallway. We will use 1 to denote a door, and 0 to denote a wall:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "hallway = np.array([1, 1, 0, 0, 0, 0, 0, 0, 1, 0])"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "So I start listening to Simon's transmissions on the network, and the first data I get from the sensor is \"door\". From this I conclude that he is in front of a door, but which one? I have no idea. I have no reason to believe is in front of the first, second, or third door. But what I can do is assign a probability to each door. All doors are equally likely, so I assign a probability of 1/3 to each door. "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import print_function, division\n",
      "import matplotlib.pyplot as plt\n",
      "import bar_plot\n",
      "import numpy as np\n",
      "\n",
      "pos = np.array([0.333, 0.333, 0., 0., 0., 0., 0., 0., 0.333, 0.])\n",
      "bar_plot.plot(pos)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAsQAAAF2CAYAAABpv45gAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHFhJREFUeJzt3XuQ1fV9//EX1ZXVXVCX1AuL0grDLRTTmjgBQ9xIGiza\naazSncRLTUXMtNaxMW2orbektpiUIWgNQ1JpxklTIRkvHYu/1qCJpmJi2k4B2Q0ByVIwBAngXmRZ\nYPf3R3+B8qvsclk4yOfxmHGGPd/LeZ/PAPvk+N3vGdDT09MTAAAo1C9UegAAAKgkQQwAQNEEMQAA\nRRPEAAAUTRADAFA0QQwAQNEEMQAAResziJ966qlMnDgx1dXV+cQnPnHQJ37wwQdzzjnnpK6uLnfe\neecRDQkAAEfLyX3tcMYZZ+RP/uRP8q1vfStvvfXWQZ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QNEEMAEDRBDEAAEU7udIDJEnzz7oqPUK/Oqu2KnUDBxzSMVt39mRz+66jNFHlHM5aAMCR\n8D2VQ3VcBPFn/s9rlR6hXz1w+QWpG3jKIR2zuX3XCbcOyeGtBQAcCd9TOVQumQAAoGiCGACAogli\nAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiC\nGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACia\nIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACK\nJogBACiaIAYAoGiCGACAoh1UEG/YsCENDQ2pqanJRRddlFdffbXPY5YsWZL3ve99Of3003P++efn\n/vvvP+JhAQCgvx1UEM+cOTMTJkzI1q1b09jYmMbGxj6P6ejoyAMPPJAtW7bk5Zdfzte+9rX8/d//\n/REPDAAA/anPIG5tbc2zzz6bWbNmZeDAgbn99tvT0tKSlStX9nrc9OnTc9lll6WqqipDhw7N5Zdf\nnmXLlvXb4AAA0B/6DOI1a9akuro6NTU1mTx5ctatW5cRI0akubn5kJ5o2bJlufDCCw97UAAAOBr6\nDOKOjo7U1tamra0tTU1N2bZtWwYNGpSOjo6DfpKHH344XV1dufHGG49kVgAA6Hcn97VDTU1N2tvb\nM2zYsGzZsiVJ0tbWltra2oN6giVLluSv//qv8+KLL6aqqurIpgUAgIPw0ksv7Xe57rRp0w64b59B\nPHLkyOzYsSMbN25MfX19urq6snbt2owePfqgBrnlllvyz//8zxk2bNhBjg8AAEdm0qRJmTRp0t6v\nm5qaDrhvn5dMDB48OFOnTs3s2bPT2dmZuXPnZvjw4Rk/fvzefRoaGjJr1qz9jlu+fHmmT5+exYsX\nZ9y4cYfzOgAA4Kg7qNuuLViwICtWrEhdXV0WL16cRYsW7be9paUlmzdv3u+xL37xi3njjTfykY98\nJIMGDcqgQYNyxRVX9N/kAADQD/q8ZCJJhg0blm9/+9sH3L5u3br/9djChQuzcOHCwx4MAACOBR/d\nDABA0QQxAABFE8QAABRNEAMAUDRBDABA0QQxAABFE8QAABRNEAMAUDRBDABA0QQxAABFE8QAABRN\nEAMAUDRBDABA0QQxAABFE8QAABRNEAMAUDRBDABA0QQxAABFE8QAABRNEAMAUDRBDABA0QQxAABF\nE8QAABRNEAMAUDRBDABA0QQxAABFE8QAABRNEAMAUDRBDABA0QQxAABFE8QAABRNEAMAUDRBDABA\n0QQxAABFE8QAABRNEAMAUDRBDABA0QQxAABFE8QAABRNEAMAUDRBDABA0QQxAABFE8QAABRNEAMA\nUDRBDABA0QQxAABFE8QAABRNEAMAUDRBDABA0QQxAABFE8QAABRNEAMAUDRBDABA0QQxAABFE8QA\nABRNEAMAUDRBDABA0foM4g0bNqShoSE1NTW56KKL8uqrrx7UiR988MGcc845qaury5133nnEgwIA\nwNHQZxDPnDkzEyZMyNatW9PY2JjGxsY+T/q9730v9913X55//vmsXLkyjz32WL7xjW/0y8DQn370\nox9VeoTjhrXYx1rsYy32sRb7WAvezjv590WvQdza2ppnn302s2bNysCBA3P77benpaUlK1eu7PWk\n3/zmN3P11Vdn7NixGTp0aGbMmJHHHnusXweH/rBmzZpKj3DcsBb7WIt9rMU+1mIfa8HbeSf/vug1\niNesWZPq6urU1NRk8uTJWbduXUaMGJHm5uZeT7p69eqMHj068+bNy6c//emMGzcuP/zhD/t1cAAA\n6A+9BnFHR0dqa2vT1taWpqambNu2LYMGDUpHR0evJ/35ca+99lrWrFmTQYMGpb29vV8HBwCA/jCg\np6en50Ab//3f/z2XXnpp2tra9j72nve8J3fddVeuvvrqA570t37rt/LBD34wd9xxR5LkiSeeyF13\n3fW2l1osXbr0SOYHAICDMmXKlLd9/OTeDho5cmR27NiRjRs3pr6+Pl1dXVm7dm1Gjx7d65ONGjVq\nv8sqVq1alTFjxhzSYAAAcCz0esnE4MGDM3Xq1MyePTudnZ2ZO3duhg8fnvHjx+/dp6GhIbNmzdrv\nuOnTp+fxxx/PqlWrsnH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nn766fziL/5izj///EqPVhHd\n3d3p6upKd3d3uru7s2vXrnR3d1d6rIr58pe/nAEDBhR5+6Sf2759e5577rm89dZb2bNnT5599tm8\n+eabGTVqVKVHO+amTZuWRYsW7f1v3LhxueWWW4qM4bfeeiv/8R//kV27dmXXrl35xje+kTPOOKPI\n2xLW1tZm3Lhxefrpp7Nnz540NTXlJz/5SZF/Rn7uu9/9bs4///zU19dXepSKOeuss9LV1ZVXXnkl\nPT09Wbt2bTZu3Fjsmrz++uvZtWtX2tvb88gjj2T8+PHvuH8YnPC3Xfv5fYjXrFmT+vr6ou9D/O1v\nfzvz58/f77Hp06fnmmuuqdBElfPGG2/k1ltvzSmnnLLfHRXuvPPOjBkzpoKTHVutra354he/mJaW\nluzevTvDhg3L9ddfX9QaHEjJtx1rbW3N/fffn5/85Cc56aSTMnLkyHziE58o9v+ubd68OV/60pey\ndu3aDBkyJNdee23e9773VXqsivnTP/3TXHrppbn88ssrPUpF/eAHP8g//MM/ZMuWLRk8eHA++tGP\nZsqUKZUeqyKefPLJPPXUU+nu7s573vOe3Hzzze+4O1qd8EEMAAC9OaEvmQAAgL4IYgAAiiaIAQAo\nmiAGAKBoghgAgKIJYgAAiiaIAQAomiAGAKBoghgAgKL9X3VxSKMRIF5FAAAAAElFTkSuQmCC\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fb61ab15940>"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "We call this a <i>multimodal</i> distribution because we have multiple beliefs about the position of our dog. Of course we are not saying that we think he is simultaneously in three different locations, merely that so far we have narrowed down our knowledge in his position to these locations. \n",
      "\n",
      "I hand coded the pos array in the code above. How would we implement this in code? Well, hallway represents each door as a 1, and wall as 0, so we will multiply the hallway variable by the percentage, like so;"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "pos = hallway * 0.3\n",
      "print('pos =', pos)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "pos = [ 0.3  0.3  0.   0.   0.   0.   0.   0.   0.3  0. ]\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Extracting Information from Multiple Sensor Readings"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Let's put Python aside and think about the problem a bit. Suppose we were to read the following from Simon's sensor:\n",
      "\n",
      "  * door\n",
      "  * move right\n",
      "  * door\n",
      "  \n",
      "\n",
      "Can we deduce where Simon is at the end of that sequence? Of course! Given the hallway's layout there is only one place where you can be in front of a door, move once to the right, and be in front of another door, and that is at the left end. Therefore we can confidently state that Simon is in front of the second doorway. If this is not clear, suppose Simon had started at the second or third door. After moving to the right, his sensor would have returned 'wall'. Therefore the only possibility is that he is now in front of the second door. We denote this in Python with:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "pos = np.array([0., 1., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "print(pos)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[ 0.  1.  0.  0.  0.  0.  0.  0.  0.  0.]\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Obviously I carefully constructed the hallway layout and sensor readings to give us an exact answer quickly. Real problems will not be so clear cut. But this should trigger your intuition - the first sensor reading only gave us very low probabilities (0.333) for Simon's location, but after a position update and another sensor reading we knew much more about where he is. You might suspect, correctly, that if you had a very long hallway with a large number of doors that after several sensor readings and positions updates we would either be able to know where Simon was, or have the possibilities narrowed down to a small number of possibilities. For example, suppose we had a long sequence of \"door, right, door, right, wall, right, wall, right, door, right, door, right, wall, right, wall, right, wall, right, wall, right, door\". Simon could only be located where we had a sequence of [1,1,0,0,1,1,0,0,0,0,1] in the hallway. There might be only one match for that, or at most a few. Either way we will be far more certain about his position then when we started.\n",
      "\n",
      "We could work through the code to implement this solution, but instead let us consider a real world complication to the problem."
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Noisy Sensors"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Unfortunately I have yet to come across a perfect sensor. Perhaps the sensor would not detect a door if Simon sat in front of it while scratching himself, or it might report there is a door if he is facing towards the wall, not down the hallway. So in practice when I get a report 'door' I cannot assign 1/3 as the probability for each door. I have to assign something less than 1/3 to each door, and then assign a small probability to each blank wall position. At this point it doesn't matter exactly what numbers we assign; let us say that the probably of 'door' being correct is 0.6, and the probability of being incorrect is 0.2, which is another way of saying it is about 3 times more likely to be right than wrong. How would we do this?\n",
      "\n",
      "At first this may seem like an insurmountable problem. If the sensor is noisy it casts doubt on every piece of data. How can we conclude anything if we are always unsure?\n",
      "\n",
      "The key, as with the problem above, is probabilities. We are already comfortable with assigning a probabilistic belief about the location of the dog; now we just have to incorporate the additional uncertainty caused by the sensor noise. Say we think there is a 50% chance that our dog is in front of a specific door and we get a reading of 'door'. Well, we think that is only likely to be true 0.6 of the time, so we multiply: $0.5 * 0.6= 0.3$. Likewise, if we think the chances that our dog is in front of a wall is 0.1, and the reading is 'door', we would multiply the probability by the chances of a miss: $0.1 * 0.2 = 0.02$.\n",
      "\n",
      "However, we more or less chose 0.6 and 0.2 at random; if we multiply the pos array by these values the end result will no longer represent a true probability distribution. "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def update(pos, measure, p_hit, p_miss):\n",
      "    q = np.array(pos, dtype=float)\n",
      "    for i in range(len(hallway)):\n",
      "        if hallway[i] == measure:\n",
      "            q[i] = pos[i] * p_hit\n",
      "        else:\n",
      "            q[i] = pos[i] * p_miss\n",
      "    return q\n",
      "\n",
      "pos = np.array([0.2]*10)\n",
      "reading = 1 # 1 is 'door'\n",
      "pos = update(pos, 1, .6, .2)\n",
      "\n",
      "print(pos)\n",
      "print('sum =', sum(pos))\n",
      "bar_plot.plot(pos)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[ 0.12  0.12  0.04  0.04  0.04  0.04  0.04  0.04  0.12  0.04]\n",
        "sum = 0.64\n"
       ]
      },
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAsQAAAF2CAYAAABpv45gAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHGRJREFUeJzt3Xt01/V9+PFXqjHRb4L6pUNNUFbhAKEMuqKcgqWm0opF\nd6ZTlmO91FbEns55bO1m5uatnRu241C8lENbXY/HdUI9XnYcbrXReilYtdsZt0TGxTCgNKaAuUD4\nBpL9sV9h2Q+SAIEP8n48zvEc8v1c8sr7qHn69Z1Pirq7u7sDAAAS9aGsBwAAgCwJYgAAkiaIAQBI\nmiAGACBpghgAgKQJYgAAkiaIAQBIWp9B/Nxzz8WkSZOitLQ0vvjFL/b7xg8++GCceeaZkc/n4847\n7zysIQEA4Eg5sa8TTjvttPjzP//z+OlPfxo7duzo101/8YtfxH333Revv/56nHrqqfHJT34yfv/3\nfz9mzJhx2AMDAMBA6vMd4gsvvDCuuOKKyOfz/b7pU089FVdeeWVUVVVFRUVFzJw5M5588snDGhQA\nAI6Efu8hPpjf8Lx69eoYNWpUzJs3L77+9a/HmDFj4p133jmkAQEA4EjqdxAXFRX1+6bt7e1RVlYW\n69atizVr1kR5eXm0tbUd0oAAAHAk9bmH+LcO5h3iXC4XbW1tMW/evIiIeOaZZ6KsrGy/59bV1fX7\nvgAAcKimTp2639f7HcQH8w7xyJEjo6GhYe/Hq1atitGjRx/w/Kqqqn7f+1C98MIL8bnPfe6If54P\nAmuxj7XYx1rsYy32sRb7WIt9rMU+1mKfY30t6uvrD3iszy0TXV1d0dHREbt37449e/bErl27Ys+e\nPXuPV1dXR21tbY9rZsyYEU8//XSsWrUqNm3aFI899ljU1NQcxpcAAABHRp9B/Pjjj8cpp5wSDzzw\nQDzxxBNx8sknx/3337/3eGNjYzQ1NfW4ZuLEiXHPPffEpz/96fi93/u9qKmp8cg1AACOSX1umbjh\nhhvihhtuOODx9evX7/f1W2+9NW699dZDHmygjRgxIusRjhnWYh9rsY+12Mda7GMt9rEW+1iLfazF\nPh/ktSjqPpifljsC6urqjsoeYgAA0lVfX3/AH6rr92PXAADgeCSIAQBImiAGACBpghgAgKQJYgAA\nkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgA\ngKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAG\nACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaI\nAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJ\nYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKT1GcQbN26M6urqyOVyMWHC\nhFi5cmW/bnzXXXdFRUVFfPjDH47Pf/7z0draetjDAgDAQOsziGfNmhXjxo2LrVu3Rk1NTdTU1PR5\n02effTYef/zx+OUvfxkbNmyIrVu3xje/+c0BGRgAAAZSr0Hc0tISL774YtTW1kZJSUncdttt0djY\nGCtWrOj1pg0NDTF58uQ466yz4pRTTolLL700Vq1aNaCDAwDAQOg1iNesWROlpaWRy+ViypQpsX79\n+hg+fHg0NDT0etPPfOYz8dZbb8XGjRujra0tnn/++bjssssGdHAAABgIvQZxe3t7lJWVRWtra9TX\n18e2bduivLw82tvbe73peeedF1dffXWcc845cdppp0VxcXHcdNNNAzo4AAAMhBN7O5jL5aKtrS2G\nDh0azc3NERHR2toaZWVlvd70kUceiddeey2am5ujpKQkZs6cGbfeems88sgj+z1/zpw5e/88adKk\nmDx58sF+HQAAsNe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QNL6DOKNGzdGdXV15HK5mDBhQqxcubJfN37wwQfjzDPPjHw+H3feeedh\nDwoAAEdCn0E8a9asGDduXGzdujVqamqipqamz5v+4he/iPvuuy9efvnlWLFiRTz55JPx4x//eEAG\nBgCAgdRrELe0tMSLL74YtbW1UVJSErfddls0NjbGihUrer3pU089FVdeeWVUVVVFRUVFzJw5M558\n8skBHRwAAAZCr0G8Zs2aKC0tjVwuF1OmTIn169fH8OHDo6Ghodebrl69OkaNGhXz5s2Lr3/96zFm\nzJh45513BnRwAAAYCL0GcXt7e5SVlUVra2vU19fHtm3bory8PNrb23u96W+vW7duXaxZsybKy8uj\nra1tQAcHAICBUNTd3d19oIP/9m//FhdeeGG0trbufe1jH/tY3HXXXXHllVce8KZ/+Id/GJ/61Kfi\n9ttvj4iIZ555Ju666679brWoq6s7nPkBAKBfpk6dut/XT+ztohEjRsTOnTtj06ZNUVlZGYVCIdau\nXRujRo3q9ZONHDmyx7aKVatWxejRow9qMAAAOBp63TIxaNCgmDZtWsyePTs6Ojpi7ty5MWzYsBg7\nduzec6qrq6O2trbHdTNmzIinn346Vq1aFZs2bYrHHnusX0+nAACAo63Xd4gjIhYsWBDXXntt5PP5\nqKqqioULF/Y43tjYGOeee26P1yZOnBj33HNPfPrTn47Ozs748pe/HDNmzBjYyQEAYAD0uocYAACO\nd351MwAASRPEAAAkrc89xB90v/nNb+Khhx6KtWvXRkVFRdxyyy1x9tlnZz1WJt5666149tln4913\n340LLrggvvKVr2Q9Umb27NkT8+fPj+XLl8euXbviIx/5SNx4440xdOjQrEc76h588MFYsWJF7Nq1\nK4YMGRI1NTVx3nnnZT1Wpurr6+Pee++Nm2++OS666KKsx8nEvffeG//5n/8ZJ5xwQkT8z8+G3HLL\nLRlPlY1CoRA//OEP44033oju7u644IILYubMmVmPddQ1NzfH1772tR6v7dq1K26//faYOHFiRlNl\nZ8OGDfH9738/NmzYEKeffnp8/vOfT3IdIiIaGhriscceiy1btkRFRUV8+ctfjt/93d/NeqyDctzv\nIf7bv/3bOOOMM+K6666LxYsXx6uvvhpz5szJeqxMrFq1Ktra2mLZsmVRKBSSDuLOzs547rnn4qKL\nLop8Ph///M//HD/5yU9i3rx5WY921DU2NkZFRUUUFxfHsmXLYvbs2fH3f//3UVJSkvVomdizZ0/c\ne++90d7eHpdddlmyQXzffffFlClTkv36/7fvfe978etf/zr+9E//NE499dTYuHFjsm+s/G9btmyJ\nO+64I77//e/HSSedlPU4R92f/dmfxaRJk+KP/uiPYtmyZfHtb3875s+fH2VlZVmPdlR1dnbGn/zJ\nn8R1110Xn/zkJ+OZZ56JV1555QP3/fS43jKxY8eOWLZsWVx++eVRXFwcl156abz33nuxYcOGrEfL\nxJgxY2LixInJ/cO6P8XFxXHVVVdFPp+PiP95fOCWLVt6/BKaVAwbNiyKi4uju7s7du/eHaWlpVFU\nVJT1WJl54YUX4uMf/3iceuqpWY/CMaBQKMSrr74aX/rSl+K0006LoqIiMfz/vPTSSzFx4sQkYzgi\nYvPmzfGJT3wiIiLGjRsXJ510UjQ1NWU81dG3efPm2LVrV0yZMiWKiorisssuiy1btnzgWuu4DuIt\nW7ZEcXFxlJaWxt133x1NTU1xxhlnxObNm7MejWPM6tWrI5/PR3l5edajZOIHP/hBXHvttfHQQw/F\nHXfckew3uO3bt8crr7wSl112WdajHBN+9KMfxY033hh//dd/HZs2bcp6nExs3rw5ioqK4s0334yb\nbropvva1r8Wbb76Z9ViZ6+rqitdeey0uvPDCrEfJzPjx4+ONN96Irq6u+I//+I84+eSTk/yPpQNt\nNNiyZctRnuTwHNdBvGvXrigtLd372/ba2tri5JNPjo6OjqxH4xiyY8eO+OEPfxjXX3991qNkZubM\nmfH4449HTU1NPPTQQ1EoFLIeKROPP/54XHHFFVFcXJz1KJm77rrrYv78+fHd7343zj333PjWt74V\ne/bsyXqso27nzp2xe/fuaGpqivnz58eNN94YDz/8cGzfvj3r0TK1bNmyiIgev6grNddff3289NJL\ncc0118ScOXNi1qxZSf67o7KyMkpLS+PVV1+N3bt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f/zH\naG5ujkGDBsXll18eU6dOzXqsTDz77LPx3HPPRVdXV3zsYx+Lm2666QP3RKvjPogBAKA3x/WWCQAA\n6IsgBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASNp/AyfOjAB+Z2w5AAAA\nAElFTkSuQmCC\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fb61a61b710>"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "We can see that this is not a probability distribution because it does not sum to 1.0. But we can see that the code is doing mostly the right thing - the doors are assigned a number (0.12) that is 3 times higher than the walls (0.04). So we can write a bit of code to normalize the result so that the probabilities correctly sum to 1.0."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def normalize(p):\n",
      "    s = sum(p)\n",
      "    for i in range (len(p)):\n",
      "        p[i] = p[i] / s\n",
      "        \n",
      "def update(pos, measure, p_hit, p_miss):\n",
      "    q = np.array(pos, dtype=float)\n",
      "    for i in range(len(hallway)):\n",
      "        if hallway[i] == measure:\n",
      "            q[i] = pos[i] * p_hit\n",
      "        else:\n",
      "            q[i] = pos[i] * p_miss\n",
      "    normalize(q)\n",
      "    return q\n",
      "\n",
      "\n",
      "pos = np.array([0.2]*10)\n",
      "reading = 1 # 1 is 'door'\n",
      "pos = update(pos, 1, .6, .2)\n",
      "\n",
      "print('sum =', sum(pos))\n",
      "print('probability of door =', pos[0])\n",
      "print('probability of wall =', pos[2])\n",
      "bar_plot.plot(pos)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "sum = 1.0\n",
        "probability of door = 0.1875\n",
        "probability of wall = 0.0625\n"
       ]
      },
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAsQAAAF2CAYAAABpv45gAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHF5JRE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AAu2Ps2LGd3mStrq7e5bldbpno06dP\nTJgwIaZOnRotLS0xffr0GDBgQKcfqCsvL4/KyspO15177rkxd+7cWLRoUbS0tMRDDz0Up59++p5+\nPQAAsM90+9i1WbNmxcKFCyObzcacOXNi9uzZnY7X1tZGXV1dp9c+8YlPxM033xyf+tSnorS0NDKZ\nTNx+++29OzkAAPSCLh+7tj947BoAAPvaHj92DQAADnaCGACApAliAACSJogBAEiaIAYAIGmCGACA\npAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYA\nIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogB\nAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAli\nAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmC\nGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGndBvHq1aujvLw8MplMjBo1\nKhYvXrxbn+CTn/xkHH/88Xs8IAAA7EvdBvGUKVNixIgRsX79+qioqIiKiooe33z27NnR2NgYeXl5\nezUkAADsK10GcUNDQzz//PNRWVkZBQUFcc0110RtbW0sWrSo2xs3NTXFXXfdFd/+9rejo6Oj1wYG\nAIDe1GUQL1u2LAoLCyOTycS4ceNi5cqVMXDgwKipqen2xrfffntcccUV0adPn14bFgAAeluXQdzc\n3BxFRUXR2NgY1dXVsWHDhiguLo7m5uYub1pdXR1VVVUxZcqUXh0WAAB626FdHcxkMtHU1BT9+/eP\n+vr6iIhobGyMoqKiLm969dVXx3e/+90e7x2eNm3a9j+PGTMmxo4d26PrAABgZ+bNmxfz58/f/vHE\niRN3eW5eRxcbfBsaGiKbzUZtbW2UlpZGa2tr9O3bN+bPnx/Dhw/f5U2PPvroeOeddzp/ory82LBh\nw/+3haKqqirKysq6/aIAAGBPVVdXx/jx43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7iLPZbNTW1kZpaelu7SGeN29eVFRUxK9//esYNmzYTs+xhxgAgH1tr/YQ9+nT\nJyZMmBBTp06NlpaWmD59egwYMKBTDJeXl0dlZWWn6xYsWBCTJk2KOXPm7DKGAQAg13r02LVZs2bF\nwoULI5vNxpw5c2L27NmdjtfW1kZdXV2n1370ox/F22+/HWeccUYUFxdHcXFxnHXWWb03OQAA9IJu\nt0zsa1VVVZHXb2AuR+h1/YryI1uQt1vXrN/SEXVNbftootzZk7UAgL3heyo709WWiW5/qG5/uOG/\nV+R6hF5115knRrbgsN26pq6p7aBbh4g9WwsA2Bu+p7K7erRlAgAADlaCGACApAliAACSJogBAEia\nIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACS\nJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACA\npAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYA\nIGmCGACApAliAACSJogBAEjaobkeAP6v9Vs6oq6pLddj9Lp+RfmRLcjbrWusxQ7WYgdrsYO12MFa\nsDP+vugZQcwBp66pLW747xW5HqPX3XXmiZEtOGy3rrEWO1iLHazFDtZiB2vBzvj7omdsmQAAIGmC\nGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEia\nIAYAIGmCGACApHUbxKtXr47y8vLIZDIxatSoWLx4cY9ufPfdd8exxx4b2Ww2brzxxr0eFAAA9oVu\ng3jKlCkxYsSIWL9+fVRUVERFRUW3N/3DH/4Qt912W7z44ouxaNGiePzxx+MXv/hFrwwMAAC9qcsg\nbmhoiOeffz4qKyujoKAgrrnmmqitrY1FixZ1edMnnngizjvvvCgrK4uSkpKYPHlyPP744706OAAA\n9IYug3jZsmVRWFgYmUwmxo0bFytXroyBAwdGTU1NlzddunRpDBkyJGbMmBHXX399DBs2LP7617/2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KSSy6Jn/3sZ3HjjTfGjBkzor6+Ptej7Xf5+flx\n7bXXxty5c+OKK66IhoaGOOaYY+Lwww/P9Wi75aB+ysSxxx4bra2tsX79+shms7F169b45z//GSUl\nJbkejQNAe3t7zJgxI4477rj4/Oc/n+txDhgH+c/Z7tKKFSti6dKlnX7N/JIlS+If//hHfPGLX8zh\nZORSv379cj3CAaepqSnefPPN+P73v5/rUXJm1apVsXnz5u1PlRg6dGj069cvli5dGu9973tzPN3+\nN3To0Jg6dWpERDQ2NkZVVVUMGDAgx1PtnoP6HeIjjjgiRo4cGU8//XS0trbGs88+G+973/vihBNO\nyPVoOdHe3h6tra3R3t4e7e3t0dbWFu3t7bkeK2ceeOCByMvLS/LxSf+xcePGeOGFF2LTpk2xbdu2\neP755+Odd96JwYMH53q0/W7ixIkxe/bs7X8NGzYsrrjiiiRjeNOmTfHnP/852traoq2tLX7xi1/E\nUUcdleRjCYuKimLYsGHx7LPPxrZt26K6ujreeuutJP8Z+Y9XX301TjjhhCgtLc31KDnTr1+/aG1t\njTfeeCM6Ojpi+fLlsWbNmmTXZO3atdHW1hZNTU3x0EMPxfDhw991/2Fw0D927T/PIV62bFmUlpYm\n/Rzi3/3udzFz5sxOr02aNCnOP//8HE2UO2+//XZcddVVcdhhh3V6osKNN94YQ4cOzeFk+1dDQ0P8\n6Ec/itra2ti6dWv0798/Lr744qTWYFdSfuxYQ0ND3HnnnfHWW2/FIYccEoMGDYovfelLyf7ftbq6\nurj//vtj+fLl0bdv37jwwgvjYx/7WK7Hyplvfetbceqpp8aZZ56Z61Fy6s0334yf//znUV9fH336\n9Ilzzjknxo8fn+uxcuLpp5+OZ555Jtrb2+Okk06Kyy+//F33RKuDPogBAKArB/WWCQAA6I4gBgAg\naYIYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASNr/AOJSiP6mnrRlAAAAAElFTkSu\nQmCC\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fb61a757668>"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Normalization is done by dividing each element by the sum of all elements in the list. If this is not clear you should spend a few minutes proving it to yourself algebraically. We can see from the output that the sum is now 1.0, and that the probability of a door vs wall is still three times larger. The result also fits our intuitiion that the probability of a door must be less than 0.333, and that the probability of a wall must be greater than 0.0. Finally, it should fit our intuition that we have not yet been given any information that would allow us to distinguish between any given door or wall position, so all door positions should have the same value, and the same should be true for wall positions. "
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Incorporating Movement Data"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Recall how quickly we were able to find an exact solution to our dog's position when we incorporated a series of measurements and movement updates. However, that occured in a fictional world of perfect sensors. Might we be able to find an exact solution even in the presence of noisy sensors?\n",
      "\n",
      "Unfortunately, the answer is no. Even if the sensor readings perfectly match an extremely complicated hallway map we could not say that we are 100% sure that the dog is in a specific position - there is, after all, the possibility that every sensor reading was wrong! Naturally, in a more typical situation most sensor readings will be correct, and we might be close to 100% sure of our answer, but never 100% sure. This may seem head-spinningly complicated, but lets just go ahead and program the math, which as we have seen is quite simple.\n",
      "\n",
      "First let's deal with the simple case - assume the movement sensor is perfect, and it reports that the dog has moved one space to the right. How would we alter our pos array?\n",
      "\n",
      "I hope after a moment's thought it is clear that we should just shift all the values one space to the right. If we previously thought there was  a 50% chance of Simon being at position 3, then after the move to the right we should believe that there is a 50% chance he is at position 4. So let's implement that. Recall that the hallway is circular, so we will use modulo arithmetic to perform the shift correctly"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy\n",
      "def perfect_predict(pos, move):\n",
      "    \"\"\" move the position by 'move' spaces, where positive is to the right, \n",
      "    and negative is to the left\n",
      "    \"\"\"\n",
      "    n = len(pos)\n",
      "    result = np.array(pos, dtype=float)\n",
      "    for i in range(n):\n",
      "        result[i] = pos[(i-move) % n]\n",
      "    return result\n",
      "        \n",
      "pos = np.array([.4, .1, .2, .3])\n",
      "print('pos before predict =', pos)\n",
      "bar_plot.plot (pos, title='Before prediction')\n",
      "\n",
      "pos = perfect_predict(pos, 1)\n",
      "print('pos after predict =', pos)\n",
      "bar_plot.plot(pos, title='After prediction')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "pos before predict = [ 0.4  0.1  0.2  0.3]\n",
        "pos after predict ="
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " [ 0.3  0.4  0.1  0.2]\n"
       ]
      },
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAsQAAAGDCAYAAAAs4AbKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtQ1PX+x/HXggi6C+ZapoCXBC+YaR0vJ/GGWmraNHrU\nOFpZXiIrx9Fjnagss4th5XjLPJ5Teck8Xiqt8ZKZaVFyqjk1xwuLBuKaNoYEyoJyUb6/Pxr5tQEL\nKrjY5/mYacbd73e/3/fiVk/Xz37XZlmWJQAAAMBQAf4eAAAAAPAnghgAAABGI4gBAABgNIIYAAAA\nRiOIAQAAYDSCGAAAAEYjiAFcFZYvX662bdsqKChIAQEB+uKLL/w90lVvxYoVCggI0NGjRyvc/sAD\nD+iGG264wlP96rnnnlNAAP+LAnBl8F8bAH5RWFgou92ugIAAvfPOOz73dblcmjRpkm6++Wa99dZb\nWr16tTp06FBuv02bNmnhwoW1NbJxbDabbDZbjR1vwYIF+vDDD/1ybgDwhSAG4BefffaZzp49q2uv\nvVabN2/2ue/nn38uy7L05ptvaty4cRo7dqyaNm1abr9NmzZpwYIFtTWycd58800dPHiwxo53MUE8\nc+ZMnT17tsbODQC+EMQA/GLz5s0KDw/XxIkT9cknn+jcuXOV7puVlSVJatSo0ZUaD5ICAwMVFBRU\no8es7pejBgYGqn79+jV6bgCoDEEMwC+2bNmiw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EijRo2S0+mU9Os18U+cOCGPx+PnyQCpVatWCgoKkmVZOnfunEJCQmSz2fw9FnxgyYSfnThx\nQkFBQQoJCdGzzz6ryZMn6/rrr9dPP/2kli1b+ns8ALgqHDp0SE6nU6Ghof4eBZAkvfnmm9q1a5fq\n16+vxMRE1a9f398jwQfeIfazoqIihYSElH1Fdn5+vho0aKDCwkJ/jwYAV4UzZ85oxYoVGjdunL9H\nAcpMmjRJq1atUnx8vBYvXqzi4mJ/jwQfCGI/Cw4OVmFhoZo0aaK33npL7dq109mzZxUSEuLv0QCg\nzispKdGrr76qXr16qWfPnv4eB/ASGBioIUOGKCgoSPv37/f3OPCBIPazZs2aqbi4WDk5OZKkc+fO\n6eeff1Z4eLifJwOAuq20tFQLFy5U8+bNdffdd/t7HKBSXL+g7iOI/axhw4bq0qWLNm3apOLiYm3e\nvFnXXXcd64fhd6WlpSouLlZpaalKS0tVUlKi0tJSf48FlPnnP/8pm82mSZMm+XsUoMypU6f02Wef\n6cyZMzp//rx27Nih06dPq127dv4eDT5w2bU64MJ1iNPT0xUREcF1iFEn7N69W0uXLvW6b/To0Ro1\napSfJgL+38mTJzVlyhTVr1/f69P7Tz31lDp06ODHyWC6vLw8LViwQG63W+fOnVNkZKTuu+8+Xpd1\nHEEMAAAAo7FkAgAAAEYjiAEAAGA0ghgAAABGI4gBAABgNIIYAAAARiOIAQAAYDSCGAAAAEYjiAEA\nAGA0ghgAAABG+z8znIG2d//hTwAAAABJRU5ErkJggg==\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fb630755550>"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "We can see that we correctly shifted all values one position to the right, wrapping from the end of the array back to the beginning."
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Adding Noise to the Prediction"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "We want to solve real world problems, and we have already stated that all sensors have noise. Therefore the code above must be wrong. What if the sensor reported that our dog moved one space, but he actually moved two spaces, or zero? Once again this may initially sound like an insurmountable problem, but let's just model it in math. Since this is just an example, we will create a pretty simple noise model for the sensor - later in the book we will handle far more sophisticated errors.\n",
      "\n",
      "We will say that when the sensor sends a movement update, it is 80% likely to be right, and it is 10% likely to overshoot one position to the right, and 10% likely to undershoot to the left. That is, if we say the movement was 4 (meaning 4 spaces to the right), the dog is 80% likely to have moved 4 spaces to the right, 10% to have moved 3 spaces, and 10% to have moved 5 spaces.\n",
      "\n",
      "This is slightly harder than the math we have done so far, but it is still tractable. Each result in the array now needs to incorporate probabilities for 3 different situations. For example, consider position 9 for the case where the reported movement is 2. It should be clear that after the move we need to incorporate the probability that was at position 7 (9-2). However, there is a small chance that our dog actually moved from either 1 or 3 spaces away due to the sensor noise, so we also need to use positions 6 and 8. How much? Well, we have the probabilities, so we can just multiply and add. It would be 80% of position 7 plus 10% of position 6 and 10% of position 8! Let's try coding that:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def predict(pos, move, p_correct, p_under, p_over):\n",
      "    n = len(pos)\n",
      "    result = np.array(pos, dtype=float)\n",
      "    for i in range(n):\n",
      "                result[i] =  \\\n",
      "            pos[(i-move) % n]   * p_correct + \\\n",
      "            pos[(i-move-1) % n] * p_over + \\\n",
      "            pos[(i-move+1) % n] * p_under          \n",
      "    return result\n",
      "\n",
      "p = np.array([0,0,0,1,0,0,0,0])\n",
      "res = predict(p, 2, .8, .1, .1)\n",
      "print(res)\n",
      "bar_plot.plot(res)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[ 0.   0.   0.   0.   0.1  0.8  0.1  0. ]\n"
       ]
      },
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAsQAAAF2CAYAAABpv45gAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAA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Q0NDNDY2\ndnruxhtvjGOOOSYGDx4c5eXlsXHjxpg1a1ZuJwcAgBzIeslERERFRUW89NJLu9xeX1//X8+VlJTE\nn//8570aDAAAPg/euhkAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgA\ngKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAG\nACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaI\nAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJ\nYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBp\nghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKR1GcRr1qyJqqqqyGQyMXLkyFi6dGm3Fn7uuefihBNO\niJKSkhg0aFAsXrx4r4cFAIBc6zKIJ02aFCNGjIj169dHdXV1VFdXd7nou+++G+eff3786le/ik2b\nNsXf//73OProo3MyMAAA5FLWIN60aVPMnz8/ampqoqioKCZPnhwNDQ1RW1ubddEHH3wwzjrrrBg/\nfnwccMABcdRRR8URRxyR08EBACAXsgbxypUro7i4ODKZTIwZMybq6+tj4MCBsXz58qyLLl68OL70\npS/Ft771rejbt2/88Ic/jE2bNuV0cAAAyIWsQdzS0hIlJSXR1NQUdXV1sWHDhigtLY2Wlpasi37y\nyScxb968mD17dqxevTo2bdoUN9xwQ04HBwCAXDgo28ZMJhPNzc1RUVER69ati4iIpqamKCkpybpo\nJpOJM844I0444YSI+PQ65Ouvv36X+0+fPn3nx6NHj47KyspufwEAAPD/W7hwYSxatGjn43Hjxu1y\n36xBPGjQoNiyZUusXbs2ysvLo62tLVatWhVDhgzJOsDAgQPjww8/3Pm4o6MjOjo6drn/lClTsq4H\nAAC7o7KystOLrHV1dbvcN+slE7169YqxY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ceNG7fLfbsM4kGDBsWW\nLVti7dq1UV5eHm1tbbFq1aoYMmRItwa5/PLL429/+1tUVFTscr8pU6Z0uRYAAHRXZWVlpxdZ6+rq\ndrlvl5dM9OrVK8aOHRvTpk2L1tbWmDFjRgwYMCCGDx++c5+qqqqoqanpdNzixYtj/PjxMW/evBg2\nbNiefB0AALDPdeu2a7Nnz44lS5ZEWVlZzJs3L+bOndtpe0NDQzQ2NnZ67s4774yPP/44zjjjjCgt\nLY3S0tI4++yzczc5AADkQJeXTEREVFRUxEsvvbTL7fX19f/13AMPPBAPPPDAHg8GAACfB2/dDABA\n0gQxAABJE8QAACRNEAMAkDRBDABA0gQxAABJE8QAACRNEAMAkDRBDABA0gQxAABJE8QAACRNEAMA\nkDRBDABA0gQxAABJE8QAACRNEAMAkDRBDABA0gQxAABJE8QAACRNEAMAkDRBDABA0gQxAABJE8QA\nACRNEAMAkDRBDABA0gQxAABJE8QAACRNEAMAkLSD8j0AALtn/daOaGzelu8xvhCOLCmMsqKCfI/B\n/+H783/5/uw5BDFAD9PYvC2m/s/qfI/xhXDbmcdGWdHB+R6D/8P35//y/dlzuGQCAICkCWIAAJIm\niAEASJogBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICk\nCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJogBgAg\naYIYAICkCWIAAJImiAEASFqXQbxmzZqoqqqKTCYTI0eOjKVLl3Zr4bvuuiv69u0bZWVlce211+71\noAAAsC90GcSTJk2KESNGxPr166O6ujqqq6u7XPT111+Pm2++OV588cWora2NRx99NB577LGcDLwv\nvPPOO/keYb/ifOaOc5lbzifA7kvhZ2fWIN60aVPMnz8/ampqoqioKCZPnhwNDQ1RW1ubddHHH388\nzj///Bg6dGj069cvJk6cGI8++mhOB8+llStX5nuE/YrzmTvOZW45nwC7L4WfnVmDeOXKlVFcXByZ\nTCbGjBkT9fX1MXDgwFi+fHnWRVesWBFDhgyJmTNnxjXXXBPDhg2Lt99+O6eDAwBALmQN4paWligp\nKYmmpqaoq6uLDRs2RGlpabS0tGRd9D/HrV69OlauXBmlpaXR3Nyc08EBACAXDsq2MZPJRHNzc1RU\nVMS6desiIqKpqSlKSkqyLvqf42bOnBkREU8++WTWY+rq6nZ37pz68pe/nPcZ9ifOZ+44l7m1P53P\nad/I9wRfDB2Nq6Kuce/XcT4/5XzmVq7OZ77tTz87dyVrEA8aNCi2bNkSa9eujfLy8mhra4tVq1bF\nkCFDsi46ePDgTpdVLFu2LI477rjP3Pe0007bg7EBACA3sl4y0atXrxg7dmxMmzYtWltbY8aMGTFg\nwIAYPnz4zn2qqqqipqam03Hjx4+PJ554IpYtWxZr166NBx54oFt3pwAAgM9b1leIIyJmz54dF198\ncZSVlcXQoUNj7ty5nbY3NDTEscce2+m5UaNGxY033hinnHJKbNu2LX72s5/F+PHjczs5AADkQEFH\nR0dHvocAAIB88dbNAAAkTRADAJC0Lq8h3p/9+9//jlmzZsWqVauiX79+ceWVV8YxxxyT77F6pDff\nfDOeeuqpePfdd+Okk06Kn//85/keqUfbsWNH3HvvvbFkyZLYunVrfOUrX4lLL700Kioq8j1aj3TX\nXXdFbW1tbN26NY488siorq6OE088Md9j9Xh1dXVx0003xeWXXx6nnnpqvsfpsW666aZ455134sAD\nD4yIT/8O58orr8zzVD1TW1tbPPjgg/Haa69FR0dHnHTSSTFx4sR8j9UjrVu3Lq6++upOz23dujWm\nTJkSo0aNytNU+07SQXzfffdF//7947rrrotnnnkm7rzzzpg+fXq+x+qRMplMnHvuubF48eJoa2vL\n9zg9Xnt7e/Tt2zcuuuiiKCsri7/+9a9xxx137Ly3N7vn3HPPjSuuuCIKCwtj8eLFMW3atPjTn/4U\nRUVF+R6tx9qxY0c88sgjUV5enu9ReryCgoK49NJL/aMiBx588MH46KOP4ve//3307t071qxZk++R\neqzDDz885syZs/Pxhx9+GFOnTo2vfe1reZxq30n2konNmzfH4sWL4/vf/34UFhbG2WefHR9//HG8\n9957+R6tRxo2bFiMGjWqyzdtoXsKCwvjggsuiLKysoj49PaGH374YTQ1NeV5sp5pwIABUVhYGB0d\nHbF9+/YoLi6OgoKCfI/Voz377LPxjW98I3r37p3vUSAiPn11+JVXXolLLrkk+vTpEwUFBX7rm0Mv\nvPBCjBo1Kg4++OB8j7JPJBvEH374YRQWFkZxcXHccMMN0djYGEcddVS8//77+R4N/suKFSuirKws\nSktL8z1Kj/XHP/4xLr744pg1a1ZMnTp1v/2h/nnYuHFjvPzyy3HOOefke5T9xiOPPBKXXnpp/OY3\nv4m1a9fme5we6f3334+CgoJ444034rLLLourr7463njjjXyPtV9ob2+PBQsWxMknn5zvUfaZZIN4\n69atUVxcvPOd+Jqbm+OQQw6J1tbWfI8GnWzevDkefPDB+PGPf5zvUXq0iRMnxpw5c6K6ujpmzZrl\n0p69MGfOnDjvvPOisLAw36PsF370ox/FvffeG/fcc08ce+yxcfvtt8eOHTvyPVaPs2XLlti+fXs0\nNjbGvffeG5deemn84Q9/iI0bN+Z7tB5v8eLFERGd3phtf5NsEBcVFUVra2scdthhcf/998fgwYNj\ny5YtUVxcnO/RYKdt27bFHXfcESeddFKMHj063+P0eAceeGCceeaZUVhYGLW1tfkep0davnx5fPzx\nx1FZWZnvUfYbxx57bBQWFkZRUVFceOGFsXHjRq8S74GioqJob2+P733ve3HQQQfF8ccfH0cffXSs\nWLEi36P1eC+++GKMGTMm32PsU8n+UV3fvn2jra0t1q9fH2VlZbF9+/b46KOPol+/fvkeDSLi019R\nzZw5M44++uj4wQ9+kO9x9ivej2jPrV69OlasWBHV1dU7n1u2bFn861//ip/85Cd5nIzUHXnkkfke\nYb/U3Nwcb731Vtx+++35HmWfSvYV4kMPPTROOOGEeOqpp6KtrS2efvrpOOKII6J///75Hq1Ham9v\nj7a2tmhvb4/29vbYtm1btLe353usHu2+++6LgoICtwzaSxs3bowXXnghNm/eHDt27Ij58+fHJ598\nEoMHD873aD3SuHHjYu7cuTv/GzZsWFx++eVieA9t3rw5/vnPf8a2bdti27Zt8dhjj0WfPn3cYnEP\nlJSUxLBhw+Lpp5+OHTt2RF1dXXzwwQf+X99Lr776avTv33+/v6NMsq8QR0RMmjQpZs2aFZdcckmU\nl5fH5MmT8z1Sj/XKK6/Evffeu/PxggULYvz48XHBBRfkcaqe6+OPP44XX3wxDj744JgwYcLO56+9\n9to47rjj8jdYD3TAAQfEq6++Gg8//HBs3749KioqYurUqe6IwhfC9u3b49FHH40PPvggDjzwwBg0\naFBMnTo1Djgg2der9soVV1wR99xzT0yYMCEOO+yw+MUvfhF9+vTJ91g92ssvv7xf/zHdfxR0+N0h\nAAAJ809QAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACS9v8AXmN7\n/2O7oXoAAAAASUVORK5CYII=\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fb61a6d80b8>"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "The simple test case that we ran appears to work correctly. We initially believed that the dog was in position 3 with 100% certainty; after the movement update we now give an 80% probability to the dog being in position 5, and a 10% chance to undershooting to position 4, and a 10% chance of overshooting to position 6. Let us look at a case where we have multiple beliefs:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "p = np.array([0, 0, .4, .6, 0, 0, 0, 0])\n",
      "res = predict(p, 2, .8, .1, .1)\n",
      "print(res)\n",
      "bar_plot.plot(res)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[ 0.    0.    0.    0.04  0.38  0.52  0.06  0.  ]\n"
       ]
      },
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAsQAAAF2CAYAAABpv45gAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGutJREFUeJzt3X9sVfX9+PFX1drqbZFV55BWyISAIA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XUEyZMqXd9QAA4PMoLy9v8yZrdXX1fvdt\n95KJbt26xahRo2L69OnR1NQUM2fOjN69e8egQYP27lNRURFVVVVtjtuyZUu0tLRES0tLvPzyy1Fa\nWhp79uxxPTEAAIedDm+7NmfOnFi2bFmUlJTEggULYv78+W2219bWRl1d3X6Pb21tdds1AAAOW+1e\nMhERUVZWFq+88sp+t69bt67d4ysqKuLDDz/83IMBAMAXwVc3AwCQNEEMAEDSOrxkAoDDy+adrVHX\nsCvXYxwWTi7Kj5ICn1MBDo4gBuhi6hp2xdS/rM31GIeFuy48LUoKjs31GEAX55IJAACSJogBAEia\nIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACS\nJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACA\npAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYA\nIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogB\nAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACS1qkgXr9+fVRUVEQmk4mhQ4fG\nihUrOjzm+eefj29+85txwgknRK9eveLOO+886GEBACDbOhXEEyZMiMGDB8fmzZujsrIyKisrOzym\nsbEx7rrrrti0aVO8+eab8dhjj8Xjjz9+0AMDAEA2dRjE27Zti4ULF0ZVVVUUFBTE5MmTo7a2NpYv\nX97ucWPGjInzzjsv8vPzo2fPnnHhhRfGkiVLsjY4AABkQ4dBvHr16igsLIxMJhMjRoyIdevWRZ8+\nfaKmpuZz/aIlS5bEkCFDDnhQAAA4FDoM4sbGxigqKor6+vqorq6OLVu2RHFxcTQ2Nnb6l9x///3R\n3NwcY8eOPZhZAQAg647paIdMJhMNDQ1RVlYWmzZtioiI+vr6KCoq6tQveP755+O3v/1tvP7665Gf\nn7/PfWbMmLH35+HDh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tERLS0vs2rUrWlpacj1Wl/bQQw9FXl6eWwYdpK1bt8ZLL70U\n27dvjz179sTChQvjs88+i379+uV6tC5p9OjRMX/+/L3/DBw4MCZOnCiGD9D27dvjn//8Z+zatSt2\n7doVTz75ZHTv3t0tFg9AUVFRDBw4MJ577rnYs2dPVFdXx8cff+zf9YP0xhtvRK9evY74O8ok+w5x\nRMSECRNi9uzZcc0110RpaWlMnjw51yN1Wa+99lo8+OCDex+//vrrMWbMmLjiiityOFXX9emnn8bL\nL78cxx57bIwdO3bv8zfddFOcfvrpuRusCzrqqKPijTfeiMcffzx2794dZWVlMXXqVHdE4bCwe/fu\nmDdvXnz88cdx9NFHR9++fWPq1Klx1FHJvl91UK677rp44IEHYuzYsXHiiSfGL37xi+jevXuux+rS\nXn311SP6w3T/ldfq7w4BAEiY/wUFACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaI\nAQBImiAGACBp/w9jx3q+MqvMIgAAAABJRU5ErkJggg==\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fb61a7169b0>"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Here the results are more complicated, but you should still be able to work it out in your head. The 0.04 is due to the possibility that the 0.4 belief undershot by 1. The 0.38 is due to the following: the 80% chance that we moved 2 positions $(.4 * .8)$ and the 10% chance that we undershot $(.6*.1)$. Overshooting plays no role here because if we overshot both .4 and .6 would be past this position. **I strongly suggest working some examples until all of this is very clear, as so much of what follows depends on understanding this step.**\n",
      "\n",
      "If you look at the probabilities after performing the update you probably feel dismay. In the example above we started with probabilities of .4 and .6 in two fields; after performing the update the probabilities are not only lowered, but they are strewn out across the map."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "bar_plot.plot(res)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAsQAAAF2CAYAAABp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+/UcQAAsC+LFy+OJUuW7H08evTo/e7bbhD37ds3duzYERs2bIjS0tJo\nbm6ONWvWRP/+/dsd4N13342LLrqozXNHH310bNmyZZ+XUEyZMqXd9QAA4PMoLy9v8yZrdXX1fvdt\n95KJbt26xahRo2L69OnR1NQUM2fOjN69e8egQYP27lNRURFVVVVtjtuyZUu0tLRES0tLvPzyy1Fa\nWhp79uxxPTEAAIedDm+7NmfOnFi2bFmUlJTEggULYv78+W2219bWRl1d3X6Pb21tdds1AAAOW+1e\nMhERUVZWFq+88sp+t69bt67d4ysqKuLDDz/83IMBAMAXwVc3AwCQNEEMAEDSOrxkAoDDy+adrVHX\nsCvXYxwWTi7Kj5ICn1MBDo4gBuhi6hp2xdS/rM31GIeFuy48LUoKjs31GEAX55IJAACSJogBAEia\nIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACS\nJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACA\npAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYA\nIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogB\nAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACS1qkgXr9+fVRUVEQmk4mhQ4fG\nihUrOjzm+eefj29+85txwgknRK9eveLOO+886GEBACDbOhXEEyZMiMGDB8fmzZujsrIyKisrOzym\nsbEx7rrrrti0aVO8+eab8dhjj8Xjjz9+0AMDAEA2dRjE27Zti4ULF0ZVVVUUFBTE5MmTo7a2NpYv\nX97ucWPGjInzzjsv8vPzo2fPnnHhhRfGkiVLsjY4AABkQ4dBvHr16igsLIxMJhMjRoyIdevWRZ8+\nfaKmpuZz/aIlS5bEkCFDDnhQAAA4FDoM4sbGxigqKor6+vqorq6OLVu2RHFxcTQ2Nnb6l9x///3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8pMcTkbqTj755FyPcERqaGiId999N+6+++5cj3JIJfsO8fHHHx9DhgyJZ599Npqbm+O5556L\nL3/5y9GrV69cj9YltbS0RHNzc7S0tERLS0vs2rUrWlpacj1Wl/bQQw9FXl6eWwYdpK1bt8ZLL70U\n27dvjz179sTChQvjs88+i379+uV6tC5p9OjRMX/+/L3/DBw4MCZOnCiGD9D27dvjn//8Z+zatSt2\n7doVTz75ZHTv3t0tFg9AUVFRDBw4MJ577rnYs2dPVFdXx8cff+zf9YP0xhtvRK9evY74O8ok+w5x\nRMSECRNi9uzZcc0110RpaWlMnjw51yN1Wa+99lo8+OCDex+//vrrMWbMmLjiiityOFXX9emnn8bL\nL78cxx57bIwdO3bv8zfddFOcfvrpuRusCzrqqKPijTfeiMcffzx2794dZWVlMXXqVHdE4bCwe/fu\nmDdvXnz88cdx9NFHR9++fWPq1Klx1FHJvl91UK677rp44IEHYuzYsXHiiSfGL37xi+jevXuux+rS\nXn311SP6w3T/ldfq7w4BAEiY/wUFACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaI\nAQBImiAGACBp/w9jx3q+MqvMIgAAAABJRU5ErkJggg==\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fb632fcf4e0>"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "This is not a coincidence, or the result of a carefully chosen example - it is always true of the update step. This is inevitable; if our sensor is noisy we will lose a bit of information on every update. Suppose we were to perform the update an infinite number of times - what would the result be? If we lose information on every step, we must eventually end up with no information at all, and our probabilities will be equally distributed across the pos array. Let's try this with say 500 iterations.\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "pos = [1.0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n",
      "for i in range (500):\n",
      "    pos = predict(pos, 1, .8, .1, .1)\n",
      "print(pos)\n",
      "bar_plot.plot(pos)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[ 0.1  0.1  0.1  0.1  0.1  0.1  0.1  0.1  0.1  0.1]\n"
       ]
      },
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAsQAAAF2CAYAAABpv45gAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHDhJREFUeJzt3X2QlfV9///XRldWd0FdUm9YlFYYFEIhrQkTMMSNpMGi\nncYq3Um8qamImdY6JqYNtfUuqS0mZQwaw5BUm3HSVEjGm47Fb2vQRlMwMW2niOyGgmQpGIIEcG+4\nWWD3+0e/YcvvJ7uACwf5PB4zzuye6zrXeZ/PjPLk+Nlrq3p6enoCAACFelelBwAAgEoSxAAAFE0Q\nAwBQNEEMAEDRBDEAAEUTxAAAFE0QAwBQtH6D+KmnnsqkSZNSU1OTT37ykwd94QceeCBnnXVW6uvr\nc/vtt7+tIQEA4Eg5sb8TTjvttPzJn/xJvvvd72b79u0HddEf/OAHueeee/L9738/p556aj74wQ/m\n137t1zJjxoy3PTAAAAykfj8hvvjii3PFFVekvr7+oC/6ne98J1deeWXGjBmTYcOGZebMmXnsscfe\n1qAAAHAkHPQe4kP5Dc+rVq3K+eefn3nz5uWzn/1sxo4dmx//+MeHNSAAABxJBx3EVVVVB33Rzs7O\n1NXV5bXXXsvq1aszePDgdHR0HNaAAABwJPW7h/gXDuUT4tra2nR0dGTevHlJkieeeCJ1dXVvee6S\nJUsO+roAAHC4pk6d+paPH3QQH8onxKNHj05LS8u+71euXJkLLrjggOePGTPmoK99uJ555pn85m/+\n5hF/nXcCa9HLWvSyFr2sRS9r0cta9LIWvaxFr2N9LZqbmw94rN8tE93d3dm5c2f27NmTvXv3Zteu\nXdm7d+++442NjZk9e/Z+z5kxY0Yef/zxrFy5Mhs2bMgjjzySpqamt/EWAADgyOg3iB999NGccsop\nue+++/LNb34zJ598cu699959x1tbW7Np06b9njNx4sTcdddd+fCHP5xf/dV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+LNjc3Z8mSJZk1a9aADgsAAAPtxL4O1tbW\npqOjI8OHD8/mzZuTJO3t7amrq+vzorfcckv+8i//8qD3Ds+dO3ff15MmTcrkyZMP6nkAAPBWli5d\nmmXLlu37fvr06Qc8t6qnjw2+bW1tqa+vT2traxoaGtLV1ZWhQ4dm2bJlGTdu3AEvevrpp+fNN9/c\n/4WqqrJ169b/3xaKJUuWZMyYMf2+KQAAOFzNzc2ZOnXqWx7rc8vEkCFDMm3atMyZMyc7d+7M/fff\nnxEjRuwXw42NjZk9e/Z+z9u6dWu6u7vT3d2d559/Pg0NDdm7d6/9xAAAHHP6ve3aggUL8sorr6S+\nvj6LFi3KwoUL9zve2tqaTZs2HfD5PT09brsGAMAxq88tE0eDLRMAABxph71lAgAAjneCGACAogli\nAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiC\nGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACia\nIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACK\nJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACA\nogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYA\noGgHFcTr169PY2Njamtrc+GFF+bVV1/t9zmLFy/O+9///px66qk599xzc++9977tYQEAYKAdVBDP\nmjUr48ePz5YtW9LU1JSmpqZ+n9PZ2Zn77rsvmzdvzksvvZRvfvOb+bu/+7u3PTAAAAykqp6enp6+\nTmhra8vQoUPT2tqaYcOGpaurK0OHDs2yZcsybty4g36hT3/609m9e3e+8pWv7Pf4kiVLMmbMmMOb\nHgAADkJzc3OmTp36lsf6/YR49erVqampSW1tbaZMmZK1a9dm5MiRaWlpOaQhli1blgkTJhzScwAA\n4EjrN4g7OztTV1eX9vb2NDc3Z+vWrRk8eHA6OzsP+kUeeuihdHV15frrr387swIAwIA7sb8Tamtr\n09HRkeHDh2fz5s1Jkvb29tTV1R3UCyxevDh//dd/nRdffDHV1dVvec7cuXP3fT1p0qRMnjz5oK4N\nAABvZenSpVm2bNm+76dPn37Acw9qD3F9fX1aW1vT0NBwSHuIly5dmqampvzTP/1Txo4d+5bn2EMM\nAMCR9rb2EA8ZMiTTpk3LnDlzsnPnztx///0ZMWLEfjHc2NiY2bNn7/e85cuXZ8aMGVm0aNEBYxgA\nACrtoG67tmDBgrzyyiupr6/PokWLsnDhwv2Ot7a2ZtOmTfs99uUvfzlvvPFGPvrRj2bw4MEZPHhw\nLrvssoGbHAAABkC/WyaONFsmAAA40t7WlgkAADieCWIAAIomiAEAKJogBgCgaIIYAICiCWIAAIom\niAEAKJogBgCgaIIYAICiCWIAAIomiAEAKJogBgCgaIIYAICiCWIAAIomiAEAKJogBgCgaIIYAICi\nCWIAAIomiAEAKJogBgCgaIIYAICiCWIAAIomiAEAKJogBgCgaIIYAICiCWIAAIomiAEAKJogBgCg\naCdWeoAkafl5V6VHGFBn1FWnflDVIT1ny66ebOrYfYQmqhxr0cta9LIWvaxFL2vRy1r0sha9rEWv\nw1mLvhwTQfy5//NapUcYUPddel7qB510SM/Z1LH7uFuHxFr8b9ail7XoZS16WYte1qKXtehlLXod\nzlr0xZYJAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACia\nIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACK\nJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGj9BvH69evT2NiY2traXHjhhXn11VcP6sIP\nPPBAzjrrrNTX1+f2229/24MCAMCR0G8Qz5o1K+PHj8+WLVvS1NSUpqamfi/6gx/8IPfcc0+ef/75\nrFixIo899li+/e1vD8jAAAAwkPoM4ra2tjz77LOZPXt2Bg0alFtvvTWtra1ZsWJFnxf9zne+kyuv\nvDJjxozJsGHDMnPmzDz22GMDOjgAAAyEPoN49erVqampSW1tbaZMmZK1a9dm5MiRaWlp6fOiq1at\nyvnnn5958+bls5/9bMaOHZsf//jHAzo4AAAMhD6DuLOzM3V1dWlvb09zc3O2bt2awYMHp7Ozs8+L\n/uJ5r732WlavXp3Bgweno6NjQAcHAICBUNXT09NzoIP//u//nosvvjjt7e37Hnvve9+bO+64I1de\neeUBL/rbv/3b+dCHPpTbbrstSfLEE0/kjjvueMutFkuWLHk78wMAwEGZOnXqWz5+Yl9PGjVqVHbs\n2JENGzakoaEhXV1dWbNmTc4///w+X2z06NH7batYuXJlLrjggkMaDAAAjoY+t0wMGTIk06ZNy5w5\nc7Jz587cf//9GTFiRMaNG7fvnMbGxsyePXu/582YMSOPP/54Vq5cmQ0bNuSRRx45qLtTAADA0dbn\nJ8RJsmDBglxzzTWpr6/PmDFjsnDhwv2Ot7a25rzzztvvsYkTJ+auu+7Khz/84ezevTuf+tSnMmPG\njIGdHAAABkCfe4gBAOB451c3AwBQNEEMAEDR+t1D/E7385//PA8++GDWrFmTYcOG5eabb84555xT\n6bEq4uWXX86TTz6Zn/zkJ7nooovyB3/wB5UeqWL27t2b+fPn55VXXsmuXbvyK7/yK7nhhhsyfPjw\nSo921D3wwANZsWJFdu3alTPOOCNNTU153/veV+mxKqq5uTl33313brrpplxyySWVHqci7r777vzX\nf/1XTjjhhCT/87MhN998c4Wnqoyurq584xvfyEsvvZSenp5cdNFFmTlzZqXHOuo2b96cz3zmM/s9\ntmvXrtx2222ZOHFihaaqnHXr1uXrX/961q1bl9NPPz2f+MQnilyHJGlpackjjzySjRs3ZtiwYfnU\npz6VX/7lX670WIfkuN9D/Fd/9Vc588wzc+2112bx4sV54YUXMnfu3EqPVRErV65MR0dHli9fnq6u\nrqKDePfu3XnqqadyySWXpL6+Pv/4j/+Yf/7nf868efMqPdpR19rammHDhqW6ujrLly/PnDlz8rd/\n+7cZNGhQpUeriL179+buu+9OZ2dnLr/88mKD+J577smUKVOKff//29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vs58cQT8573vCdnn312Vq1aVenRKur555/PlClTKj1GxXR1deULX/hCrrvuunzrW9/K\n7bffnnnz5mXz5s2VHu2oq66uzqc//eksXrw4N910U9ra2nLmmWfm5JNPrvRoh+S4vsvEWWedla6u\nrmzZsiX19fXZs2dPfvazn2XYsGGVHo1jQHd3d+bNm5ezzz47v/u7v1vpcY4Zx/nP2R7Qa6+9llWr\nVu33a+ZXrlyZ//7v/87v/d7vVXAyKumMM86o9AjHnI6OjvzoRz/KF7/4xUqPUjHr1q3Ljh079t1V\n4oILLsgZZ5yRVatW5d3vfneFpzv6LrjggsyZMydJ0t7eniVLlmTEiBEVnurQHNefEJ9yyimZMGFC\nnnzyyXR1deXpp5/OL/3SL+Xcc8+t9GgV0d3dna6urnR3d6e7uzu7d+9Od3d3pceqmK997Wupqqoq\n8vZJv7Bt27Y899xz2b59e/bu3Ztnn302b775ZkaPHl3p0Y666dOnZ+HChfv+GTt2bG666aYiY3j7\n9u35j//4j+zevTu7d+/Ot7/97Zx22mlF3pawrq4uY8eOzdNPP529e/emubk5P/3pT4v8d+QXvv/9\n7+fcc89NQ0NDpUepmDPOOCNdXV15+eWX09PTkzVr1mTDhg3Frsnrr7+e3bt3p6OjIw8//HDGjRv3\njvuLwXF/27Vf3Id49erVaWhoKPo+xP/yL/+S+fPn7/fYjBkzctVVV1Voosp54403cvPNN+ekk07a\n744Kt99+ey644IIKTnZ0tbW15ctf/nJaW1uzZ8+eDB8+PNdee21Ra3AgJd92rK2tLffee29++tOf\n5oQTTsioUaPyyU9+stj/u7Zp06Z89atfzZo1azJ06NBcffXVef/731/psSrmT//0T3PxxRfn0ksv\nrfQoFfWjH/0of//3f5/NmzdnyJAh+djHPpapU6dWeqyKePLJJ/PUU0+lu7s7733ve3PjjTe+4+5o\nddwHMQAA9OW43jIBAAD9EcQAABRNEAMAUDRBDABA0QQxAABFE8QAABRNEAMAUDRBDABA0QQxAABF\n+79gr4v8gOhXpQAAAABJRU5ErkJggg==\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fb61a7a3588>"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "\n",
      "After 500 iterations we have lost all information, even though we were 100% sure that we started in position 1. Feel free to play with the numbers to see the effect of differing number of updates. For example, after 100 updates we have a small amount of information left.\n"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "And, if you are viewing this on the web or in IPython Notebook, here is an animation of that output.\n",
      " <img src=\"no_info.gif\">"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Integrating Measurements and Movement Updates"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "The problem of losing information during an update may make it seem as if our system would quickly devolve into no knowledge. However, recall that our process is not an endless series of updates, but of *measure->update->measure->update->measure->update...* The output of the measure step is fed into the update. The update step, with a degraded certainty, is then fed into the measure step. \n",
      "\n",
      "Let's think about this intuitively. After the first measure->update round we have degraded the knowledge we gained by the measurement by a small amount. But now we take another measurement. When we try to incorporate that new measurement into our belief, do we become more certain, less certain, or equally certain. Consider a simple case - you are sitting in your office. A co-worker asks another co-worker where you are, and they report \"in his office\". You keep sitting there while they ask and answer \"has he moved\"? \"No\" \"Where is he\" \"In his office\". Eventually you get up and move, and lets say the person didn't see you move. At that time the questions will go \"Has he moved\" \"no\" (but you have!) \"Where is he\" \"In the kitchen\". Wow! At that moment the statement that you haven't moved conflicts strongly with the next measurement that you are in the kitchen. If we were modelling these with probabilities the probability that you are in your office would lowever, and the probability that you are in the kitchen would go up a little bit. But now imagine the subsequent conversation: \"has he moved\" \"no\" \"where is he\" \"in the kitchen\". Pretty quickly the belief that you are in your office would fade away, and the belief that you are in the kitchen would increase to near certainty. The belief that you are in the office will never go to zero, nor will the belief that you are in the kitchen ever go to 1.0 because of the chances of error, but in practice your co-workers would be correct to be quite confident in their system.\n",
      "\n",
      "That is what intuition tells us. What does the math tell us?\n",
      "\n",
      "Well, we have already programmed the measure step, and we have programmed the update step. All we need to do is feed the result of one into the other, and we will have programmed our dog tracker!!! Let's see how it performs. We will input data as if the dog started at position 0 and moved right at each update. However, as in a real world application, we will start with no knowledge and assign equal probability to all positions. "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "p = np.array([.1]*10)\n",
      "p = update(p, 1, .6, .2)\n",
      "print(p)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[ 0.1875  0.1875  0.0625  0.0625  0.0625  0.0625  0.0625  0.0625  0.1875\n",
        "  0.0625]\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "p = predict(p, 1, .8, .1, .1)\n",
      "print(p)\n",
      "bar_plot.plot(p)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[ 0.0875  0.175   0.175   0.075   0.0625  0.0625  0.0625  0.0625  0.075\n",
        "  0.1625]\n"
       ]
      },
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAsQAAAF2CAYAAABpv45gAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHHJJREFUeJzt3XtwlfWd+PFPqjHRk6AeWtQEZSsMEMpCd1GmYKmpuGLR\nna2rbKb1UlsRO7uuY2tbU3e9tbXFtgzipQxttR2n6wp2vOy4uK2NbrUFW7vbKbdElouhQGlMAXOB\ncALJ74/+CpvfD5IAgQf5vl4zzpDzPOd7PueZAd4cv3lS1N3d3R0AAJCod2U9AAAAZEkQAwCQNEEM\nAEDSBDEAAEkTxAAAJE0QAwCQNEEMAEDS+gzi5557LiZNmhSlpaXxyU9+st8LP/jgg3HmmWdGPp+P\nO+6447CGBACAI+XEvk447bTT4gtf+EL85Cc/iR07dvRr0V/84hdx7733xs9+9rM49dRT44Mf/GD8\nxV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JImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJog\nBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJLW\nZxBv3LgxqqurI5fLxYQJE2LlypX9WvgnP/lJjB8/PsrKymLEiBGxbNmywx4WAAAGWp9BPGvWrBg3\nblxs3bo1ampqoqamps9F33zzzbjyyivjn//5n6OlpSV+/vOfx1lnnTUgAwMAwEAq6u7u7j7QwZaW\nlhg8eHA0NjZGRUVFFAqFGDx4cCxdujTGjh17wEXvueeeaGhoiCeffLLPAerq6qKqqurQpgcAgH6o\nr6+PqVOn7vdYr58Qr1mzJkpLSyOXy8WUKVNi/fr1MXz48GhoaOj1BZctWxann356fOADH4gzzzwz\nrr766mhpaTn0dwAAAEdIr0Hc3t4eZWVl0draGvX19bFt27YoLy+P9vb2Xhd9++23Y9GiRbFgwYJY\nt25dtLS0xF133TWggwMAwEA4sbeDuVwu2traYujQodHc3BwREa2trVFWVtbrorlcLi655JIYP358\nRPxxH/Kdd955wPPnzJmz99eTJk2KyZMn9/sNAADA/2vJkiWxdOnSvV9Pnz79gOf2GsQjRoyInTt3\nxqZNm6KysjIKhUKsXbs2Ro0a1esAw4cPjy1btuz9uru7O3rZqhy33XZbr+sBAMDBmDx5co8PWevr\n6w94bq9bJgYNGhTTpk2L2bNnR0dHR8ydOzeGDRvW4xvqqquro7a2tsfzrrjiili8eHGsWLEiOjo6\n4tFHH42LLrroUN8PAAAcMX3edm3BggWxfPnyyOfzsWjRoli4cGGP442NjdHU1NTjsQ996ENx1113\nxV/91V9FZWVl5HK5+NKXvjSwkwMAwADo9bZrR4PbrgEAcKQd8m3XAADgeCeIAQBImiAGACBpghgA\ngKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAG\nACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaI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mxYxlMdnOP6E+JTTjklxo8f\nH88++2wUCoV4/vnn4z3veU+cc845WY+Wia6urigUCtHV1RVdXV3R2dkZXV1dWY+VmW9/+9tRVFSU\n5O2T/mT79u3x0ksvxY4dO2LPnj3x4osvxttvvx0jR47MerSjbvr06bFw4cK9/40ZMyZuuummJGN4\nx44d8etf/zo6Ozujs7MznnrqqTjttNOSvC1hWVlZjBkzJp5//vnYs2dP1NfXx+9+97skf4/8yc9+\n9rM455xzorKyMutRMjNkyJAoFArx+uuvR3d3d6xduzY2bdqU7DXZvHlzdHZ2RltbWzz66KMxduzY\nd9w/DI7726796T7Ea9asicrKyqTvQ/yf//mfMX/+/B6PzZgxI6666qqMJsrOW2+9FTfffHOcdNJJ\nPe6ocMcdd8To0aMznOzoamlpiQceeCAaGxtj9+7dMXTo0Lj22muTugYHkvJtx1paWuK+++6L3/3u\nd3HCCSfEiBEj4pOf/GSy/3etqakpvvWtb8XatWtj8ODBcfXVV8f555+f9ViZ+eIXvxgXXnhhXHrp\npVmPkqlf/epX8a//+q/R3NwcgwYNio9+9KMxderUrMfKxLPPPhvPPfdcdHV1xfvf//648cYb33F3\ntDrugxgAAHpzXG+ZAACAvghiAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACA\npP0fiaKMDJ6RaPUAAAAASUVORK5CYII=\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fb61a7a8d68>"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "So after the first update we have assigned a high probability to each door position, and a low probability to each wall position. The update step shifted these probabilities to the right, smearing them about a bit. Now let's look at what happens at the next sense."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "p = update(p, 1, .6, .2)\n",
      "print(p)\n",
      "bar_plot.plot(p)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[ 0.15671642  0.31343284  0.10447761  0.04477612  0.03731343  0.03731343\n",
        "  0.03731343  0.03731343  0.13432836  0.09701493]\n"
       ]
      },
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAsQAAAF2CAYAAABpv45gAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHMNJREFUeJzt3XtwlXed+PFPbNOkPQltg9I2oUULw00Ed1FGUrGxqFRa\nR2vLZrQX65aCo7VTRW22a29qd6nKIK2VQbes03Hdgk4vTpeqSKutW6p115FbInIxCIhpBJoLhBNI\n9g9/wua35AIceCjf12umM+Q8z/nmc54ZypvDN88p6u7u7g4AAEjUa7IeAAAAsiSIAQBImiAGACBp\nghgAgKQJYgAAkiaIAQBImiAGACBp/Qbxk08+GZMnT47S0tL46Ec/OuCFH3jggTj//POjoqIi7rjj\njmMaEgAAjpfT+zvhnHPOic997nPxk5/8JPbs2TOgRX/xi1/EvffeGz//+c/j7LPPjre//e3xN3/z\nNzFjxoxjHhgAAAqp33eIL7300rjqqquioqJiwIt+//vfj6uvvjrGjBkTlZWVMXPmzHj00UePaVAA\nADgeBryH+Eg+4Xn9+vUxatSoWLBgQXzmM5+JsWPHxm9/+9ujGhAAAI6nAQdxUVHRgBdtb2+PsrKy\n2LRpU2zYsCHKy8ujra3tqAYEAIDjqd89xH91JO8Q53K5aGtriwULFkRExOOPPx5lZWWHPXfFihUD\nXhcAAI7W1KlTD/v4gIP4SN4hHjlyZDQ0NBz8et26dTF69Ohezx8zZsyA1z5aTz/9dLz3ve897t/n\n1cC1OMS1OMS1OMS1OMS1OMS1OMS1OMS1OORkvxb19fW9Hut3y0RXV1d0dHTE/v3748CBA7Fv3744\ncODAweM1NTVRV1fX4zkzZsyIxx57LNatWxfbtm2LxYsXR21t7TG8BAAAOD76DeJHHnkkzjrrrLj/\n/vvjO9/5Tpx55plx3333HTze2NgYTU1NPZ4zadKkuPvuu+Od73xnvOlNb4ra2lq3XAMA4KTU75aJ\nG2+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BgAAR6q6urrHm6z19fW9ntvnlolBgwbFtGnTYu7c\nudHR0RHz58+PYcOGxbhx4w6eU1NTE3V1dT2eN2bMmHjsscdi9+7d0dHREUuXLo03vvGNR/t6AADg\nuOn3tmuLFi2K1atXR0VFRSxdujSWLFnS43hjY2M0NTX1eOzuu++OCy+8MEaOHBlVVVWxe/fuePDB\nBws7OQAAFEBRd3d3d5YDrFixIsaMGZPlCAAAnOLq6+tj6tSphz3mo5sBAEiaIAYAIGmCGACApAli\nAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmC\nGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEia\nIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACS\nJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACA\npAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEiaIAYAIGmCGACApAliAACSJogBAEhav0G8\ndevWqKmpiVwuFxMnToy1a9cOaOGf/OQnMWHChCgrK4sRI0bEqlWrjnlYAAAotH6DeNasWTF+/PjY\nuXNn1NbWRm1tbb+L/v73v4+rr746Pv/5z0dLS0v853/+Z1xwwQUFGRgAAAqpqLu7u7u3gy0tLTF4\n8OBobGyMysrKyOfzMXjw4Fi5cmWMGzeu10XvueeeaGhoiEcffbTfAVasWBFjxow5uukBAGAA6uvr\nY+rUqYc91uc7xBs2bIjS0tLI5XIxZcqU2Lx5cwwfPjwaGhr6/IarVq2Kc889N972trfF+eefH9de\ne220tLQc/SsAAIDjpM8gbm9vj7KysmhtbY36+vrYtWtXlJeXR3t7e5+LvvLKK7F06dJYtGhRbNq0\nKVpaWuKuu+4q6OAAAFAIp/d1MJfLRVtbWwwdOjSam5sjIqK1tTXKysr6XDSXy8V73vOemDBhQkT8\nZR/ynXfe2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Cj54fqAABImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBp\n/Qbx1q1bo6amJnK5XEycODHWrl07oIUfeOCBOP/886OioiLuuOOOYx4UAACOh36DeNasWTF+/PjY\nuXNn1NbWRm1tbb+L/uIXv4h77703nn322VizZk08+uij8b3vfa8gAwMAQCH1GcQtLS2xfPnyqKur\ni5KSkrjtttuisbEx1qxZ0+ei3//+9+Pqq6+OMWPGRGVlZcycOTMeffTRgg4OAACF0GcQb9iwIUpL\nSyOXy8WUKVNi8+bNMXz48GhoaOhz0fXr18eoUaNiwYIF8ZnPfCbGjh0bv/3tbws6OAAAFEKfQdze\n3h5lZWXR2toa9fX1sWvXrigvL4/29vY+F/3r8zZt2hQbNmyI8vLyaGtrK+jgAABQCEXd3d3dvR38\n7//+77j00kujtbX14GNvfvOb484774yrr76610Xf//73xzve8Y6YM2dOREQ8/vjjceeddx52q8WK\nFSuOZX4AABiQqVOnHvbx0/t60ogRI2Lv3r2xbdu2qKqqinw+Hxs3boxRo0b1+c1GjhzZY1vFunXr\nYvTo0Uc0GAAAnAh9bpkYNGhQTJs2LebOnRsdHR0xf/78GDZsWIwbN+7gOTU1NVFXV9fjeTNmzIjH\nHnss1q1bF9u2bYvFixcP6O4UAABwovX5DnFExKJFi+K6666LioqKGDNmTCxZsqTH8cbGxrj44ot7\nPDZp0qS4++67453vfGd0dnbGxz72sZgxY0ZhJwcAgALocw8xAACc6nx0MwAASRPEAAAkrd89xK92\nf/7zn+PBBx+MjRs3RmVlZdxyyy1x4YUXZj1WJl566aV44okn4ve//31ccskl8fGPfzzrkTJz4MCB\nWLhwYaxevTr27dsXb3jDG+Kmm26KoUOHZj3aCffAAw/EmjVrYt++fTFkyJCora2Nt7zlLVmPlan6\n+vq45557Yvbs2XHZZZdlPU4m7rnnnvjd734Xp512WkT85WdDbrnlloynykY+n49vf/vb8eKLL0Z3\nd3dccsklMXPmzKzHOuGam5vj05/+dI/H9u3bF3PmzIlJkyZlNFV2tmzZEt/61rdiy5Ytce6558aH\nP/zhJK9DRERDQ0MsXrw4duzYEZWVlfGxj30sXv/612c91hE55fcQ//M//3Ocd955cf3118eyZcvi\nueeei3nz5mU9VibWrVsXbW1tsWrVqsjn80kHcWdnZzz55JNx2WWXRUVFRfzHf/xH/PjHP44FCxZk\nPdoJ19jYGJWVlVFcXByrVq2KuXPnxr/+679GSUlJ1qNl4sCBA3HPPfdEe3t7XHnllckG8b333htT\npkxJ9vX/b9/85jfjT3/6U3zyk5+Ms88+O7Zu3ZrsGyv/244dO+L222+Pb33rW3HGGWdkPc4J99nP\nfjYmT54cH/zgB2PVqlXxla98JRYuXBhlZWVZj3ZCdXZ2xic+8Ym4/vrr4+1vf3s8/vjj8bOf/exV\n9+fpKb1lYs+ePbFq1ar4wAc+EMXFxXHFFVfEyy+/HFu2bMl6tEyMHTs2Jk2alNxv1sMpLi6Oa665\nJioqKiLiL7cP3LFjR48PoUnFsGHDori4OLq7u2P//v1RWloaRUVFWY+Vmaeffjr+9m//Ns4+++ys\nR+EkkM/n47nnnou///u/j3POOSeKiorE8P/zzDPPxKRJk5KM4YiI7du3x9ve9raIiBg/fnycccYZ\n0dTUlPFUJ9727dtj3759MWXKlCgqKoorr7wyduzY8aprrVM6iHfs2BHFxcVRWload911VzQ1NcV5\n550X27dvz3o0TjLr16+PioqKKC8vz3qUTPzLv/xLXHfddfHggw/G7bffnuwfcLt3746f/exnceWV\nV2Y9yknhu9/9btx0003xpS99KbZt25b1OJnYvn17FBUVxS9/+cu4+eab49Of/nT88pe/zHqszHV1\ndcXzzz8fl156adajZGbChAnx4osvRldXV/zmN7+JM888M8m/LPW20WDHjh0neJJjc0oH8b59+6K0\ntPTgp+21tbXFmWeeGR0dHVmPxklkz5498e1vfztuuOGGrEfJzMyZM+ORRx6J2traePDBByOfz2c9\nUiYeeeSRuOqqq6K4uDjrUTJ3/fXXx8KFC+Mb3/hGXHzxxfHlL385Dhw4kPVYJ9zevXtj//790dTU\nFAsXLoybbropvv71r8fu3buzHi1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GDEiPvrRjyb7r2tNTU3xjW98IzZu3BiDBw+O\na6+9Nt761rdmPVZm/uEf/iEuvfTSuPzyy7MeJVO/+tWv4t///d+jubk5Bg0aFB/4wAdi6tSpWY+V\niSeeeCKefPLJ6Orqije/+c1x8803v+ruaHXKBzEAAPTllN4yAQAA/RHEAAAkTRADAJA0QQwAQNIE\nMQAASRPEAAAkTRADAJA0QQwAQNIEMQAASfsf/xZ82U65cUcAAAAASUVORK5CYII=\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fb61a53d908>"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Notice the tall bar at position 1. This corresponds with the (correct) case of starting at position 0, sensing a door, shifting 1 to the right, and sensing another door. No other positions make this set of observations as likely. Now lets add an update and then sense the wall."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "p = predict(p, 1, .8, .1, .1)\n",
      "p = update(p, 0, .6, .2)\n",
      "bar_plot.plot(p)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAsQAAAF2CAYAAABpv45gAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHMNJREFUeJzt3XtwlXed+PFPbNOkPQltg9I2oUULw00EV5SRVGwsKl3a\nHa0tZrSXrZaCo91OV9xttru96VapyiCtlUG3rNPxUtDpxenSVaTV1i3V6u4st0TkYlhATCPQXCCc\nQPL7w5+wcckFOPAA39drxhlynud88znPTODd4zfPKeru7u4OAABI1OuyHgAAALIkiAEASJogBgAg\naYIYAICkCWIAAJImiAEASJogBgAgaf0G8dNPPx2TJ0+O0tLS+NjHPjbghR966KG48MILo6KiIu66\n665jGhIAAI6XM/s74bzzzou///u/jx//+MexZ8+eAS3685//PO6///742c9+Fueee268613vir/4\ni7+IGTNmHPPAAABQSP2+Q3z55ZfHNddcExUVFQNe9P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d1110X\nFRUVEfHH2wfu2LGjx4fQpGLYsGFRXFwc3d3dsX///igtLY2ioqKsx8rMs88+G29729vi3HPPzXoU\nTgL5fD5eeOGF+PjHPx7nnXdeFBUVieH/77nnnotJkyYlGcMREdu3b493vvOdERExfvz4OOuss6Kp\nqSnjqU687du3x759+2LKlClRVFQUV199dezYseOUa63TOoh37NgRxcXFUVpaGvfcc080NTXFBRdc\nENu3b896NE4y69evj4qKiigvL896lEz8y7/8S9xwww3x8MMPx5133pnsP3C7d++On/70p3H11Vdn\nPcpJ4Tvf+U7ccsst8c///M+xbdu2rMfJxPbt26OoqCh+8YtfxK233hqf/vSn4xe/+EXWY2Wuq6sr\nXnzxxbj88suzHiUzEyZMiJdffjm6urriv//7v+Pss89O8j+WettosGPHjhM8ybE5rYN43759UVpa\nevDT9tra2uLss8+Ojo6OrEfjJLJnz5745je/GTfddFPWo2Rm5syZ8dhjj0VtbW08/PDDkc/nsx4p\nE4899lhcc801UVxcnPUombvxxhtj4cKF8bWvfS0uvfTS+OIXvxgHDhzIeqwTbu/evbF///5oamqK\nhQsXxi233BJf/epXY/fu3VmPlqlVq1ZFRPT4oK7U3HTTTfHcc8/F9ddfH/PmzYtZs2Yl+XdHVVVV\nlJaWxgsvvBD79++PH/zgB/G6173ulPt35LQO4pKSkujo6IjBgwfHo48+GiNHjoy9e/dGaWlp1qNx\nkujs7IwvfelLcdlll8XkyZOzHidTZ5xxRlx55ZVRXFwca9asyXqcE66hoSFeffXVqK6uznqUk8Kl\nl14axcXFUVJSEh/5yEdi9+7dSb5LXFJSEl1dXfFXf/VXceaZZ8ab3/zmuOiii2L9+vVZj5ap559/\nPqZMmZL1GJnJ5/Pxuc99Lm666ab4zne+E3fddVcsWLAgmpubsx7thCsuLo6//du/jWXLlsXs2bOj\npaUlLrjggjj77LOzHu2InNZ3mbjwwgsjn8/Hzp07o6KiIvbv3x+///3vo7KyMuvROAl0dXXFggUL\n4qKLLooPf/jDWY9z0jjNf8+2V5s2bYr169f3+Jj5devWxf/8z//EX//1X2c4GVkaMmRI1iOcdNra\n2uKXv/xlfPGLX8x6lMxs2bIl9u7de/CuEqNHj44hQ4bE+vXr4/Wvf33G0514o0ePjrlz50ZERGtr\na6xYsSKGDRuW8VRH5rR+h/icc86JCRMmxFNPPRX5fD6eeeaZeMMb3hCXXHJJ1qNloqurK/L5fHR1\ndUVXV1d0dnZGV1dX1mNl5utf/3oUFRUlefukP9m9e3c899xzsWfPnjhw4EAsX748XnvttRg5cmTW\no51w06dPjyVLlhz839ixY2P27NlJxvCePXviv/7rv6KzszM6Ozvje9/7Xpx33nlJ3pawrKwsxo4d\nG88880wcOHAg6uvr43e/+12SPyN/8rOf/SwuueSSqKqqynqUzAwZMiTy+Xy88sor0d3dHRs3boxt\n27Yle022b98enZ2d0dbWFo8++miMGzfulPsPg9P+tmt/ug/xhg0boqqqKun7EP/kJz+JhQsX9nhs\nxowZcd1112U0UXZeffXVuO222+Kss87qcUeFu+66K0aPHp3hZCdWS0tLfOUrX4nGxsbYv39/DB06\nNG688cakrkFvUr7tWEtLSzzwwAPxu9/9Ls4444wYMWJEfOxjH0v2/11ramqKr33ta7Fx48YYPHhw\nXH/99fGOd7wj67Ey8w//8A9x+eWXx5VXXpn1KJn65S9/Gd/97nejubk5Bg0aFB/84Adj6tSpWY+V\niaeeeiqefvrp6Orqire+9a1x6623nnJ3tDrtgxgAAPpyWm+ZAACA/ghiAACSJogBAEiaIAYAIGmC\nGACApAliAACSJogBAEiaIAYAIGmCGACApP0/vnx82UCo+j0AAAAASUVORK5CYII=\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fb61a5e1780>"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "This is exciting! We have a very prominent bar at position 2 with a value of around 35%. It is over twice the value of any other bar in the plot, and is about 4% larger than our last plot, where the tallest bar was around 31%. Let's see one more sense->update cycle."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "p = predict(p, 1, .8, .1, .1)\n",
      "p = update(p, 0, .6, .2)\n",
      "bar_plot.plot(p)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAsQAAAF2CAYAAABpv45gAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHNRJREFUeJzt3X+Q1XW9+PHXpuuu7oK6FOouyg0YYJGgshhZQzfphpHN\nzavcnRLNEsEpcywqN8tfdTXMGEMzhkpqmG5XyPHHHcOK0NISy35MiOxG/GgJiNYNcH/AchZ2v3/0\nDe522R/ggQ/wfjxmnNk9n895n9f5zCDPc/iczyno6urqCgAASNTrsh4AAACyJIgBAEiaIAYAIGmC\nGACApAliAACSJogBAEiaIAYAIGl9BvETTzwREydOjOLi4vjwhz/c74Xvv//+OPPMM6OsrCxuueWW\n1zQkAAAcLif2tcNpp50Wn/nMZ+InP/lJ7Ny5s1+L/vKXv4w777wzfv7zn8epp54a73jHO+Itb3lL\nTJs27TUPDAAA+dTnO8QXXXRRXHbZZVFWVtbvRR955JG4/PLLo7KyMsrLy2PGjBnx8MMPv6ZBAQDg\ncOj3OcQH8w3Pa9asiVGjRsW8efPiU5/6VIwZMyb+8Ic/HNKAAABwOPU7iAsKCvq9aFtbW5SWlsb6\n9etj7dq1MWDAgGhtbT2kAQEA4HDq8xzifziYd4hLSkqitbU15s2bFxERjz32WJSWlh5w3+XLl/d7\nXQAAOFSTJ08+4O39DuKDeYd45MiRUV9fv+/31atXx+jRo3vcv7Kyst9rH6qnnnoq3vOe9xz2xzkW\nOBb7ORb7ORb7ORb7ORb7ORb7ORb7ORb7He3Hoq6ursdtfZ4y0dnZGe3t7bFnz57Yu3dv7N69O/bu\n3btve3V1ddTW1na7z7Rp0+LRRx+N1atXx+bNm2PhwoVRU1PzGp4CAAAcHn0G8aJFi+KUU06Je+65\nJ7773e/GySefHHfddde+7Q0NDdHY2NjtPhMmTIjbb7893vnOd8ab3vSmqKmpcck1AACOSn2eMnHN\nNdfENddc0+P2DRs2HPD2G2+8MW688cZDHizfRowYkfUIRw3HYj/HYj/HYj/HYj/HYj/HYj/HYj/H\nYr9j+VgUdB3Mp+UOg+XLlx+Rc4gBAEhXXV1djx+q6/dl1wAA4HgkiAEASJogBgAgaYIYAICkCWIA\nAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIY\nAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJog\nBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJIm\niAEASJogBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICk\nCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICk9RnEmzZtiurq6igpKYnz\nzjsvXn755X4tfOutt0Z5eXm8/vWvjw9+8IPR0tLymocFAIB86zOIZ86cGePGjYtt27ZFTU1N1NTU\n9Lno448/HosWLYrf/OY3sXHjxti2bVt88YtfzMvAAACQT70GcXNzcyxbtixqa2ujqKgobrrppmho\naIhVq1b1umh9fX1UVVXFWWedFaecckq8973vjdWrV+d1cAAAyIdeg3jt2rVRXFwcJSUlMWnSpNiw\nYUMMHz486uvre130Xe96V7z44ouxadOmaG1tjSeffDIuvfTSvA4OAAD50GsQt7W1RWlpabS0tERd\nXV1s3749BgwYEG1tbb0u+ra3vS0+8IEPxDnnnBOnnXZaFBYWxnXXXZfXwQEAIB9O7G1jSUlJtLa2\nxpAhQ6KpqSkiIlpaWqK0tLTXRR988MF47rnnoqmpKYqKimLGjBlx4403xoMPPnjA/efOnbvv54kT\nJ0ZVVdXBPg8AANjn+eefjxUrVuz7ferUqT3u22sQjxgxInbt2hWbN2+OioqKyOVysW7duhg1alSv\nAzz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NVXX40lS5bEggULYv36\n9dHc3By33XZbXgcHAIB8OLG3jSUlJdHa2hpDhgyJpqamiIhoaWmJ0tLSXhctKSmJd7/73TF+/PiI\n+Pt5yLfeemuP+8+dO3ffzxMnToyqqqp+PwEAAPhnzz//fKxYsWLf71OnTu1x316DeMSIEbFr167Y\nvHlzVFRURC6Xi3Xr1sWoUaN6HWD48OGxdevWfb93dXVFL6cqx+zZs3tdDwAADkZVVVW3N1nr6up6\n3LfXUyYGDhwYU6ZMiTlz5kR7e3vcd999MXTo0G4fqKuuro7a2tpu97vsssti6dKlsWrVqmhvb4+H\nHnooLr744kN9PgAAcNj0edm1BQsWxEsvvRRlZWWxZMmSWLx4cbftDQ0N0djY2O22Cy+8MG677bb4\n13/916ioqIiSkpL4whe+kN/JAQAgD3q97NqR4LJrAAAcbod82TUAADjeCWIAAJImiAEASJogBgAg\naYIYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEA\nSJogBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIA\nAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIY\nAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJog\nBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICk9RnEmzZt\niurq6igpKYnzzjsvXn755YN6gHe9611x9tlnH/KAAABwOPUZxDNnzoxx48bFtm3boqamJmpqavq9\n+OLFi6OlpSUKCgpe05AAAHC49BrEzc3NsWzZsqitrY2ioqK46aaboqGhIVatWtXnwq2trXHPPffE\n5z73uejq6srbwAAAkE+9BvHatWujuLg4SkpKYtKkSbFhw4YYPnx41NfX97nwF77whZg1a1YMHDgw\nb8MCAEC+9RrEbW1tUVpaGi0tLVFXVxfbt2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swAAxw5XmQAAIGlHxTvEAADk\nnw9b9o8gBgA4TvmwZf84ZQIAgKQJYgAAkiaIAQBImiAGACBpPlR3lPApUACAbAjio4RPgQIAZEMQ\nAwDHFf/qysHqM4g3bdoU06dPjxdffDFGjx4dixYtinPPPbfPhe+///64++67I5fLxfXXXx933313\nXgYGAOiNf3XlYPX5obqZM2fGuHHjYtu2bVFTUxM1NTV9LvrLX/4y7rzzznjmmWdi1apV8fDDD8f3\nv//9vAwMAAD51GsQNzc3x7Jly6K2tjaKioripptuioaGhli1alWviz7yyCNx+eWXR2VlZZSXl8eM\nGTPi4YcfzuvgAACQD70G8dq1a6O4uDhKSkpi0qRJsWHDhhg+fHjU19f3uuiaNWti1KhRMW/evPjU\npz4VY8aMiT/84Q95HRwAAPKh1yBua2uL0tLSaGlpibq6uti+fXsMGDAg2trael30H/dbv359rF27\nNgYMGBCtra15HRwAAPKhoKurq6unjb/97W/joosuipaWln23vfnNb45bb701Lr/88h4X/bd/+7e4\n8MILY/bs2RER8dhjj8Wtt956wFMtli9f/lrmBwCAfpk8efIBb+/1KhMjRoyIXbt2xebNm6OioiJy\nuVysW7cuRo0a1euDjRw5sttpFatXr47Ro0cf1GAAAHAk9HrKxMCBA2PKlCkxZ86caG9vj/vuuy+G\nDh0aY8eO3bdPdXV11NbWdrvftGnT4tFHH43Vq1fH5s2bY+HChf26OgUAABxpfV6HeMGCBTF9+vQo\nKyuLysrKWLx4cbftDQ0NMWzYsG63TZgwIW6//fZ45zvfGR0dHXH99dfHtGnT8js5AADkQa/nEAMA\nwPGuzy/mAACA45kgBgAgaX2eQ3ys+9vf/hYPPPBArFu3LsrLy+OGG26Is88+O+uxMvHiiy/G448/\nHn/605/iggsuiI9+9KNZj5SZvXv3xvz58+Oll16K3bt3xxvf+Ma49tprY8iQIVmPdsTdf//9sWrV\nqti9e3cMHjw4ampq4m1ve1vWY2Wqrq4u7rjjjpg1a1ZcfPHFWY+TiTvuuCP++Mc/xgknnBARf/9s\nyA033JDxV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LjB49OsPJjqzm\n5ub46le/Gg0NDbFnz54YMmRIXHXVVUkdg56kfNmx5ubmuOuuu+Ivf/lLnHDCCTFixIj48Ic/nOy/\nrjU2NsbXv/71WLduXQwaNCiuvPLKePvb3571WJn57Gc/GxdddFFccsklWY+SqV//+tfx3//939HU\n1BQDBw6M97///TF58uSsx8rE448/Hk888UR0dnbGm9/85rjuuuuOuStaHfdBDAAAvTmuT5kAAIC+\nCGIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICk/T/07YCjJjS1dAAAAABJ\nRU5ErkJggg==\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fb61a7a1d68>"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Here things have degraded a bit due to the long string of wall positions in the map. We cannot be as sure where we are when there is an undifferentiated line of wall positions, so naturally our probabilities spread out a bit."
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Finally, for those viewing this in a Notebook or on the web, here is an animation of that algorithm.\n",
      " <img src=\"simulate.gif\">"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "The Effect of Bad Sensor Data"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "You may be suspicious of the results above because I always passed correct sensor data into the functions. However, we are claiming that this code implements a *filter* - it should filter out bad sensor measurements. Does it do that?\n",
      "\n",
      "To make this easy to program and visualize I will change the layout of the hallway to mostly alternating doors and hallways:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "hallway = [1, 0, 1, 0, 0, 1, 0, 1, 0, 0]\n",
      "pos = np.array([.1]*10)\n",
      "measurements = [1, 0, 1, 0, 0]\n",
      "\n",
      "for m in measurements:\n",
      "    pos = update(pos, m, .6, .2)\n",
      "    pos = predict(pos, 1, .8, .1, .1)\n",
      "bar_plot.plot(pos)\n",
      "print(pos)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[ 0.2245871   0.06288015  0.06109133  0.0581008   0.09334062  0.2245871\n",
        "  0.06288015  0.06109133  0.0581008   0.09334062]\n"
       ]
      },
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAsQAAAF2CAYAAABpv45gAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHINJREFUeJzt3XuQ1fV9//HXRtdd3QV1Tb2wKK0wIoRiWhMnYIgbSYNF\nO41VupN4qamKmdY6NqYNtfWW1BaTMgStYUiqzThpKiTjpWO1rUETTcXEtJ1y2w0FyVowZCWAexFY\nYPf3R3+B8vvJ7gILB/k8HjPOcM73e77nfb4znH1y/Oz3VPX19fUFAAAK9a5KDwAAAJUkiAEAKJog\nBgCgaIIYAICiCWIAAIomiAEAKJogBgCgaAMG8ZNPPplJkyaltrY2n/zkJwd94Pvvvz+nn356Ghoa\ncvvttx/UkAAAcKgcO9AOJ510Uv74j/843/72t/PWW28N6qDf//73c8899+R73/teTjzxxHzwgx/M\nr/zKr2TGjBkHPTAAAAylAT8hvuiii3L55ZenoaFh0Af91re+lSuuuCLjxo3LiBEjcsMNN+TRRx89\nqEEBAOBQGPQa4v35hudVq1Zl7NixmTdvXj7zmc9k/Pjx+dGPfnRAAwIAwKE06CCuqqoa9EG7u7tT\nX1+fV199NatXr86wYcPS1dV1QAMCAMChNOAa4p/bn0+I6+rq0tXVlXnz5iVJHn/88dTX17/tvosX\nLx70cQEA4EBNnTr1be8fdBDvzyfE55xzTlpbW3ffXrlyZc4999x97j9u3LhBH/tAPfPMM/n1X//1\nQ/487wTOxR7OxR7OxR7OxR7OxR7OxR7OxR7OxR5H+rloaWnZ57YBl0z09vZm27Zt2blzZ3bt2pXt\n27dn165du7c3NTVl1qxZez1mxowZeeyxx7Jy5cqsX78+Dz/8cJqbmw/iJQAAwKExYBA/8sgjOeGE\nE3Lffffl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AAsNtLL72UJUuW7L49ffr0fe7bbxCPGTMmW7duzfr169PY2Jienp6sWbMmY8eO\n7XeAZ555JldeeWUaGhqSJFdffXVuu+22fe7f3zYAANhfkydP3utD1paWln3u2++SieHDh2fatGmZ\nPXt2tm3blrlz52bUqFGZMGHC7n2ampoya9asvR43bty4PPbYY9myZUu2bduWRYsW5T3vec+Bvh4A\nADhkBrzs2oIFC7Js2bI0NDRk0aJFWbhw4V7b29ra0t7evtd9d911V84888ycc845aWxszJYtW/LA\nAw8M7eQAADAEqvr6+voqOcDixYszbty4So4AAMBRrqWlJVOnTn3bbb66GQCAogliAACKJogBACia\nIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACK\nJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACA\nogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYA\noGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogB\nACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAog0Y\nxOvWrUtTU1Pq6upy/vnnZ8WKFYM68Le//e2cd955qa+vz5gxY7J06dKDHhYAAIbagEE8c+bMTJw4\nMZs2bUpzc3Oam5sHPOiPf/zjXHHFFfmzP/uzdHR05F//9V9zxhlnDMnAAAAwlKr6+vr69rWxo6Mj\np5xyStra2jJixIj09PTklFNOyZIlSzJhwoR9HvTuu+9Oa2trHn300QEHWLx4ccaNG3dg0wMAwCC0\ntLRk6tSpb7ut30+IV69endra2tTV1WXKlClZu3ZtRo8endbW1n6fcOnSpTn55JPzgQ98IKeffnqu\nuuqqdHR0HPgrAACAQ6TfIO7u7k59fX06OzvT0tKSzZs3Z9iwYenu7u73oG+++WYWLVqUBQsW5NVX\nX01HR0fuvPPOIR0cAACGwrH9bayrq0tXV1dGjhyZjRs3Jkk6OztTX1/f70Hr6ury0Y9+NOedd16S\n/1mHfMcdd+xz/zlz5uz+86RJkzJ58uRBvwAAAPh/vfTSS1myZMnu29OnT9/nvv0G8ZgxY7J169as\nX78+jY2N6enpyZo1azJ27Nh+Bxg9enQ2bNiw+3ZfX1/6Waqc2267rd/jAQDA/pg8efJeH7K2tLTs\nc99+l0wMHz4806ZNy+zZs7Nt27bMnTs3o0aN2usX6pqamjJr1qy9Hnf55Zfn6aefzvLly7Nt27Y8\n9NBDufjiiw/09QAAwCEz4GXXFixYkGXLlqWhoSGLFi3KwoUL99re1taW9vb2ve770Ic+lDvvvDO/\n9mu/lsbGxtTV1eVzn/vc0E4OAABDoN/Lrh0OLrsGAMChdsCXXQMAgKOdIAYAoGiCGACAogliAACK\nJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACA\nogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYA\noGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogB\nACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogli\nAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACjagEG8bt26\nNDU1pa6uLueff35WrFixX0/wkY98JGeeeeYBDwgAAIfSgEE8c+bMTJw4MZs2bUpzc3Oam5sHffCF\nCxems7MzVVVVBzUkAAAcKv0GcUdHR5599tnMmjUrNTU1ufXWW9PW1pbly5cPeOCurq7cd999+dM/\n/dP09fUN2cAAADCU+g3i1atXp7a2NnV1dZkyZUrWrl2b0aNHp7W1dcADf+5zn8tNN92U4cOHD9mw\nAAAw1PoN4u7u7tTX16ezszMtLS3ZvHlzhg0blu7u7n4P2tLSksWLF2fmzJlDOiwAAAy1Y/vbWFdX\nl66urowcOTIbN25Mkn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OBQGDCIZ86cmYkTJ2bTpk1pbm5Oc3Pz\ngAf9/ve/n3vuuSfPP/98li9fnkcffTTf/OY3h2RgAAAYSv0GcUdHR5599tnMmjUrNTU1ufXWW9PW\n1pbly5f3e9BvfetbueKKKzJu3LiMGDEiN9xwQx599NEhHRwAAIZCv0G8evXq1NbWpq6uLlOmTMna\ntWszevTotLa29nvQVatWZezYsZk3b14+85nPZPz48fnRj340pIMDAMBQ6DeIu7u7U19fn87OzrS0\ntGTz5s0ZNmxYuru7+z3ozx/36quvZvXq1Rk2bFi6urqGdHAAABgKVX19fX372vjv//7vueiii9LZ\n2bn7vve+97254447csUVV+zzoL/5m7+ZD33oQ7ntttuSJI8//njuuOOOt11qsXjx4oOZHwAABmXq\n1Klve/+x/T1ozJgx2bp1a9avX5/Gxsb09PRkzZo1GTt2bL9Pds455+y1rGLlypU599xz92swAAA4\nHPpdMjF8+PBMmzYts2fPzrZt2zJ37tyMGjUqEyZM2L1PU1NTZs2atdfjZsyYkcceeywrV67M+vXr\n8/DDDw/q6hQAAHC49fsJcZIsWLAgV199dRoaGjJu3LgsXLhwr+1tbW05++yz97rvggsuyF133ZUP\nf/jD2bFjRz71qU9lxowZQzs5AAAMgX7XEAMAwNHOVzcDAFA0QQwAQNEGXEP8Tvezn/0sDzzwQNas\nWZMRI0bk5ptvzplnnlnpsSrilVdeyRNPPJEf//jHufDCC/N7v/d7lR6pYnbt2pX58+dn2bJl2b59\ne37pl34p119/fUaOHFnp0Q67+++/P8uXL8/27dtz6qmnprm5Oe973/sqPVZFtbS05O67785NN92U\niy++uNLjVMTdd9+d//qv/8oxxxyT5H9+N+Tmm2+u8FSV0dPTk6997Wt5+eWX09fXlwsvvDA33HBD\npcc67DZu3JhPf/rTe923ffv23HbbbbngggsqNFXlvPbaa/nqV7+a1157LSeffHI+8YlPFHkekqS1\ntTUPP/xwNmzYkBEjRuRTn/pUfvEXf7HSY+2Xo34N8V/+5V/mtNNOyzXXXJOnn346L7zwQubMmVPp\nsSpi5cqV6erqytKlS9PT01N0EO/YsSNPPvlkLr744jQ0NOQf//Ef8y//8i+ZN29epUc77Nra2jJi\nxIhUV1dn6dKlmT17dv72b/82NTU1lR6tInbt2pW777473d3dueyyy4oN4nvuuSdTpkwp9vX/b1/5\nylfy05/+NH/wB3+QE088MevWrSv2g5X/bcOGDfnsZz+br371qznuuOMqPc5h90d/9EeZNGlSfuu3\nfitLly7NF7/4xcyfPz/19fWVHu2w2rFjR37/938/11xzTT74wQ/m8ccfz3e/+9133M/To3rJxFtv\nvZWlS5fmYx/7WKqrq3PppZfmjTfeyGuvvVbp0Spi/PjxueCCC4r7y/p2qqurc+WVV6ahoSHJ/1w+\ncMOGDXt9CU0pRo0alerq6vT19WXnzp2pra1NVVVVpceqmGeeeSa/+qu/mhNPPLHSo3AE6OnpyQsv\nvJDf/d3fzUknnZSqqiox/H8999xzueCCC4qM4SR5/fXX84EPfCBJMnHixBx33HFpb2+v8FSH3+uv\nv57t27dnypQpqaqqymWXXZYNGza841rrqA7iDRs2pLq6OrW1tbnzzjvT3t6e0047La+//nqlR+MI\ns2rVqjQ0NGTYsGGVHqUi/uZv/iZXX311HnjggXz2s58t9gfcli1b8t3vfjeXXXZZpUc5InzjG9/I\n9ddfnz//8z/P+vXrKz1ORbz++uupqqrKD37wg9x444359Kc/nR/84AeVHqvient78+KLL+aiiy6q\n9CgVc9555+Xll19Ob29v/vM//zPHH398kf9Y2tdCgw0bNhzmSQ7OUR3E27dvT21t7e5v2+vq6srx\nxx+fbdu2VXo0jiBvvfVWvva1r+Xaa6+t9CgVc8MNN+SRRx5Jc3NzHnjggfT09FR6pIp45JFHcvnl\nl6e6urrSo1TcNddck/nz5+fLX/5yzj777HzhC1/Irl27Kj3WYbd169bs3Lkz7e3tmT9/fq6//vr8\n9V//dbZs2VLp0Spq6dKlSbLXF3WV5tprr81zzz2Xq666KnPmzMnMmTOLfO9obGxMbW1tXnjhhezc\nuTP/8A//kHe9613vuJ8jR3UQ19TUZNu2bTnllFPy0EMP5ZxzzsnWrVtTW1tb6dE4QuzYsSNf/OIX\nc+GFF2bSpEmVHqeijjnmmFxyySWprq7O8uXLKz3OYdfa2po33ngjkydPrvQoR4Szzz471dXVqamp\nycc//vFs2bKlyE+Ja2pq0tvbm9/4jd/Isccem/e85z0544wzsmrVqkqPVlHPP/98pkyZUukxKqan\npyef//znc+211+Yb3/hGbr/99sybNy8bN26s9GiHXXV1df7wD/8wTz/9dG666aZ0dHTktNNOy/HH\nH1/p0fbLUX2VidNPPz09PT3ZtGlTGhoasnPnzvz0pz/NiBEjKj0aR4De3t7MmzcvZ5xxRn77t3+7\n0uMcMY7y37Pdp1dffTWrVq3a62vmV65cmf/+7//O7/zO71RwMirp1FNPrfQIR5yurq788Ic/zBe+\n8IVKj1Ixr732WrZu3br7qhLnnntuTj311KxatSrvfve7Kzzd4Xfuuedm9uzZSZLOzs4sXrw4o0aN\nqvBU++eo/oT4hBNOyHnnnZcnnngiPT09eeqpp/ILv/ALOeussyo9WkX09vamp6cnvb296e3tzY4d\nO9Lb21vpsSrmK1/5Sqqqqoq8fNLPbdmyJc8991zeeuut7Nq1K88++2zefPPNnHPOOZUe7bCbPn16\nFi5cuPu/8ePH56abbioyht966638x3/8R3bs2JEdO3bkm9/8Zk466aQiL0tYX1+f8ePH56mnnsqu\nXbvS0tKSn/zkJ0X+Hfm5733veznrrLPS2NhY6VEq5tRTT01PT09eeeWV9PX1Zc2aNVm/fn2x5+T1\n11/Pjh070tXVlYceeigTJkx4x/3D4Ki/7NrPr0O8evXqNDY2Fn0d4u985zuZP3/+XvfNmDEjV155\nZYUmqpw33ngjN998c4477ri9rqhw++2359xzz63gZIdXR0dHvvSlL6WtrS07d+7MyJEjc8011xR1\nDval5MuOdXR05N57781PfvKTHHPMMRkzZkw++clPFvt/19rb2/PlL385a9asySmnnJKrrroq73//\n+ys9VsX8yZ/8SS666KJccskllR6lon74wx/m7//+77Nx48YMHz48H/vYxzJ16tRKj1URTzzxRJ58\n8sn09vbmve99b2688cZ33BWtjvogBgCA/hzVSyYAAGAgghgAgKIJYgAAiiaIAQAomiAGAKBoghgA\ngKIJYgAAiiaIAQAomiAGAKBo/wdGXnhytfjw6wAAAABJRU5ErkJggg==\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fb61a590f28>"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "At this point we have correctly identified the likely cases, we either started at position 0 or 5, because we saw the following sequence of doors and walls 1,0,1,0,0. But now lets inject a bad measurement, and see what happens:\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "pos = update(pos, m, .6, .2)\n",
      "pos = predict(pos, 1, .8, .1, .1)\n",
      "bar_plot.plot(pos)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAsQAAAF2CAYAAABpv45gAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHHVJREFUeJzt3XtwVWe98PFfbNOk3QltN0rbhJZjYYAggooyQsWmxVMq\n7ZljT4sZ7cVqKXW0dqpVG6u9qVWqMkgvMqitTsfjKej0cqbSozWttgrVehm5JSIXg4CYRqC5QNiB\n5P3DVzh5X0gCBBbl+XxmOpPstfaTX9YMmy+7T1aKuru7uwMAABL1mqwHAACALAliAACSJogBAEia\nIAYAIGmCGACApAliAACSJogBAEhan0H85JNPxqRJk6K0tDQ++MEP9nvh++67L84888zI5/Nx2223\nHdaQAABwpJzY1wmnnXZafPrTn46f/vSnsWPHjn4t+qtf/Sruvvvu+MUvfhGnnnpqvOMd74g3v/nN\nMWPGjMMeGAAABlKf7xCff/75cdlll0U+n+/3oj/84Q/j8ssvj6qqqqioqIiZM2fGo48+eliDAgDA\nkdDvPcQH8xueV69eHaNGjYp58+bFJz/5yRgzZkz88Y9/PKQBAQDgSOp3EBcVFfV70fb29igrK4t1\n69bFmjVrory8PNra2g5pQAAAOJL63EP8TwfzDnEul4u2traYN29eREQ8/vjjUVZWtt9z6+rq+r0u\nAAAcqqlTp+738X4H8cG8Qzxy5MhoaGjY+/mqVati9OjRBzy/qqqq32sfqqeffjre/e53H/Gv82rg\nWuzjWuzjWuzjWuzjWuzjWuzjWuzjWuxzrF+L+vr6Ax7rc8tEV1dXdHR0xO7du2PPnj2xa9eu2LNn\nz97j1dXVUVtb2+M5M2bMiMceeyxWrVoVmzZtiocffjhqamoO41sAAIAjo88gfuSRR+KUU06Je++9\nN773ve/FySefHPfcc8/e442NjdHU1NTjORMnTow777wzLrjggnjjG98YNTU1brkGAMAxqc8tE9de\ne21ce+21Bzy+fv36/T5+0003xU033XTIgw20ESNGZD3CMcO12Me12Me12Me12Me12Me12Me12Me1\n2OfVfC2Kug/mp+WOgLq6uqOyhxgAgHTV19cf8Ifq+n3bNQAAOB4JYgAAkiaIAQBImiAGACBpghgA\ngKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAG\nACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaI\nAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJ\nYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBp\nghgAgKQJYgAAkiaIAQBImiAGACBpghgAgKQJYgAAkiaIAQBImiAGACBpfQbxxo0bo7q6OnK5XEyY\nMCFWrlzZr4Vvv/32qKioiNe+9rXx/ve/P1pbWw97WAAAGGh9BvGsWbNi3LhxsXXr1qipqYmampo+\nF33iiSfikUceid/+9rexYcOG2Lp1a3zhC18YkIEBAGAg9RrELS0t8cwzz0RtbW2UlJTEzTffHI2N\njbFixYpeF21oaIjJkyfHWWedFaecckpccsklsWrVqgEdHAAABkKvQbxm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BgAgaYIYAICkCWIAAJImiAEASJrbrnHMcV9RgIPntRMOnSDmmOO+ogAHz2snHDpB\nDLwqePcL4OB57ewfQQy8Knj3C+Dgee3sHz9UBwBA0gQxAABJE8QAACRNEAMAkDRBDABA0gQxAABJ\nE8QAACRNEAMAkDRBDABA0gQxAABJE8QAACRNEAMAkDRBDABA0k7MegDgwLbu6o6mts6sxxhwQ8qK\nI19SlPUYwHHKaycHSxDDMayprTNu/Z91WY8x4O69+NzIl5yU9RjAccprJwfLlgkAAJImiAEASJog\nBgAgaYIYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJLWZxBv3LgxqqurI5fLxYQJE2LlypX9\nWvi+++6LM888M/L5fNx2222HPSgAABwJfQbxrFmzYty4cbF169aoqamJmpqaPhf91a9+FXfffXc8\n99xzsWLFinj00UfjBz/4wYAMDAAAA6nXIG5paYlnnnkmamtro6SkJG6++eZobGyMFStW9LroD3/4\nw7j88sujqqoqKioqYubMmfHoo48O6OAAADAQeg3iNWvWRGlpaeRyuZgyZUqsX78+hg8fHg0NDb0u\nunr16hg1alTMmzcvPvnJT8aYMWPij3/844AODgAAA6HXIG5vb4+ysrJobW2N+vr62LZtW5SXl0d7\ne3uvi/7zeevWrYs1a9ZEeXl5tLW1DejgAAAwEIq6u7u7D3Twd7/7XZx//vnR2tq697E3velNcfvt\nt8fll19+wEX//d//Pd75znfGLbfcEhERjz/+eNx+++373WpRV1d3OPMDAEC/TJ06db+Pn9jbk0aM\nGBE7d+6MTZs2RWVlZRQKhVi7dm2MGjWq1y82cuTIHtsqVq1aFaNHjz6owQAA4GjodcvEoEGDYtq0\naTF79uzo6OiIuXPnxrBhw2Ls2LF7z6muro7a2toez5sxY0Y89thjsWrVqti0aVM8/PDD/bo7BQAA\nHG29vkMcEbFgwYK46qqrIp/PR1VVVSxcuLDH8cbGxjj33HN7PDZx4sS4884744ILLojOzs748Ic/\nHDNmzBjYyQEAYAD0uocYAACOd351MwAASRPEAAAkrc89xK92f//73+P++++P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8IMfxGmnnZbkbQnLyspizJgx8dRTT8WePXuivr4+/vrXvyb5Z+Sf\nfvGLX8Q555wTlZWVWY+SmSFDhkShUIiXXnopuru7Y+3atbFp06Zkr8nmzZujs7Mz2tra4qGHHoqx\nY8e+6v5hcNzfdu2f9yFes2ZNVFZWJn0f4p/97Gcxf/78Ho/NmDEjrrjiiowmys7LL78cN954Y5x0\n0kk97qhw2223xejRozOc7OhqaWmJr3/969HY2Bi7d++OoUOHxtVXX53UNTiQlG871tLSEvfcc0/8\n9a9/jRNOOCFGjBgRH/zgB5P9v2tNTU3xjW98I9auXRuDBw+OK6+8Mt72trdlPVZmPvOZz8T5558f\nF198cdajZOo3v/lN/Nd//Vc0NzfHoEGD4j3veU9MnTo167Ey8cQTT8STTz4ZXV1d8aY3vSmuv/76\nV90drY77IAYAgN4c11smAACgL4IYAICkCWIAAJImiAEASJogBgAgaYIYAICkCWIAAJImiAEASJog\nBgAgaf8HOL+MDGAtwtAAAAAASUVORK5CYII=\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fb61a6a3898>"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "That one bad measurment appears to have significantly eroded our knowledge. However, note that our highest probabilities are still at 0 and 5, which is correct. Now let's continue with a series of correct measurements"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "measurements = [0, 1, 0, 1, 0, 0]\n",
      "\n",
      "for i,m in enumerate(measurements):\n",
      "    pos = update(pos, m, .6, .2)\n",
      "    pos = predict(pos, 1, .8, .1, .1)\n",
      "    plt.subplot(3, 2, i+1)\n",
      "    bar_plot.plot(pos, title='step{}'.format(i+1))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAsQAAAGDCAYAAAAs4AbKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJRE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GAwGDAwM4L///S/i4uKUnpqkvF4vSkpKMGPG\nDPzyl79UbB7D/dliNF25cgUNDQ2wWCxDyy5fvoyvv/4av/rVrySvr4Tp06crPQW43W588cUXeOWV\nV2Sp19LSgp6enqGrk5OTkzF9+nQ0NDTgvvvuk7x+cnIyioqKAAAulwtVVVWIj4+XvK7aMLPHf2YD\nzG0lyJ3ZgLK5LWdmh8UR4smTJ2PBggWorKyEIAg4ceIEvv/972PWrFmS1/Z6vRAEAV6vF16vF/39\n/fB6vZLXBYA///nPiIiIkOU2XLd1d3fjzJkzuHXrFgYHB3H69GncvHkTs2fPlrRudnY2ysvLh/7N\nnTsX+fn5soTqrVu38OWXX6K/vx/9/f147733MHXqVMlvl6TX6zF37lycOHECg4ODsFqtuH79uuT/\nrf+/Tz/9FLNmzYLRaJSl3vTp0yEIAi5dugRRFNHU1IS2tjbZ6l+7dg39/f1wu904evQo5s+fL0sj\nrjbM7PGf2YByua1UZgPK57bcmQ0om9tyZnaEKNdHyXt0+56WjY2NMBqNst3T8pNPPsGhQ4d8lq1c\nuRIrVqyQtO6NGzewceNGTJo0yedq4RdeeAHJycmS1XU6nXjttddgt9sxMDAAk8mEZ599VtKad/Py\nyy8jMzNTlvtZOp1O7N69G9evX8eECROQlJSEX//617Iczero6MCbb76JpqYmxMbGYvXq1XjooYck\nr3vbH/7wBzzyyCNYtmyZbDW/+OIL/PWvf4XD4UBMTAyeeuopZGVlyVK7srISf//73+H1evHjH/8Y\n69evl/1uBGrBzP6WWjIbkC+3lcxsQNncViKzAeVyW87MDpuGmIiIiIhICmFxygQRERERkVTYEBMR\nERGRqrEhJiIiIiJVY0NMRERERKrGhpiIiIiIVI0NMRERERGpGhtiIiIiIlI1NsREREREpGpsiImI\niIhI1f4Xlx5G2kB4A2sAAAAASUVORK5CYII=\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fb61a4fd828>"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "As you can see we quickly filtered out the bad sensor reading and converged on the most likely positions for our dog."
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Drawbacks and Limitations"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Do not be mislead by the simplicity of the examples I chose. This is a robust and complete implementation of a histogram filter, and you may use the code in real world solutions. If you need a multimodal, discrete filter, this filter works.\n",
      "\n",
      "With that said, while this filter is used in industry, it is not used often because it has several limitations. Getting around those limitations is the motivation behind the chapters in the rest of this book.\n",
      "\n",
      "The first problem is scaling. Our dog tracking problem used only one variable, $pos$, to denote the dog's position. Most interesting problems will want to track several things in a large space. Realistically, at a minimum we would want to track our dogs $(x,y)$ coordinate, and probably his velocity $(\\dot{x},\\dot{y})$ as well. We have not covered the multidimensional case, but instead of a histogram we use a multidimensional grid to store the probabilities at each discrete location. Each *sense()* and *update()* step requires updating all values in the grid, so a simple four variable problem would require $O(n^4)$ running time *per time step*. Realistic filters have 10 or more variables to track, leading to exhorbinant computation requirements.\n",
      "\n",
      "The second problem is that the histogram is discrete, but we live in a continuous world. The histogram requires that you model the output of your filter as a set of discrete points. In our dog in the hallway example, we used 10 positions, which is obviously far too few positions for anything but a toy problem. For example, for a 100 meter hallway you would need 10,000 positions to model the hallway to 1cm accuracy. So each sense and update operation would entail performing calculations for 10,000 different probabilities. It gets exponentially worse as we add dimensions. If our dog was roaming in a $100x100 m^2$ courtyard, we would need 100,000,000 bins ($10,000^2$) to get 1cm accuracy.\n",
      "\n",
      "A third problem is that the histogram is multimodal. This is not always a problem - an entire class of filters, the particle filters, are multimodal and are often used because of this property. But imagine if the GPS in your car reported to you that it is 40% sure that you are on D street, but 30% sure you are on Willow Avenue. I doubt that you would find that useful. Also, GPSs report their error - they might report that you are at $(109.878W, 38.326N)$ with an error of $9m$. There is no clear mathematical way to extract error information from a histogram. Heuristics suggest themselves to be sure, but there is no exact determination. You may or may not care about that while driving, but you surely do care if you are trying to send a rocket to Mars or track and hit an oncoming missle.\n",
      "\n",
      "This difficulty is related to the fact that the filter often does not represent what is physically occuring in the world. Consider this distribution for our dog:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "p = [0.2245871, 0.06288015, 0.06109133, 0.0581008, 0.09334062, 0.2245871,\n",
      "     0.06288015, 0.06109133, 0.0581008,  0.09334062]\n",
      "bar_plot.plot(p)  "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAsQAAAF2CAYAAABpv45gAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHINJREFUeJzt3XuQ1fV9//HXRtdd3QV1Tb2wKK0wIoRiWhMnYIgbSYNF\nO41VupN4qamKmdY6NqYNtfWW1BaTMgStYUiqzThpKiTjpWO1rUETTcXEtJ1y2w0FyVowZCWAexFY\nYPf3R3+B8vvJ7gILB/k8HjPOcM73e77nfb4znH1y/Oz3VPX19fUFAAAK9a5KDwAAAJUkiAEAKJog\nBgCgaIIYAICiCWIAAIomiAEAKJogBgCgaAMG8ZNPPplJkyaltrY2n/zkJwd94Pvvvz+nn356Ghoa\ncvvttx/UkAAAcKgcO9AOJ510Uv74j/843/72t/PWW28N6qDf//73c8899+R73/teTjzxxHzwgx/M\nr/zKr2TGjBkHPTAAAAylAT8hvuiii3L55ZenoaFh0Af91re+lSuuuCLjxo3LiBEjcsMNN+TRRx89\nqEEBAOBQGPQa4v35hudVq1Zl7NixmTdvXj7zmc9k/Pjx+dGPfnRAAwIAwKE06CCuqqoa9EG7u7tT\nX1+fV199NatXr86wYcPS1dV1QAMCAMChNOAa4p/bn0+I6+rq0tXVlXnz5iVJHn/88dTX17/tvosX\nLx70cQEA4EBNnTr1be8fdBDvzyfE55xzTlpbW3ffXrlyZc4999x97j9u3LhBH/tAPfPMM/n1X//1\nQ/487wTOxR7OxR7OxR7OxR7OxR7OxR7OxR7OxR5H+rloa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7OjTfeOKSDAwDAUDi2v411dXXp\n6urKyJEjs3HjxiRJZ2dn6uvr+z3ogw8+mBdffDEbN25MTU1Nbrjhhtxyyy158MEH33b/OXPm7P7z\npEmTMnny5P19HQAAsNtLL72UJUuW7L49ffr0fe7bbxCPGTMmW7duzfr169PY2Jienp6sWbMmY8eO\n7XeAZ555JldeeWUaGhqSJFdffXVuu+22fe7f3zYAANhfkydP3utD1paWln3u2++SieHDh2fatGmZ\nPXt2tm3blrlz52bUqFGZMGHC7n2ampoya9asvR43bty4PPbYY9myZUu2bduWRYsW5T3vec+Bvh4A\nADhkBrzs2oIFC7Js2bI0NDRk0aJFWbhw4V7b29ra0t7evtd9d911V84888ycc845aWxszJYtW/LA\nAw8M7eQAADAEqvr6+voqOcDixYszbty4So4AAMBRrqWlJVOnTn3bbb66GQCAogliAACKJogBACia\nIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACK\nJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACA\nogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYA\noGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogB\nACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAog0Y\nxOvWrUtTU1Pq6upy/vnnZ8WKFYM68Le//e2cd955qa+vz5gxY7J06dKDHhYAAIbagEE8c+bMTJw4\nMZs2bUpzc3Oam5sHPOiPf/zjXHHFFfmzP/uzdHR05F//9V9zxhlnDMnAAAAwlKr6+vr69rWxo6Mj\np5xyStra2jJixIj09PTklFNOyZIlSzJhwoR9HvTuu+9Oa2trHn300QEHWLx4ccaNG3dg0wMAwCC0\ntLRk6tSpb7ut30+IV69endra2tTV1WXKlClZu3ZtRo8endbW1n6fcOnSpTn55JPzgQ98IKeffnqu\nuuqqdHR0HPgrAACAQ6TfIO7u7k59fX06OzvT0tKSzZs3Z9iwYenu7u73oG+++WYWLVqUBQsW5NVX\nX01HR0fuvPPOIR0cAACGwrH9bayrq0tXV1dGjhyZjRs3Jkk6OztTX1/f70Hr6ury0Y9+NOedd16S\n/1mHfMcdd+xz/zlz5uz+86RJkzJ58uRBvwAAAPh/vfTSS1myZMnu29OnT9/nvv0G8ZgxY7J169as\nX78+jY2N6enpyZo1azJ27Nh+Bxg9enQ2bNiw+3ZfX1/6Waqc2267rd/jAQDA/pg8efJeH7K2tLTs\nc99+l0wMHz4806ZNy+zZs7Nt27bMnTs3o0aN2usX6pqamjJr1qy9Hnf55Zfn6aefzvLly7Nt27Y8\n9NBDufjiiw/09QAAwCEz4GXXFixYkGXLlqWhoSGLFi3KwoUL99re1taW9vb2ve770Ic+lDvvvDO/\n9mu/lsbGxtTV1eVzn/vc0E4OAABDoN/Lrh0OLrsGAMChdsCXXQMAgKOdIAYAoGiCGACAogliAACK\nJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACA\nogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYA\noGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogB\nACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogli\nAACKJogBACiaIAYAoGiCGACAogliAACKJogBACiaIAYAoGiCGACAogliAACKJogBACjagEG8bt26\nNDU1pa6uLueff35WrFixX0/wkY98JGeeeeYBDwgAAIfSgEE8c+bMTJw4MZs2bUpzc3Oam5sHffCF\nCxems7MzVVVVBzUkAAAcKv0GcUdHR5599tnMmjUrNTU1ufXWW9PW1pbly5cPeOCurq7cd999+dM/\n/dP09fUN2cAAADCU+g3i1atXp7a2NnV1dZkyZUrWrl2b0aNHp7W1dc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CWIAAIomiAEAKJogBgCgaIIYAICiCWIAAIomiAEAKJogBgCgaIIYAICiCWIAAIo2YBCvW7cuTU1N\nqaury/nnn58VK1YM6sD3339/Tj/99DQ0NOT2228/6EEBAOBQGDCIZ86cmYkTJ2bTpk1pbm5Oc3Pz\ngAf9/ve/n3vuuSfPP/98li9fnkcffTTf/OY3h2RgAAAYSv0GcUdHR5599tnMmjUrNTU1ufXWW9PW\n1pbly5f3e9BvfetbueKKKzJu3LiMGDEiN9xwQx599NEhHRwAAIZCv0G8evXq1NbWpq6uLlOmTMna\ntWszevTotLa29nvQVatWZezYsZk3b14+85nPZPz48fnRj340pIMDAMBQ6DeIu7u7U19fn87OzrS0\ntGTz5s0ZNmxYuru7+z3ozx/36quvZvXq1Rk2bFi6urqGdHAAABgKVX19fX372vjv//7vueiii9LZ\n2bn7vve+97254447csUVV+zzoL/5m7+ZD33oQ7ntttuSJI8//njuuOOOt11qsXjx4oOZHwAABmXq\n1Klve/+x/T1ozJgx2bp1a9avX5/Gxsb09PRkzZo1GTt2bL9Pds455+y1rGLlypU599xz92swAAA4\nHPpdMjF8+PBMmzYts2fPzrZt2zJ37tyMGjUqEyZM2L1PU1NTZs2atdfjZsyYkcceeywrV67M+vXr\n8/DDDw/q6hQAAHC49fsJcZIsWLAgV199dRoaGjJu3LgsXLhwr+1tbW05++yz97rvggsuyF133ZUP\nf/jD2bFjRz71qU9lxowZQzs5AAAMgX7XEAMAwNHOVzcDAFA0QQwAQNEGXEP8Tvezn/0sDzzwQNas\nWZMRI0bk5ptvzplnnlnpsSrilVdeyRNPPJEf//jHufDCC/N7v/d7lR6pYnbt2pX58+dn2bJl2b59\ne37pl34p119/fUaOHFnp0Q67+++/P8uXL8/27dtz6qmnprm5Oe973/sqPVZFtbS05O67785NN92U\niy++uNLjVMTdd9+d//qv/8oxxxyT5H9+N+Tmm2+u8FSV0dPTk6997Wt5+eWX09fXlwsvvDA33HBD\npcc67DZu3JhPf/rTe923ffv23HbbbbngggsqNFXl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r8\n9V//dbZs2VLp0Spq6dKlSbLXF3WV5tprr81zzz2Xq666KnPmzMnMmTOLfO9obGxMbW1tXnjhhezc\nuTP/8A//kHe9613vuJ8jR3UQ19TUZNu2bTnllFPy0EMP5ZxzzsnWrVtTW1tb6dE4QuzYsSNf/OIX\nc+GFF2bSpEmVHqeijjnmmFxyySWprq7O8uXLKz3OYdfa2po33ngjkydPrvQoR4Szzz471dXVqamp\nycc//vFs2bKlyE+Ja2pq0tvbm9/4jd/Isccem/e85z0544wzsmrVqkqPVlHPP/98pkyZUukxKqan\npyef//znc+211+Yb3/hGbr/99sybNy8bN26s9GiHXXV1df7wD/8wTz/9dG666aZ0dHTktNNOy/HH\nH1/p0fbLUX2VidNPPz09PT3ZtGlTGhoasnPnzvz0pz/NiBEjKj0aR4De3t7MmzcvZ5xxRn77t3+7\n0uMcMY7y37Pdp1dffTWrVq3a62vmV65cmf/+7//O7/zO71RwMirp1FNPrfQIR5yurq788Ic/zBe+\n8IVKj1Ixr732WrZu3br7qhLnnntuTj311KxatSrvfve7Kzzd4Xfuuedm9uzZSZLOzs4sXrw4o0aN\nqvBU++eo/oT4hBNOyHnnnZcnnngiPT09eeqpp/ILv/ALOeussyo9WkX09vamp6cnvb296e3tzY4d\nO9Lb21vpsSrmK1/5Sqqqqoq8fNLPbdmyJc8991zeeuut7Nq1K88++2zefPPNnHPOOZUe7bCbPn16\nFi5cuPu/8ePH56abbioyht966638x3/8R3bs2JEdO3bkm9/8Zk466aQiL0tYX1+f8ePH56mnnsqu\nXbvS0tKSn/zkJ0X+Hfm5733veznrrLPS2NhY6VEq5tRTT01PT09eeeWV9PX1Zc2aNVm/fn2x5+T1\n11/Pjh070tXVlYceeigTJkx4x/3D4Ki/7NrPr0O8evXqNDY2Fn0d4u985zuZP3/+XvfNmDEjV155\nZYUmqpw33ngjN998c4477ri9rqhw++2359xzz63gZIdXR0dHvvSlL6WtrS07d+7MyJEjc8011xR1\nDval5MuOdXR05N57781PfvKTHHPMMRkzZkw++clPFvt/19rb2/PlL385a9asySmnnJKrrroq73//\n+ys9VsX8yZ/8SS666KJccskllR6lon74wx/m7//+77Nx48YMHz48H/vYxzJ16tRKj1URTzzxRJ58\n8sn09vbmve99b2688cZ33BWtjvogBgCA/hzVSyYAAGAgghgAgKIJYgAAiiaIAQAomiAGAKBoghgA\ngKIJYgAAiiaIAQAomiAGAKBo/wdGXnhytfjw6wAAAABJRU5ErkJggg==\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fb61a4f1da0>"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      " The largest probabilities are in position 0 and position 5. This does not fit our physical intuition at all. A dog cannot be in two places at once (my dog Simon certainly tries - his food bowl and my lap often have equal allure to him). We would have to use heuristics to decide how to interpret this distribution, and there is usually no satisfactory answer. This is not always a weakness - a considerable amount of literature has been written on *Multi-Hypothesis Tracking (MHT)*. We cannot always distill our knowledge to one conclusion, and MHT uses various techniques to maintain multiple story lines at once, using backtracking schemes to go *back in time* to correct hypothesis once more information is known. This will be the subject of later chapters. In other cases we truly have a multimodal situation - we may be optically tracking pedestrians on the street and need to represent all of their positions. \n",
      " \n",
      "In practice it is the exponential increase in computation time that leads to the discrete Bayes filter being the least frequently used of all filters in this book. Many problems are best formulated as discrete or multimodal, but we have other filter choices with better performance. With that said, if I had a small problem that this technique could handle I would choose to use it; it is trivial to implement, debug, and understand, all virtues in my book."
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Generalizing to Multiple Dimensions"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": []
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Summary"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "The code is very small, but the result is huge! We will go into the math more later, but we have implemented a form of a Bayesian filter. It is commonly called a Histogram filter. The Kalman filter is also a Bayesian filter, and uses this same logic to produce its results. The math is a bit more complicated, but not by much. For now, we will just explain that Bayesian statistics compute the likelihood of the present based on the past. If we know there are two doors in a row, and the sensor reported two doors in a row, it is likely that we are positioned near those doors. Bayesian statistics just formalize that example, and Bayesian filters formalize filtering data based on that math by implementing the sense->update->sense->update process. \n",
      "\n",
      "We have learned how to start with no information and derive information from noisy sensors. Even though our sensors are very noisy (most sensors are more than 80% accurate, for example) we quickly converge on the most likely position for our dog. We have learned how the update step always degrades our knowledge, but the addition of another measurement, even when it might have noise in it, improves our knowledge, allowing us to converge on the most likely result.\n",
      "\n",
      "If you followed the math carefully you will realize that all of this math is exact. The bar charts that we are displaying are not an *estimate* or *guess* - they are mathematically exact results that exactly represent our knowledge. The knowledge is probabilistic, to be sure, but it is exact, and correct.\n",
      "\n",
      "However, we are a long way from tracking an airplane or a car. This code only handles the 1 dimensional case, whereas cars and planes operate in 2 or 3 dimensions. Also, our position vector is *multimodal*. It expresses multiple beliefs at once. Imagine if your GPS told you \"it's 20% likely that you are here, but 10% likely that you are on this other road, and 5% likely that you are at one of 14 other locations\". That would not be very useful information. Also, the data is discrete. We split an area into 10 (or whatever) different locations, whereas in most real world applications we want to work with continuous data. We want to be able to represent moving 1 km, 1 meter, 1 mm, or any arbitrary amount, such as 2.347 cm. \n",
      "\n",
      "Finally, the bar charts may strike you as being a bit less certain than we would want. A 25% certaintly may not give you a lot of confidence in the answer. Of course, what is important here is the ratio of this probability to the other probabilities in your vector. If the next largest bar is 23% then we are not very knowledgable about our position, whereas if the next largest is 3% we are in fact quite certain. But this is not clear or intuitive. However, there is an extremely important insight that Kalman filters implement that will signficantly improve our accuracy from the same data.\n",
      "\n",
      "\n",
      "**If you can understand this chapter you will be able to understand and implement Kalman filters.** I cannot stress this enough. If anything is murky, go back and reread this chapter and play with the code. The rest of this book will build on the algorithms that we use here. If you don't intuitively understand why this histogram filter works, and can't at least work through the math, you will have little success with the rest of the material. However, if you grasp the fundamental insight - multiplying probabilities when we measure, and shifting probabilities when we update, leading to a converging solution - then you understand everything important you need to grasp the Kalman filter. "
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "References"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      " * [1] D. Fox, W. Burgard, and S. Thrun. \"Monte carlo localization: Efficient position estimation for mobile robots.\" In *Journal of Artifical Intelligence Research*, 1999.\n",
      " http://www.cs.cmu.edu/afs/cs/project/jair/pub/volume11/fox99a-html/jair-localize.html\\\n",
      "\n",
      " * [2] Dieter Fox, et. al. \"Bayesian Filters for Location Estimation\". In *IEEE Pervasive Computing*, September 2003.\n",
      " http://swarmlab.unimaas.nl/wp-content/uploads/2012/07/fox2003bayesian.pdf\n",
      " \n",
      " \n",
      " * [3] Sebastian Thrun. \"Artificial Intelligence for Robotics\".\n",
      " https://www.udacity.com/course/cs373\n",
      " \n",
      " "
     ]
    }
   ],
   "metadata": {}
  }
 ]
}