taxi

Winning entry to the Kaggle taxi competition
git clone https://esimon.eu/repos/taxi.git
Log | Files | Refs | README

commit d38cee1ceaed486c1ba3bed9271008dc82fde331
parent 20a1a01cef9d61ce9dd09995f2c811ab5aca2a9d
Author: Alex Auvolat <alex.auvolat@ens.fr>
Date:   Fri,  8 May 2015 16:17:55 -0400

Add scaling factor between two costs in joint model

Diffstat:
Mconfig/joint_simple_mlp_tgtcls_1_cswdtx.py | 3+++
Mmodel/joint_simple_mlp_tgtcls.py | 8++++++--
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 @@ -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 @@ -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']