Mercurial > ift6266
diff scripts/stacked_dae/mnist_sda.py @ 131:5c79a2557f2f
Un peu de ménage dans code pour stacked DAE, splitté en fichiers dans un nouveau sous-répertoire.
author | savardf |
---|---|
date | Fri, 19 Feb 2010 08:43:10 -0500 |
parents | |
children | 7d8366fb90bf |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/stacked_dae/mnist_sda.py Fri Feb 19 08:43:10 2010 -0500 @@ -0,0 +1,42 @@ +#!/usr/bin/python +# coding: utf-8 + +# Parameterize call to sgd_optimization for MNIST + +import numpy +import theano +import time +import theano.tensor as T +from theano.tensor.shared_randomstreams import RandomStreams + +from stacked_dae import sgd_optimization +import cPickle, gzip +from jobman import DD + +MNIST_LOCATION = '/u/savardf/datasets/mnist.pkl.gz' + +def sgd_optimization_mnist(learning_rate=0.1, pretraining_epochs = 2, \ + pretrain_lr = 0.1, training_epochs = 5, \ + dataset='mnist.pkl.gz'): + # Load the dataset + f = gzip.open(dataset,'rb') + # this gives us train, valid, test (each with .x, .y) + dataset = cPickle.load(f) + f.close() + + n_ins = 28*28 + n_outs = 10 + + hyperparameters = DD({'finetuning_lr':learning_rate, + 'pretraining_lr':pretrain_lr, + 'pretraining_epochs_per_layer':pretraining_epochs, + 'max_finetuning_epochs':training_epochs, + 'hidden_layers_sizes':[1000,1000,1000], + 'corruption_levels':[0.2,0.2,0.2], + 'minibatch_size':20}) + + sgd_optimization(dataset, hyperparameters, n_ins, n_outs) + +if __name__ == '__main__': + sgd_optimization_mnist() +