comparison baseline/mlp/mlp_nist.py @ 378:60a4432b8071

added initial model for weights in jobman
author xaviermuller
date Mon, 26 Apr 2010 14:39:03 -0400
parents 76b7182dd32e
children 1509b9bba4cc
comparison
equal deleted inserted replaced
377:0b7e64e8e93f 378:60a4432b8071
264 learning_rate_list=[] 264 learning_rate_list=[]
265 best_training_error=float('inf'); 265 best_training_error=float('inf');
266 divergence_flag_list=[] 266 divergence_flag_list=[]
267 267
268 if data_set==0: 268 if data_set==0:
269 print 'using nist'
269 dataset=datasets.nist_all() 270 dataset=datasets.nist_all()
270 elif data_set==1: 271 elif data_set==1:
272 print 'using p07'
271 dataset=datasets.nist_P07() 273 dataset=datasets.nist_P07()
272 elif data_set==2: 274 elif data_set==2:
275 print 'using pnist'
273 dataset=datasets.PNIST07() 276 dataset=datasets.PNIST07()
274 277
275 278
276 279
277 280
292 295
293 296
294 # check if we want to initialise the weights with a previously calculated model 297 # check if we want to initialise the weights with a previously calculated model
295 # dimensions must be consistent between old model and current configuration!!!!!! (nb_hidden and nb_targets) 298 # dimensions must be consistent between old model and current configuration!!!!!! (nb_hidden and nb_targets)
296 if init_model!=0: 299 if init_model!=0:
300 print 'using old model'
301 print init_model
297 old_model=numpy.load(init_model) 302 old_model=numpy.load(init_model)
298 classifier.W1.value=old_model['W1'] 303 classifier.W1.value=old_model['W1']
299 classifier.W2.value=old_model['W2'] 304 classifier.W2.value=old_model['W2']
300 classifier.b1.value=old_model['b1'] 305 classifier.b1.value=old_model['b1']
301 classifier.b2.value=old_model['b2'] 306 classifier.b2.value=old_model['b2']
524 adaptive_lr=state.adaptive_lr,\ 529 adaptive_lr=state.adaptive_lr,\
525 tau=state.tau,\ 530 tau=state.tau,\
526 verbose = state.verbose,\ 531 verbose = state.verbose,\
527 lr_t2_factor=state.lr_t2_factor, 532 lr_t2_factor=state.lr_t2_factor,
528 data_set=state.data_set, 533 data_set=state.data_set,
534 init_model=state.init_model,
529 channel=channel) 535 channel=channel)
530 state.train_error=train_error 536 state.train_error=train_error
531 state.validation_error=validation_error 537 state.validation_error=validation_error
532 state.test_error=test_error 538 state.test_error=test_error
533 state.nb_exemples=nb_exemples 539 state.nb_exemples=nb_exemples