taxi

Winning entry to the Kaggle taxi competition
git clone https://esimon.eu/repos/taxi.git
Log | Files | Refs | README

destinations.py (523B)


      1 #!/usr/bin/env python
      2 
      3 from data.hdf5 import taxi_it
      4 from visualizer import Vlist, Point
      5 
      6 
      7 _sample_size = 5000
      8 
      9 if __name__ == '__main__':
     10     points = Vlist(cluster=True)
     11     for line in taxi_it('train'):
     12         if len(line['latitude'])>0:
     13             points.append(Point(line['latitude'][-1], line['longitude'][-1]))
     14             if len(points) >= _sample_size:
     15                 break
     16     points.save('destinations (cluster)')
     17     points.cluster = False
     18     points.heatmap = True
     19     points.save('destinations (heatmap)')