from QSP400 import dataPro as data import numpy as np from keras.models import Sequential from keras.regularizers import l2 from keras.layers import LSTM, Dense, Dropout, Activation, initializers, GRU, SimpleRNN, ConvLSTM2D from keras import optimizers from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestRegressor import matplotlib.pyplot as plt from keras.layers import Conv1D, GlobalAveragePooling1D, MaxPooling1D, BatchNormalization, Activation, Flatten from keras.layers import Conv2D, MaxPooling2D, Embedding, Bidirectional, LeakyReLU from sklearn.metrics import roc_curve, auc import numpy as np # ac,label=data.ac() ac_p, label = data.deal() aac = data.fe() ctd = data.CTD() gaac = data.gaac() X = np.concatenate((aac, gaac, ac_p), axis=1) # X=ac,ctd,kmer # print(X) def calculate_performace(test_num, pred_y, labels): tp = 0 fp = 0 tn = 0 fn = 0 for index in range(test_num): if labels[index] == 1: if labels[index] == pred_y[index]: tp = tp + 1
from QSP400 import dataPro as data import numpy as np from keras import optimizers from keras.models import model_from_yaml import pandas as pd import matplotlib.pyplot as plt from sklearn.metrics import roc_curve, auc aac,label=data.fe() gaac=data.gaac() ac_p,label=data.deal() yaml_string = open('model_arthitecture_2.yaml', 'r') model = model_from_yaml(yaml_string) yaml_string_lstm = open('lstm.yaml', 'r') model_lstm = model_from_yaml(yaml_string_lstm) x_test = np.concatenate(( aac,gaac,ac_p),axis=1) print(x_test.shape) all_labels=[] all_prob = {} all_prob[0] = [] real_labels = [] for val in label: if val == 1: real_labels.append(1) else: real_labels.append(0) train_label_new = [] # global all_labels # global all_prob all_labels = all_labels + real_labels