# validation_data=[VALIDATION_SIZE,600] # one-step feed-forward training # train_x, train_y = mnist.train.next_batch(batch_size) # elm.feed(train_data, train_labels) # print('train end') for i in range(num): train_data, train_labels = extractData_oned_train_val.extract_data_oned( numRows=NUM_ROWS, numData=TRAIN_SIZE, drivers=DRIVERS, labels=LABELS, mode='train', DATA_SIZE=DATA_SIZE, NUM_CHANNELS=NUM_CHANNELS, ONED=True, BASE=BASE) elm.feed(train_data, train_labels) print('train end') # testing elm.test(validation_data, validation_labels) file = open('sensor4_1_elm.txt', 'a') file.write(str(num * TRAIN_SIZE)) file.write(',') file.write(str(elm.test(validation_data, validation_labels))) file.write('\n') file.close() print TRAIN_SIZE
from model import ELM import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # Basic tf setting tf.set_random_seed(2016) sess = tf.Session() # Get data mnist = input_data.read_data_sets("/tmp/data/", one_hot=True) # Construct ELM batch_size = 50000 hidden_num = 50000 print("batch_size : {}".format(batch_size)) print("hidden_num : {}".format(hidden_num)) elm = ELM(sess, batch_size, 784, hidden_num, 10) # one-step feed-forward training train_x, train_y = mnist.train.next_batch(batch_size) elm.feed(train_x, train_y) # testing elm.test(mnist.test.images, mnist.test.labels)
# validation_data=[VALIDATION_SIZE,600] # one-step feed-forward training # train_x, train_y = mnist.train.next_batch(batch_size) # elm.feed(train_data, train_labels) # print('train end') for i in range(num): train_data, train_labels = extractData_oned_train_val.extract_data_oned( numRows=NUM_ROWS, numData=TRAIN_SIZE, drivers=DRIVERS, labels=LABELS, mode='train', DATA_SIZE=DATA_SIZE, NUM_CHANNELS=NUM_CHANNELS, ONED=True, BASE=BASE) elm.feed(train_data, train_labels) print('train end') # testing result = elm.test(validation_data, validation_labels) file = open('sensor10_elm.txt', 'a') file.write(str(num * TRAIN_SIZE)) file.write(',') file.write(str(result)) file.write('\n') file.close() print TRAIN_SIZE