aboutsummaryrefslogtreecommitdiff
path: root/make_valid_cut.py
diff options
context:
space:
mode:
authorAdeB <adbrebs@gmail.com>2015-05-05 22:15:29 -0400
committerAdeB <adbrebs@gmail.com>2015-05-05 22:15:29 -0400
commitc29a0d3f22134a8d1f5d557b325f6779c5961546 (patch)
tree6fa431d9b3595b5d2d11089920aa07ea43172d90 /make_valid_cut.py
parentf4d3ee6449217535bdbe19ac9c5fdd825d71b0d3 (diff)
parent1f2ff96e6480a62089fcac35154a956c218ed678 (diff)
downloadtaxi-c29a0d3f22134a8d1f5d557b325f6779c5961546.tar.gz
taxi-c29a0d3f22134a8d1f5d557b325f6779c5961546.zip
Merge branch 'master' of github.com:adbrebs/taxi
Diffstat (limited to 'make_valid_cut.py')
-rw-r--r--make_valid_cut.py40
1 files changed, 0 insertions, 40 deletions
diff --git a/make_valid_cut.py b/make_valid_cut.py
deleted file mode 100644
index 2698af8..0000000
--- a/make_valid_cut.py
+++ /dev/null
@@ -1,40 +0,0 @@
-# Cuts the training dataset at the following timestamps :
-
-cuts = [
- 1376503200,
- 1380616200,
- 1381167900,
- 1383364800,
- 1387722600,
-]
-
-import random
-import csv
-import ast
-
-f = open("train.csv")
-fr = csv.reader(f)
-_skip_header = fr.next()
-g = open("cutvalid.csv", "w")
-gw = csv.writer(g)
-
-for l in fr:
- polyline = ast.literal_eval(l[-1])
- if len(polyline) == 0: continue
- time = int(l[5])
- for ts in cuts:
- if time <= ts and time + 15 * (len(polyline) - 1) >= ts:
- # keep it
- n = (ts - time) / 15 + 1
- cut = polyline[:n]
- row = l[:-1] + [
- cut.__str__(),
- polyline[-1][0],
- polyline[-1][1],
- 15 * (len(polyline)-1)
- ]
- print row
- gw.writerow(row)
-
-f.close()
-g.close()