Septa Next Bus

Please excuse the extremely simple layout.
Official sourceforge page: https://sourceforge.net/ projects/septanextbus/

This project uses mercurial for source control
hg clone http://hg.code.sf.net/p/septanextbus/code septanextbus-code
A good windows hg gui client - http://tortoisehg.bitbucket.org/

The project so far:

  • This project is now running live and is currently in a debugging / refinement stage. To visit the live api or demo page visit -
  • http://hestia.nighsoft.net/septa_next_bus/demo/snb_demo.html
  • http://hestia.nighsoft.net/septa_next_bus/predict.php

    Technical details

  • The learning algorithm is currently linear regression implemented in c++. There is an octave version of this however it is not used anymore. This is the list of features that are currently trained against - lat, lng, day of the week, hour, bus direction, bus destination, bus block id, current nearest stop id, current running bus count, weather, time until next scheduled stop. At the moment with limited data the mean squared average ranges from 1700 - 17000 averaging around 8000 in seconds. It currently trains against data up to 30 minutes from the stop as a easy way to make sure we don't train data that actually passed over the stop more than once. GPS data for the buses is rather infrequent so it isn't always possible to know if it passed over a stop.
  • Septa GTFS data is utilized.

    How to duplicate:

  • Download the code either with mercurial or from the official sourceforge page listed above (go to the code area and then download a snapshot). Run and create a local mysql database 'septa_next_bus_db' with the user/pass snb_user/snb_password. After compiling run ./next_bus --help to see the run options. Run ./next_bus -e to populate the stops database (needed only once). Now run ./next_bus -b to begin collecting bus data. You will need about a week's worth of data to begin decent training. An example of training route 42's 6060 stop would be ./next_bus -c -r 42 -s 6060. Training the whole route of 42 would be ./next_bus -c -r 42. See the php and demo folders for the front end php api and demo webapp code.
  • For learning machine learning I would recommend taking the free online course at - https://www.coursera.org/course/ml.

    Some images from the prototyping stage:

    Vistor Count: