Example #1
0
 def test_result(self,data):
     mat=self.get_ConfusionMat(data)
     print(" ")
     print("-------- Confusion_matrix ---------_")
     print(" ")
     print(np.matrix(mat))
     hp.get_result(mat)
Example #2
0
File: app.py Project: GIR0/web_app
def predict(id):
    if request.method == 'POST':
        return redirect('/')
    else:
        try:
            result, pred = get_result(id)
            return render_template('predict.html', result=result, pred=pred)
        except:
            return redirect('/invalid_id')
"""
    TP: correct prediction in the positive classes
    TN: correct prediction in the negative classes
    FP: the number of over-predictions in the signal peptide class
    FN: the number of under-predictions in the signal peptide class
"""

X_p = readdata('./dataset/test_SP.fasta_out', LENGTH, 'test')
X_n_1 = readdata('./dataset/test_TM.fasta_out', LENGTH, 'test')
X_n_2 = readdata('./dataset/test_NC.fasta_out', LENGTH, 'test')

p_pred = model.predict(X_p)
n_1_pred = model.predict(X_n_1)
n_2_pred = model.predict(X_n_2)

S_S, S_N = get_result(p_pred, 0)
N_S_1, N_N_1 = get_result(n_1_pred, 1)
N_S_2, N_N_2 = get_result(n_2_pred, 2)

TP = S_S
TN = N_N_1 + N_N_2
FP = N_S_1 + N_S_2
FN = S_N

print()
print('TP:', TP, 'TN:', TN, 'FP:', FP, 'FN:', FN)
print('S: ', S_S, S_N)
print('T: ', N_S_1, N_N_1)
print('N: ', N_S_2, N_N_2)

divv = TP * TN - FP * FN