def get_epoch_iterator(self, as_dict=False): return DataIterator(self, self.iteration_scheme.get_request_iterator() if self.iteration_scheme else None, as_dict=as_dict)
def load(self): self.iterator = DataIterator(None)
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()
def taxi_it(which_set, filename='data.hdf5', sub=None, as_dict=True): dataset = TaxiDataset(which_set, filename) if sub is None: sub = xrange(dataset.num_examples) return DataIterator(DataStream(dataset), iter(sub), as_dict)
def test_it(): return DataIterator(DataStream(valid_data))
def train_it(): return DataIterator(DataStream(train_data))