aboutsummaryrefslogtreecommitdiff
path: root/data/make_reference_output.py
diff options
context:
space:
mode:
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()
+