diff options
author | Étienne Simon <esimon@esimon.eu> | 2015-05-22 11:24:38 -0400 |
---|---|---|
committer | Étienne Simon <esimon@esimon.eu> | 2015-05-22 11:24:50 -0400 |
commit | 6c45eb6e48775dcbbbd3177f02c1d1b0c161ba1e (patch) | |
tree | 8c30def791e19311da66fcb1833ed795403cda98 /model | |
parent | 1137abf0511359df8f468f1d9a4828f3e0cb1b6a (diff) | |
download | taxi-6c45eb6e48775dcbbbd3177f02c1d1b0c161ba1e.tar.gz taxi-6c45eb6e48775dcbbbd3177f02c1d1b0c161ba1e.zip |
Fix model/time_simple_mlp.
Diffstat (limited to 'model')
-rw-r--r-- | model/time_simple_mlp.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/model/time_simple_mlp.py b/model/time_simple_mlp.py index 0ce6b29..a52590d 100644 --- a/model/time_simple_mlp.py +++ b/model/time_simple_mlp.py @@ -11,8 +11,10 @@ class Model(FFMLP): @application(outputs=['duration']) def predict(self, **kwargs): - outputs = super(Model, self).predict(**kwargs) - return kwargs['input_time'] + self.config.exp_base ** outputs + outputs = super(Model, self).predict(**kwargs).flatten() + if hasattr(self.config, 'exp_base'): + outputs = self.config.exp_base ** outputs + return kwargs['input_time'] + outputs @predict.property('inputs') def predict_inputs(self): @@ -22,7 +24,7 @@ class Model(FFMLP): def cost(self, **kwargs): y_hat = self.predict(**kwargs) y = kwargs['travel_time'] - return error.rmsle(y_hat.flatten(), y.flatten()) + return error.rmsle(y_hat, y) @cost.property('inputs') def cost_inputs(self): |