MCPcopy Index your code
hub / github.com/lisa-lab/DeepLearningTutorials / test_dA

Function test_dA

code/dA.py:263–416  ·  view source on GitHub ↗

This demo is tested on MNIST :type learning_rate: float :param learning_rate: learning rate used for training the DeNosing AutoEncoder :type training_epochs: int :param training_epochs: number of epochs used for training :type dataset: string

(learning_rate=0.1, training_epochs=15,
            dataset='mnist.pkl.gz',
            batch_size=20, output_folder='dA_plots')

Source from the content-addressed store, hash-verified

261
262
263def test_dA(learning_rate=0.1, training_epochs=15,
264 dataset='mnist.pkl.gz',
265 batch_size=20, output_folder='dA_plots'):
266
267 """
268 This demo is tested on MNIST
269
270 :type learning_rate: float
271 :param learning_rate: learning rate used for training the DeNosing
272 AutoEncoder
273
274 :type training_epochs: int
275 :param training_epochs: number of epochs used for training
276
277 :type dataset: string
278 :param dataset: path to the picked dataset
279
280 """
281 datasets = load_data(dataset)
282 train_set_x, train_set_y = datasets[0]
283
284 # compute number of minibatches for training, validation and testing
285 n_train_batches = train_set_x.get_value(borrow=True).shape[0] // batch_size
286
287 # start-snippet-2
288 # allocate symbolic variables for the data
289 index = T.lscalar() # index to a [mini]batch
290 x = T.matrix('x') # the data is presented as rasterized images
291 # end-snippet-2
292
293 if not os.path.isdir(output_folder):
294 os.makedirs(output_folder)
295 os.chdir(output_folder)
296
297 ####################################
298 # BUILDING THE MODEL NO CORRUPTION #
299 ####################################
300
301 rng = numpy.random.RandomState(123)
302 theano_rng = RandomStreams(rng.randint(2 ** 30))
303
304 da = dA(
305 numpy_rng=rng,
306 theano_rng=theano_rng,
307 input=x,
308 n_visible=28 * 28,
309 n_hidden=500
310 )
311
312 cost, updates = da.get_cost_updates(
313 corruption_level=0.,
314 learning_rate=learning_rate
315 )
316
317 train_da = theano.function(
318 [index],
319 cost,
320 updates=updates,

Callers 1

dA.pyFile · 0.70

Calls 5

load_dataFunction · 0.90
tile_raster_imagesFunction · 0.90
dAClass · 0.85
saveMethod · 0.80
get_cost_updatesMethod · 0.45

Tested by

no test coverage detected