parameters = deepMirCut.load_parameters(opts) parameters = load_input_output_file_parameters(parameters,opts) if "ensemble" not in parameters: print("Error: ensemble file is required") exit() if "--ensemble_size" not in opts: print("Error: must enter an --ensemble_size") exit() output_file = "new_ensemble_list.txt" if parameters["output_prefix"]: output_file = parameters["output_prefix"] + "_ensemble_list.txt" num = int(opts["--ensemble_size"]) dataSet = deepMirCut.readDataset(parameters["validation_file"],parameters) new_dataSet = deepMirCut.dropLongSequences(dataSet,parameters) X_test,y_test = deepMirCut.prepareData(new_dataSet,parameters) members = [] for i in range(0,len(parameters["ensemble"])): print("loading model %d: %s\n"%(i, parameters["ensemble"][i])) members.append(load_model(parameters["ensemble"][i], custom_objects={'prox':avg_proximity_metric()})) test_pred = [] macro_f1_scores = [] for i in range(0,len(members)): model = members[i] test_pred.append(model.predict(X_test, verbose=parameters["verbose"])) perf = get_classification_metrics(y_test,test_pred[i],parameters) macro_f1_scores.append(sum([perf[c]["fscore"] for c in ["DR5","DC5","DC3","DR3"]]) / 4) print(i,macro_f1_scores[i])
opts = {} opts['--verbose'] = True opts['--epochs'] = 20 opts['--patience'] = 3 opts['--use_embedding_layer'] = "True" opts['--use_crf_layer'] = "False" opts['--input_setting'] = '1' #USE_SEQ_FOLD dmc_parameters = deepMirCut.load_parameters(opts) dmc_parameters['train_file'] = sys.argv[1] dmc_parameters['validation_file'] = sys.argv[2] dmc_parameters['batch_size'] = 64 print("input_setting=", dmc_parameters['input_setting']) trainSet = deepMirCut.readDataset(dmc_parameters["train_file"], dmc_parameters) new_trainSet = deepMirCut.dropLongSequences(trainSet, dmc_parameters) X_tr, y_tr = deepMirCut.prepareData(new_trainSet, dmc_parameters) validationSet = deepMirCut.readDataset(dmc_parameters["validation_file"], dmc_parameters) new_validationSet = deepMirCut.dropLongSequences(validationSet, dmc_parameters) X_vl, y_vl = deepMirCut.prepareData(new_validationSet, dmc_parameters) while (trial_step < new_evals): run_trials(pickle_file="tuning_adam_seqOnly.pickle", trials_step=trial_step) new_evals -= trial_step run_trials(pickle_file="tuning_adam_seqOnly.pickle", trials_step=new_evals)