Mercurial > pylearn
view pylearn/algorithms/tests/test_aa.py @ 1484:83d3c9ee6d65
* changed MNIST dataset to use config.get_filepath_in_roots mechanism
author | gdesjardins |
---|---|
date | Tue, 05 Jul 2011 11:01:51 -0400 |
parents | 0a27ba2157b6 |
children |
line wrap: on
line source
#from __future__ import absolute_imports from pylearn.algorithms import aa as models import theano import numpy import time def test_train(mode = theano.Mode('c|py', 'fast_run')): aa = models.SigmoidXEAutoEncoder(regularize = False) # print aa.update.pretty(mode = theano.Mode('py', 'fast_run').excluding('inplace')) model = aa.make(lr = 0.01, input_size = 100, hidden_size = 1000, mode = mode) data = [[0, 1, 0, 0, 1, 1, 1, 0, 1, 0]*10]*10 #data = numpy.random.rand(10, 100) t1 = time.time() for i in xrange(1001): cost = model.update(data) if i % 100 == 0: print i, cost t2 = time.time() return t2 - t1 if __name__ == '__main__': numpy.random.seed(10) print 'sanity check:' t1 = test_train('SANITY_CHECK') # t1 = test_train([theano.Mode('c|py', 'fast_compile'), # theano.Mode('c|py', 'fast_run')]) print 'time:',t1 print numpy.random.seed(10) print 'optimized:' t1 = test_train(theano.Mode('c|py', 'fast_run')) print 'time:',t1 print numpy.random.seed(10) print 'not optimized:' t2 = test_train(theano.Mode('c|py', 'fast_compile')) print 'time:',t2