# keep making bootstraps yo while(True): inp, outp = ([[1, 1], [0, 1], [1, 0], [0, 0]], [[0, 1, 1, 0], [1, 0, 0, 1]]) inp = np.array(inp) outp = np.array(outp) # create new function arrays for the respective bootstrap valid_fn_array = [] test_fn_array = [] # this array holds the training errors per minibatch epoch_train_error_array = [[] for n in xrange(num_tasks)] log('> ... building functions for bootstrap found %d' % epoch_counter) # build the finetuning functions for these bootstraps for idx, task in enumerate(dnn_array): train_fn, valid_fn, test_fn = dnn.build_functions( (inp[idx], outp[idx]), ([], []), ([], []), mbatch_size, onlyTrain=True) train_fn_array.append(train_fn) total_train_err = 0.0 total_cost = 0.0 # now we're going to train for taskidx in xrange(num_tasks): for batchidx in xrange(mbatch_per_bootstrap): one_err, one_cost = train_fn_array[taskidx](index=batchidx, learning_rate=train_learning_rate) one_err = float(one_err) total_cost += one_cost epoch_train_error_array[taskidx].append(one_err) batch_test_err = test_fn_array[taskidx](index=batchidx) if not math.isnan(batch_test_err): test_err += batch_test_err mean_train_err = np.mean(epoch_train_error_array[taskidx])
mean_train_error_array = []#[[] for n in xrange(num_tasks)] epoch_train_error_array = [[] for n in xrange(num_tasks)] val_error_array = []#[[] for n in xrange(num_tasks)] test_error_array = [] epoch_counter = 0 # create new function arrays for the respective bootstrap train_fn_array = [] valid_fn_array = [] test_fn_array = [] inp, outp = get_bootstraps(bootstrap_size) log('> ... building functions for bootstrap found %d' % epoch_counter) # build the finetuning functions for these bootstraps for idx, task in enumerate(dnn_array): train_fn, valid_fn, test_fn = dnn.build_functions( (inp[idx], outp[idx]), (None, None), (testin[idx], testout[idx]), mbatch_size, True) train_fn_array.append(train_fn) valid_fn_array.append(valid_fn) test_fn_array.append(test_fn) try: # keep making bootstraps yo while(True): # this array holds the training errors per minibatch epoch_train_error_array = [[] for n in xrange(num_tasks)]