taxi

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

memory_network_bidir_momentum.py (1581B)


      1 from blocks.initialization import IsotropicGaussian, Constant
      2 from blocks.algorithms import Momentum
      3 
      4 from blocks.bricks import Tanh
      5 
      6 import data
      7 from model.memory_network_bidir import Model, Stream
      8 
      9 
     10 dim_embeddings = [
     11     ('origin_call', data.origin_call_train_size, 10),
     12     ('origin_stand', data.stands_size, 10),
     13     ('week_of_year', 52, 10),
     14     ('day_of_week', 7, 10),
     15     ('qhour_of_day', 24 * 4, 10),
     16     ('day_type', 3, 10),
     17 ]
     18 
     19 embed_weights_init = IsotropicGaussian(0.001)
     20 
     21 
     22 class RNNConfig(object):
     23     __slots__ = ('rec_state_dim', 'dim_embeddings', 'embed_weights_init',
     24                  'dim_hidden', 'weights_init', 'biases_init')
     25 
     26 prefix_encoder = RNNConfig()
     27 prefix_encoder.dim_embeddings = dim_embeddings
     28 prefix_encoder.embed_weights_init = embed_weights_init
     29 prefix_encoder.rec_state_dim = 100
     30 prefix_encoder.dim_hidden = [100, 100]
     31 prefix_encoder.weights_init = IsotropicGaussian(0.01)
     32 prefix_encoder.biases_init = Constant(0.001)
     33 
     34 candidate_encoder = RNNConfig()
     35 candidate_encoder.dim_embeddings = dim_embeddings
     36 candidate_encoder.embed_weights_init = embed_weights_init
     37 candidate_encoder.rec_state_dim = 100
     38 candidate_encoder.dim_hidden = [100, 100]
     39 candidate_encoder.weights_init = IsotropicGaussian(0.01)
     40 candidate_encoder.biases_init = Constant(0.001)
     41 
     42 representation_size = 100
     43 representation_activation = Tanh
     44 
     45 normalize_representation = True
     46 
     47 
     48 batch_size = 64
     49 batch_sort_size = 20
     50 
     51 max_splits = 100
     52 num_cuts = 1000
     53 
     54 train_candidate_size = 100
     55 valid_candidate_size = 100
     56 test_candidate_size = 100
     57 
     58 step_rule = Momentum(learning_rate=0.01, momentum=0.9)