def train(): user = { 'l1': NN.nodes_in_input_layer, 'l2': NN.nodes_in_hidden_layer, 'l3': NN.nodes_in_output_layer, 'akurasi': NN.accuration() } user['exist'] = os.path.isfile("./NN/mnist_train.csv") return render_template('training.html', title='Training', info=user)
def hello(): user = { 'l1': NN.nodes_in_input_layer, 'l2': NN.nodes_in_hidden_layer, 'l3': NN.nodes_in_output_layer, 'akurasi': NN.accuration() } user['file'] = filter(None, [ v if v.split('.').pop() in allowed_file else "" for v in os.listdir("static/clean") ]) return render_template('home.html', title='Home', info=user)
import sys import numpy def progress(count, total, status=''): bar_len = 60 filled_len = int(round(bar_len * count / float(total))) percents = round(100.0 * count / float(total), 1) bar = '=' * filled_len + '-' * (bar_len - filled_len) sys.stdout.write('\r[%s] %s%s %s\r' % (bar, percents, '%', status)) sys.stdout.flush() print "Akurasi sekarang : " + str(NN.accuration()) + "%" #train this shit out epoch = int(raw_input("How much epoch? ")) data_file = open("./NN/mnist_train.csv", 'r') data_list = data_file.readlines() data_file.close() random.shuffle(data_list) for a in range(epoch): counter = 0 for line in data_list: #if counter >= 100: # break progress(counter, len(data_list), status=' Iter ' + str(a) + '/' + str(epoch - 1)) #split by the comma