conv_filters = 32
deconv_filters = 32
filter_sizes = 7
epochs = 20
encode_size = 40
l_in = layers.InputLayer((None, 1, 28, 28))
l_conv = layers.Conv2DLayer(l_in, num_filters=conv_filters, filter_size = (filter_sizes, filter_sizes), pad="valid", nonlinearity=None, W=init.GlorotUniform(), b=init.Constant(0.))
l_pool = layers.MaxPool2DLayer(l_conv, pool_size=(2,2))
l_flat = ReshapeLayer(l_pool,shape=(([0], -1)))
l_en = layers.DenseLayer(l_flat,num_units=encode_size)
l_hidd = layers.DenseLayer(l_en,num_units=deconv_filters * (28 + filter_sizes - 1) ** 2 / 4, W=init.GlorotUniform(), b=init.Constant(0.))
l_unflat = ReshapeLayer(l_hidd,shape=(([0], deconv_filters, (28 + filter_sizes - 1) / 2, (28 + filter_sizes - 1) / 2 )))
l_unpool = Unpool2DLayer(l_unflat, ds=(2,2))
l_deconv = layers.Conv2DLayer(l_unpool, num_filters=1, filter_size=(filter_sizes, filter_sizes), pad="valid", nonlinearity=None)
l_out = layers.ReshapeLayer(l_deconv, shape=(([0], -1)))
ae = NeuralNet(layers=[('input', l_in), ('conv', l_conv), ('pool', l_pool), ('flatten', l_flat),
('encode_layer', l_en), ('hidden', l_hidd), ('unflatten', l_unflat),
('unpool', l_unpool), ('deconv', l_deconv), ('output_layer',l_out)],update_learning_rate = 0.01,
update_momentum = 0.975, batch_iterator_train=FlipBatchIterator(batch_size=128), regression=True,
max_epochs= epochs, verbose=1)
ae.fit(X_train, X_out)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-122-fcd713c0425c> in <module>()
58 # print prediction
59
---> 60 ae.fit(X_train, X_out, epochs=None)
61 print 'done'
62 ### expect training / val error of about 0.087 with these parameters
/home/tarek/Libraries/anaconda/lib/python2.7/site-packages/nolearn/lasagne/base.pyc in fit(self, X, y, epochs)
443 y = self.enc_.fit_transform(y).astype(np.int32)
444 self.classes_ = self.enc_.classes_
--> 445 self.initialize()
446
447 try:
/home/tarek/Libraries/anaconda/lib/python2.7/site-packages/nolearn/lasagne/base.pyc in initialize(self)
284 out = getattr(self, '_output_layer', None)
285 if out is None:
--> 286 out = self._output_layer = self.initialize_layers()
287 self._check_for_unused_kwargs()
288
/home/tarek/Libraries/anaconda/lib/python2.7/site-packages/nolearn/lasagne/base.pyc in initialize_layers(self, layers)
359 # assumed to require an 'incoming' paramter. By default,
360 # we'll use the previous layer as input:
--> 361 if not issubclass(layer_factory, InputLayer):
362 if 'incoming' in layer_kw:
363 layer_kw['incoming'] = self.layers_[
TypeError: issubclass() arg 1 must be a class