From 39e549f05e568e4153381f025b3a0f256e9a7b7a Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 22 May 2015 10:00:15 -0400 Subject: Make indexing faster by indexing only one column and querying a range --- model/dest_simple_mlp_tgtcls.py | 2 +- model/mlp.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'model') diff --git a/model/dest_simple_mlp_tgtcls.py b/model/dest_simple_mlp_tgtcls.py index 2d65097..46fca2b 100644 --- a/model/dest_simple_mlp_tgtcls.py +++ b/model/dest_simple_mlp_tgtcls.py @@ -9,7 +9,7 @@ from model.mlp import FFMLP, Stream class Model(FFMLP): def __init__(self, config, **kwargs): - super(Model, self, output_layer=Softmax).__init__(config, **kwargs) + super(Model, self).__init__(config, output_layer=Softmax, **kwargs) self.classes = theano.shared(numpy.array(config.tgtcls, dtype=theano.config.floatX), name='classes') @application(outputs=['destination']) diff --git a/model/mlp.py b/model/mlp.py index 576b45b..05898a5 100644 --- a/model/mlp.py +++ b/model/mlp.py @@ -1,6 +1,6 @@ from theano import tensor -from fuel.transformers import Batch +from fuel.transformers import Batch, MultiProcessing from fuel.streams import DataStream from fuel.schemes import ConstantScheme, ShuffledExampleScheme from blocks.bricks import application, MLP, Rectifier, Initializable @@ -63,7 +63,10 @@ class Stream(object): stream = transformers.TaxiAddDateTime(stream) stream = transformers.TaxiAddFirstLastLen(self.config.n_begin_end_pts, stream) stream = transformers.Select(stream, tuple(req_vars)) - return Batch(stream, iteration_scheme=ConstantScheme(self.config.batch_size)) + + stream = Batch(stream, iteration_scheme=ConstantScheme(self.config.batch_size)) + + return stream def valid(self, req_vars): stream = TaxiStream(self.config.valid_set, 'valid.hdf5') -- cgit v1.2.3