def run(): with open('models.csv', 'r') as csvfile: reader = csv.reader(csvfile) header = next(reader) # print(header) for row in reader: args = dict(zip(header, row)) model_name = args['model_name'] # print(model_name) if os.path.exists('models/{}/config.json'.format(model_name)): args = load_config('models/{}/config.json'.format(model_name)) else: create_config(args) preprocess(args) organize(args) print("-------- training --------") train(args)
import csv from config import create_config from preprocess import preprocess, organize from keras_train import train with open('models.csv', 'rb') as csvfile: reader = csv.reader(csvfile) header = reader.next() #print header for row in reader: args = dict(zip(header, row)) print args['model_name'] create_config(args) preprocess(args) organize(args) train(args)
if len(sys.argv) > 1: arg = sys.argv[1] if arg == 'ensemble': # too lazy to make a flag current_ensemble() sys.exit(0) else: weights_path = sys.argv[1] else: weights_path = None # load all data sets X_train, y_train, X_val, y_val, X_test = load_data() # fit the model model, history = train(X_train, y_train, X_val, y_val, weights_path) # save results from training loss = np.array(history.history['loss']) acc = np.array(history.history['acc']) top_k = np.array(history.history['top_k_categorical_accuracy']) val_loss = np.array(history.history['val_loss']) val_acc = np.array(history.history['val_acc']) val_top_k = np.array(history.history['val_top_k_categorical_accuracy']) np.savetxt("loss.csv", loss, delimiter=",") np.savetxt("acc.csv", acc, delimiter=",") np.savetxt("top_k.csv", top_k, delimiter=",") np.savetxt("val_loss.csv", val_loss, delimiter=",") np.savetxt("val_acc.csv", val_acc, delimiter=",") np.savetxt("val_top_k.csv", val_top_k, delimiter=",")