When I lived in Uganda, I used to cycle to work every day, and was aware of the pollution building as I cycled down the hill into the city centre.
Air pollution monitor and example output. The vertical lines mark when we lit a match in the same room as the sensor.
I wanted to measure this pollution, so using the (very cheap) shinyei sensor and a mobile phone investigated what we could measure, and with what accuracy. I’ve not got very far yet, but this funding app gives and idea about what we’ve done and what we hope to achieve.
Air pollution monitoring in Kampala
Example of trilateration on the output areas of Sheffield
In the last post, we looked at methods to find the optimum landmark. In this post we look at how to find one’s location given a set of landmarks.
Previously I’ve naively found the probability of each location on a grid, given the reported distances to the landmarks, then sampled from this grid to find the probability for each output area.
In this notebook we approach the problem differently, and look for the probability of the set of distances to the landmarks given the output area. By swapping the order, we are able to use the node in the Bayesian network.
Read more (ipynb)
Combining two estimated distances to find your location.
Trilateration is like triangulation, but uses the distances to landmarks, rather than their angles, to determine one’s location. GPS is probably the most common example of trilateration in use at the moment.
In our problem we have a set of landmarks. We know the distance (with some uncertainty) to one, and we want to know which of the remaining landmarks we should select next to maximise the amount of information we gain about our location.
For our particular example, we ask people to estimate the distance of various landmarks from their house.
We look at how to find a good landmark quickly, by using Bayes’ rule to rearrange the expression for the entropy in the probability distribution.
The online psychic is running happily on my local machine, but I needed to get it onto this webserver.
Unfortunately the server doesn’t have pandas, numpy, etc installed.
I tried downloading virtualenv, which when untarred and run generates its own module collection. But I found its version of pip didn’t work, “shared host SystemError: Cannot compile ‘Python.h’. “.
So the next option: Anaconda? (I’ve only 1Gb of space, turns out that’s not enough).
Back to virtualenv:
Install my own version of python: https://my.justhost.com/cgi/help/python-install
Then following the instructions here: http://stackoverflow.com/questions/24748084/installing-numpy-without-sudo
Combined with the help here:
(download virtualenv here: https://pypi.python.org/pypi/virtualenv#downloads )
It still didn’t work – there’s a problem with the configuration of virtualenv’s python. It might be better to scrap virtualenv and download all the modules etc that I’ll need and compile them. The only advantage of virtualenv was that it would provide pip etc.
New python executable in venv/bin/python
ERROR: The executable venv/bin/python is not functioning
ERROR: It thinks sys.prefix is u'/home/.sites/81/site18/.users/89/mts-michael/python' (should be u'/home/.sites/81/site18/.users/89/mts-michael/venv')
These ‘lessons’ are really notes for myself, as I become familiar with python, pandas, matrix factorisation methods, etc. I’ll add a bit of an introduction at some point, and organise them nicely, but for now you can read them in my ipython folder.
Gibbs sampling a 2d multivariate Gaussian