aboutsummaryrefslogtreecommitdiff
path: root/data/make_reference_output.py
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2015-07-29 12:06:00 -0400
committerAlex Auvolat <alex.auvolat@ens.fr>2015-07-29 12:06:00 -0400
commitdefab74395f2ddb2641bba6ab8d18bdedde7a334 (patch)
tree17821ee924e2bdcd2927ed1e61cbf410dac40108 /data/make_reference_output.py
parentca40e5c81d385e1422cebe40e009d7e93b95bfbb (diff)
downloadtaxi-defab74395f2ddb2641bba6ab8d18bdedde7a334.tar.gz
taxi-defab74395f2ddb2641bba6ab8d18bdedde7a334.zip
p-value caluculation script
Diffstat (limited to 'data/make_reference_output.py')
-rwxr-xr-xdata/make_reference_output.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/data/make_reference_output.py b/data/make_reference_output.py
new file mode 100755
index 0000000..1cd31ae
--- /dev/null
+++ b/data/make_reference_output.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+import csv
+import os
+
+from fuel.iterator import DataIterator
+from fuel.schemes import SequentialExampleScheme
+from fuel.streams import DataStream
+
+from data.hdf5 import TaxiDataset
+import data
+
+dest_outfile = open(os.path.join(data.path, 'test_answer.csv'), 'w')
+dest_outcsv = csv.writer(dest_outfile)
+dest_outcsv.writerow(["TRIP_ID", "LATITUDE", "LONGITUDE"])
+
+dataset = TaxiDataset('test', 'tvt.hdf5',
+ sources=('trip_id', 'longitude', 'latitude',
+ 'destination_longitude', 'destination_latitude'))
+it = DataIterator(DataStream(dataset), iter(xrange(dataset.num_examples)), as_dict=True)
+
+for v in it:
+ # print v
+ dest_outcsv.writerow([v['trip_id'], v['destination_latitude'],
+ v['destination_longitude']])
+
+dest_outfile.close()
+