aboutsummaryrefslogtreecommitdiff
path: root/model/time_simple_mlp_tgtcls.py
diff options
context:
space:
mode:
authorÉtienne Simon <esimon@esimon.eu>2015-07-02 12:59:15 -0400
committerÉtienne Simon <esimon@esimon.eu>2015-07-02 12:59:15 -0400
commit98139f573eb179c8f5a06ba6c8d8883376814ccf (patch)
treef27270d80cb91c19639227c921549f762eda2f72 /model/time_simple_mlp_tgtcls.py
parenta4b190516d00428b1d8a81686a3291e5fa5f9865 (diff)
downloadtaxi-98139f573eb179c8f5a06ba6c8d8883376814ccf.tar.gz
taxi-98139f573eb179c8f5a06ba6c8d8883376814ccf.zip
Remove _simple
Diffstat (limited to 'model/time_simple_mlp_tgtcls.py')
-rw-r--r--model/time_simple_mlp_tgtcls.py33
1 files changed, 0 insertions, 33 deletions
diff --git a/model/time_simple_mlp_tgtcls.py b/model/time_simple_mlp_tgtcls.py
deleted file mode 100644
index 35c8d8a..0000000
--- a/model/time_simple_mlp_tgtcls.py
+++ /dev/null
@@ -1,33 +0,0 @@
-import numpy
-import theano
-from theano import tensor
-from blocks.bricks import application, Softmax
-
-import error
-from model.mlp import FFMLP, Stream
-
-
-class Model(FFMLP):
- def __init__(self, config, **kwargs):
- super(Model, self, output_layer=Softmax).__init__(config, **kwargs)
- self.classes = theano.shared(numpy.array(config.tgtcls, dtype=theano.config.floatX), name='classes')
- self.inputs.append('input_time')
-
- @application(outputs=['duration'])
- def predict(self, **kwargs):
- cls_probas = super(Model, self).predict(**kwargs)
- return kwargs['input_time'] + tensor.dot(cls_probas, self.classes)
-
- @predict.property('inputs')
- def predict_inputs(self):
- return self.inputs
-
- @application(outputs=['cost'])
- def cost(self, **kwargs):
- y_hat = self.predict(**kwargs)
- y = kwargs['travel_time']
- return error.rmsle(y_hat.flatten(), y.flatten())
-
- @cost.property('inputs')
- def cost_inputs(self):
- return self.inputs + ['travel_time']