aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2015-05-08 16:17:55 -0400
committerAlex Auvolat <alex.auvolat@ens.fr>2015-05-08 16:22:42 -0400
commitd38cee1ceaed486c1ba3bed9271008dc82fde331 (patch)
tree24d17bfccbcb50e9e43e04f8c599727040e16278
parent20a1a01cef9d61ce9dd09995f2c811ab5aca2a9d (diff)
downloadtaxi-d38cee1ceaed486c1ba3bed9271008dc82fde331.tar.gz
taxi-d38cee1ceaed486c1ba3bed9271008dc82fde331.zip
Add scaling factor between two costs in joint model
-rw-r--r--config/joint_simple_mlp_tgtcls_1_cswdtx.py3
-rw-r--r--model/joint_simple_mlp_tgtcls.py8
2 files changed, 9 insertions, 2 deletions
diff --git a/config/joint_simple_mlp_tgtcls_1_cswdtx.py b/config/joint_simple_mlp_tgtcls_1_cswdtx.py
index f3de40b..74b3c75 100644
--- a/config/joint_simple_mlp_tgtcls_1_cswdtx.py
+++ b/config/joint_simple_mlp_tgtcls_1_cswdtx.py
@@ -41,6 +41,9 @@ dim_output_dest = len(dest_tgtcls)
dim_hidden_time = []
dim_output_time = len(time_tgtcls)
+# Cost ratio between distance cost and time cost
+time_cost_factor = 4
+
embed_weights_init = IsotropicGaussian(0.001)
mlp_weights_init = IsotropicGaussian(0.01)
mlp_biases_init = Constant(0.001)
diff --git a/model/joint_simple_mlp_tgtcls.py b/model/joint_simple_mlp_tgtcls.py
index 0a38e06..dd1242e 100644
--- a/model/joint_simple_mlp_tgtcls.py
+++ b/model/joint_simple_mlp_tgtcls.py
@@ -67,9 +67,13 @@ class Model(object):
dest_cost.name = 'dest_cost'
dest_hcost = error.hdist(dest_outputs, y_dest).mean()
dest_hcost.name = 'dest_hcost'
+
time_cost = error.rmsle(time_outputs.flatten(), y_time.flatten())
time_cost.name = 'time_cost'
- cost = dest_cost + time_cost
+ time_scost = config.time_cost_factor * time_cost
+ time_scost.name = 'time_scost'
+
+ cost = dest_cost + time_scost
cost.name = 'cost'
# Initialization
@@ -83,7 +87,7 @@ class Model(object):
mlp.initialize()
self.cost = cost
- self.monitor = [cost, dest_cost, dest_hcost, time_cost]
+ self.monitor = [cost, dest_cost, dest_hcost, time_cost, time_scost]
self.outputs = tensor.concatenate([dest_outputs, time_outputs[:, None]], axis=1)
self.outputs.name = 'outputs'
self.pred_vars = ['destination_longitude', 'destination_latitude', 'travel_time']