Beispiel #1
0
 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)
Beispiel #2
0
 def load(self):
     self.iterator = DataIterator(None)
Beispiel #3
0
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()
Beispiel #4
0
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)
Beispiel #5
0
def test_it():
    return DataIterator(DataStream(valid_data))
Beispiel #6
0
def train_it():
    return DataIterator(DataStream(train_data))