Mercurial > pylearn
view algorithms/tests/test_aa.py @ 493:32509c479e2d
Added test_daa.py
author | Joseph Turian <turian@gmail.com> |
---|---|
date | Tue, 28 Oct 2008 11:40:31 -0400 |
parents | 267ec8baef9f |
children |
line wrap: on
line source
#from __future__ import absolute_imports from pylearn import algorithms 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 '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