# HG changeset patch # User Arnaud Bergeron # Date 1269642923 14400 # Node ID 7d1fa2d7721c44bff365ed31c8b405a4c6ded32b # Parent 518589bfee55d91eaa7d8298336447b3312cbaa3 Split out the run_exp method. diff -r 518589bfee55 -r 7d1fa2d7721c deep/convolutional_dae/run_exp.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deep/convolutional_dae/run_exp.py Fri Mar 26 18:35:23 2010 -0400 @@ -0,0 +1,71 @@ +from ift6266.deep.convolutional_dae.scdae import * + +class dumb(object): + def save(self): + pass + +def go(state, channel): + from ift6266 import datasets + from ift6266.deep.convolutional_dae.sgd_opt import sgd_opt + import pylearn, theano, ift6266 + import pylearn.version + + # params: bsize, pretrain_lr, train_lr, nfilts1, nfilts2, nftils3, nfilts4 + # pretrain_rounds, noise, mlp_sz + + pylearn.version.record_versions(state, [theano, ift6266, pylearn]) + # TODO: maybe record pynnet version? + channel.save() + + dset = datasets.nist_all(1000) + + nfilts = [] + if state.nfilts1 != 0: + nfilts.append(state.nfilts1) + if state.nfilts2 != 0: + nfilts.append(state.nfilts2) + if state.nfilts3 != 0: + nfilts.append(state.nfilts3) + if state.nfilts4 != 0: + nfilts.append(state.nfilts4) + + fsizes = [(5,5)]*len(nfilts) + subs = [(2,2)]*len(nfilts) + noise = [state.noise]*len(nfilts) + + pretrain_funcs, trainf, evalf, net = build_funcs( + img_size=(32, 32), + batch_size=state.bsize, + filter_sizes=fsizes, + num_filters=nfilts, + subs=subs, + noise=noise, + mlp_sizes=[state.mlp_sz], + out_size=62, + dtype=numpy.float32, + pretrain_lr=state.pretrain_lr, + train_lr=state.train_lr) + + pretrain_fs, train, valid, test = massage_funcs( + state.bsize, dset, pretrain_funcs, trainf, evalf) + + series = create_series() + + do_pretrain(pretrain_fs, state.pretrain_rounds, series['recons_error']) + + sgd_opt(train, valid, test, training_epochs=100000, patience=10000, + patience_increase=2., improvement_threshold=0.995, + validation_frequency=2500, series=series, net=net) + +if __name__ == '__main__': + st = dumb() + st.bsize = 100 + st.pretrain_lr = 0.01 + st.train_lr = 0.1 + st.nfilts1 = 4 + st.nfilts2 = 4 + st.nfilts3 = 0 + st.pretrain_rounds = 500 + st.noise=0.2 + st.mlp_sz = 500 + go(st, dumb())