taxi

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

dest_mlp_tgtcls_2_cswdtx_small.py (992B)


      1 import os
      2 import cPickle
      3 
      4 from blocks.initialization import IsotropicGaussian, Constant
      5 from blocks.algorithms import Momentum
      6 
      7 import data
      8 from model.dest_mlp_tgtcls import Model, Stream
      9 
     10 
     11 n_begin_end_pts = 5     # how many points we consider at the beginning and end of the known trajectory
     12 
     13 with open(os.path.join(data.path, 'arrival-clusters.pkl')) as f: tgtcls = cPickle.load(f)
     14 
     15 dim_embeddings = [
     16     ('origin_call', data.origin_call_train_size, 10),
     17     ('origin_stand', data.stands_size, 10),
     18     ('week_of_year', 52, 10),
     19     ('day_of_week', 7, 10),
     20     ('qhour_of_day', 24 * 4, 10),
     21     ('day_type', 3, 10),
     22     ('taxi_id', 448, 10),
     23 ]
     24 
     25 dim_input = n_begin_end_pts * 2 * 2 + sum(x for (_, _, x) in dim_embeddings)
     26 dim_hidden = [100, 100]
     27 dim_output = tgtcls.shape[0]
     28 
     29 embed_weights_init = IsotropicGaussian(0.01)
     30 mlp_weights_init = IsotropicGaussian(0.1) 
     31 mlp_biases_init = Constant(0.01)
     32 
     33 step_rule = Momentum(learning_rate=0.01, momentum=0.9)
     34 
     35 batch_size = 200
     36 
     37 max_splits = 100