Example #1
0
print(__file__.split("/")[-1], "train data:")
print(__file__.split("/")[-1], intrain_all_data1.shape)
print(__file__.split("/")[-1], intrain_all_label.shape)
print(__file__.split("/")[-1], intrain_all_label[0:15])
print(__file__.split("/")[-1], "test data:")
print(__file__.split("/")[-1], intest_all_data1.shape)
print(__file__.split("/")[-1], intest_all_label.shape)
print(__file__.split("/")[-1], intest_all_label[0:15])
train_size = intrain_all_data1.shape[0]
test_size = intest_all_data1.shape[0]
assert (intrain_all_data1.shape[0] > 0)
assert (intrain_all_data1.shape[0] == intrain_all_label.shape[0])
assert (intest_all_data1.shape[0] > 0)
assert (intest_all_data1.shape[0] == intest_all_label.shape[0])

trainFeed = FeedInput([intrain_all_data1, intrain_all_label], batch_size)
trainFeed.shuffle_all()
testFeed = FeedInput([intest_all_data1, intest_all_label], batch_size)
testFeed.shuffle_all()
num_batches = trainFeed.get_num_batches()
print("num_batches per epoch", num_batches)

## -------------------------- data feed finish -----------------------------

init_lr = get_conf_float(conf, "init_lr")
end_lr = get_conf_float(conf, "end_lr")
nepoch = get_conf_int(conf, "nepoch")
total_steps = nepoch * num_batches
decay_steps = num_batches / 4.0
weight_decay_rate = (end_lr / init_lr)**(decay_steps / total_steps)
lg.lg_list(["init_lr=", init_lr])
Example #2
0
    print(__file__.split("/")[-1], "train data:", [ind])
    print(__file__.split("/")[-1], intrain_all_data1.shape)
    print(__file__.split("/")[-1], intrain_all_label.shape)
    print(__file__.split("/")[-1], intrain_all_label[0:15])
    print(__file__.split("/")[-1], "test data:", [ind])
    print(__file__.split("/")[-1], intest_all_data1.shape)
    print(__file__.split("/")[-1], intest_all_label.shape)
    print(__file__.split("/")[-1], intest_all_label[0:15])
    test_size[ind] = intest_all_data1.shape[0]
    assert (intrain_all_data1.shape[0] > 0)
    assert (intrain_all_data1.shape[0] == intrain_all_label.shape[0])
    assert (intest_all_data1.shape[0] > 0)
    assert (intest_all_data1.shape[0] == intest_all_label.shape[0])

    trainFeed[ind] = FeedInput([intrain_all_data1, intrain_all_label],
                               batch_size)
    trainFeed[ind].shuffle_all()
    testFeed[ind] = FeedInput([intest_all_data1, intest_all_label], batch_size)
    testFeed[ind].shuffle_all()
    tmp = trainFeed[ind].get_num_batches()
    if tmp > num_batches:
        num_batches = tmp
        max_feed_ind = ind
        print("num_batches per epoch", num_batches)

if iprint: print("test_size", test_size)
test_size = max(test_size.values())
if iprint: print("test_size", test_size)

## -------------------------- data feed finish -----------------------------
Example #3
0
print(__file__.split("/")[-1],"train data:")
print(__file__.split("/")[-1], intrain_all_data1.shape)
print(__file__.split("/")[-1], intrain_all_label.shape)
print(__file__.split("/")[-1], intrain_all_label[0:15])
print(__file__.split("/")[-1],"test data:")
print(__file__.split("/")[-1], intest_all_data1.shape)
print(__file__.split("/")[-1], intest_all_label.shape)
print(__file__.split("/")[-1], intest_all_label[0:15])
train_size = intrain_all_data1.shape[0]
test_size = intest_all_data1.shape[0]
assert(intrain_all_data1.shape[0]>0)
assert(intrain_all_data1.shape[0]==intrain_all_label.shape[0])
assert(intest_all_data1.shape[0]>0)
assert(intest_all_data1.shape[0]==intest_all_label.shape[0])

trainFeed = FeedInput([intrain_all_data1, intrain_all_label],batch_size)
trainFeed.shuffle_all()
testFeed = FeedInput([intest_all_data1, intest_all_label],batch_size)
testFeed.shuffle_all()
num_batches = trainFeed.get_num_batches()
print("num_batches per epoch",num_batches)

## -------------------------- data feed finish -----------------------------


init_lr = get_conf_float(conf,"init_lr")
end_lr = get_conf_float(conf,"end_lr")
nepoch = get_conf_int(conf,"nepoch") 
total_steps = nepoch*num_batches
decay_steps = num_batches/4.0
weight_decay_rate = (end_lr/init_lr)**(decay_steps/total_steps)