diff options
author | AdeB <adbrebs@gmail.com> | 2015-07-16 10:38:45 -0400 |
---|---|---|
committer | AdeB <adbrebs@gmail.com> | 2015-07-16 10:38:45 -0400 |
commit | 97e9ac0e15b890076af0cf469efbead89f8eb804 (patch) | |
tree | e24a6dbd7964612f08c143e34b47885845da7d43 /data_analysis/maps.py | |
parent | 404250df425df4f89d9edfe2357fc0cb7b8b77e6 (diff) | |
download | taxi-97e9ac0e15b890076af0cf469efbead89f8eb804.tar.gz taxi-97e9ac0e15b890076af0cf469efbead89f8eb804.zip |
Update number of coordinates function
Diffstat (limited to 'data_analysis/maps.py')
-rw-r--r-- | data_analysis/maps.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/data_analysis/maps.py b/data_analysis/maps.py index e951f23..d5db182 100644 --- a/data_analysis/maps.py +++ b/data_analysis/maps.py @@ -10,13 +10,14 @@ from data.hdf5 import TaxiDataset, TaxiStream def compute_number_coordinates(): - stream = TaxiDataset('train').get_example_stream() + dataset = TaxiDataset('train') + stream = DataStream(dataset, iteration_scheme=ConstantScheme(1, dataset.num_examples)) train_it = stream.get_epoch_iterator() # Count the number of coordinates n_coordinates = 0 for ride in train_it: - n_coordinates += len(ride[-1]) + n_coordinates += len(ride[2]) print n_coordinates return n_coordinates @@ -51,7 +52,7 @@ def draw_map(coordinates, xrg, yrg): hist, xx, yy = np.histogram2d(coordinates[:, 0], coordinates[:, 1], bins=2000, range=[xrg, yrg]) plt.imshow(np.log(hist)) - plt.savefig(data.DATA_PATH + "/analysis/xyhmap2.png") + plt.savefig(data.path + "/analysis/xyhmap2.png") if __name__ == "__main__": |