Commit 4e8ab1ef343355a45dfe59c92d605d3e2c849004

Authored by Chunk
1 parent 4eac6680
Exists in master and in 1 other branch refactor

staged.

Showing 1 changed file with 8 additions and 8 deletions   Show diff stats
mmodel/theano/THEANO.py
... ... @@ -48,7 +48,7 @@ class ModelTHEANO(ModelBase):
48 48 X_train, X_test, Y_train, Y_test = cross_validation.train_test_split(X, Y, test_size=0.2, random_state=0)
49 49  
50 50 train_set_x, train_set_y = shared_dataset((X_train, Y_train))
51   - valid_set_x, valid_set_y = train_set_x[:1000], train_set_y[:1000]
  51 + valid_set_x, valid_set_y = shared_dataset((X_train[:1000], Y_train[:1000]))
52 52 test_set_x, test_set_y = shared_dataset((X_test, Y_test))
53 53  
54 54 # compute number of minibatches for training, validation and testing
... ... @@ -89,8 +89,8 @@ class ModelTHEANO(ModelBase):
89 89  
90 90 # Construct the second convolutional pooling layer
91 91 # filtering reduces the image size to (148-5+1, 148-5+1) = (144, 144)
92   - # maxpooling reduces this further to (144/4, 144/4) = (38, 38)
93   - # 4D output tensor is thus of shape (batch_size, nkerns[1], 38, 38)
  92 + # maxpooling reduces this further to (144/4, 144/4) = (36, 36)
  93 + # 4D output tensor is thus of shape (batch_size, nkerns[1], 36, 36)
94 94 layer1 = ConvPoolLayer(
95 95 rng,
96 96 input=layer0.output,
... ... @@ -101,15 +101,15 @@ class ModelTHEANO(ModelBase):
101 101  
102 102 # the HiddenLayer being fully-connected, it operates on 2D matrices of
103 103 # shape (batch_size, num_pixels) (i.e matrix of rasterized images).
104   - # This will generate a matrix of shape (batch_size, nkerns[1] * 4 * 4),
105   - # or (500, 50 * 4 * 4) = (500, 800) with the default values.
  104 + # This will generate a matrix of shape (batch_size, nkerns[1] * 36 * 36),
  105 + # or (500, 50 * 36 * 36) = (500, 800) with the default values.
106 106 layer2_input = layer1.output.flatten(2)
107 107  
108 108 # construct a fully-connected sigmoidal layer
109 109 layer2 = HiddenLayer(
110 110 rng,
111 111 input=layer2_input,
112   - n_in=nkerns[1] * 38 * 38,
  112 + n_in=nkerns[1] * 36 * 36,
113 113 n_out=500,
114 114 activation=T.tanh
115 115 )
... ... @@ -156,8 +156,8 @@ class ModelTHEANO(ModelBase):
156 156 ]
157 157 """
158 158 Total Parameters:
159   - >>> 20 * 64 + 1000 * 25 + 50 * 38 * 38 * 500 + 500 * 2
160   - 36127280
  159 + >>> 20 * 64 + 1000 * 25 + 50 * 36 * 36 * 500 + 500 * 2
  160 + 32427280
161 161 """
162 162 train_model = theano.function(
163 163 [index],
... ...