Commit eca53f94 authored by Alberto Jiménez's avatar Alberto Jiménez
parents 5bcd9ee5 f6537fba
import os
print("Prediciendo Dropout...\n")
os.system("python dropout/downDB.py")
print("Archivos descargados de BD\n")
os.system("python dropout/get_estudiante.py")
os.system("python dropout/get_historialEstudiante.py")
os.system("python dropout/calcVar.py")
print("Variables de entrada calculadas\n")
os.system("python dropout/finalData.py")
print("Datos finales listos\n")
os.system("python dropout/predict.py")
print("Predicción acabada.")
\ No newline at end of file
import pandas as pd
import time
def main():
file = 'cambioHistorial.csv'
data = pd.read_csv(file)
data['SubState'].replace("PF","RP",inplace = True)
data['SubState'].replace("SA","RP",inplace = True)
data['SubState'].replace("SU","RP",inplace = True)
data['SubState'].replace("IR","RP",inplace = True)
data = data[data.SubState != 'AN']
data = data.drop("promedio",1)
#Calculamos numero de suspensos por estudiante
fail = data[data.SubState == 'RP']
numFail = fail.groupby(['id', 'SubState']).size().to_frame()
numFail.columns = ["Count"]
#Dropout despues de 5 años sin matricularse
years = (data['year']/10).astype(int)
ids = data['id']
data['dropout'] = 0
for i in range(len(years)):
if ids.values[i] == ids.values[i-1]:
if (years.values[i]-years.values[i-1])>=5:
data['dropout'].values[i] = 1
else:
data['dropout'].values[i] = 0
else:
data['dropout'].values[i] = 0
dropid =pd.concat([ids, data['dropout']], axis=1,)
dropid.columns = ['id','dropout']
dropout = dropid.groupby(['id']).dropout.sum().to_frame()
dropout.columns = ['dropout']
ids = dropout.index.values
ids = pd.DataFrame(ids)
#Si lleva mas de los ultimos 5 años sin ir y no se ha graduado
datamax = data.groupby(('id')).year.max().to_frame()
datamax.columns = ['year']
yearmax = (datamax['year']/10).astype(int)
añoActual = int(time.strftime("%Y"))
fileE = 'cambioEstudiante.csv'
df = pd.read_csv(fileE)
dataEstudiante = df.drop("Unnamed: 0",1)
dataEstudiante['stateStudent'].replace("E",1,inplace = True)
dataEstudiante['stateStudent'].replace("G",1,inplace = True)
stateStud = dataEstudiante['stateStudent']
for i in range(len(yearmax)):
if añoActual >= (yearmax.values[i]+5) and stateStud.values[i] != 1:
dropout['dropout'].values[i] = 1
dropout.to_csv("dropout5Years.csv")
#Media ponderada de cada asignatura de cada estudiante
for x in range(len(data)):
if data['tipocredito'].values[x] == "C" and data['notafinal'].values[x] == 0:
data['notafinal'].values[x] = int(6)
data.call = data.call*data.notafinal*data.credMateria
#Años que lleva un estudiante en la universidad
datamax = data.groupby(['id','codDegree']).year.max().to_frame()
datamin = data.groupby(['id','codDegree']).year.min().to_frame()
añosUni = pd.merge(datamax, datamin, how='outer', on=['id','codDegree'])
añosUni.year_x = (añosUni.year_x/10).astype(int)
añosUni.year_y = (añosUni.year_y/10).astype(int)
añosUni.year_x = añosUni.year_x - añosUni.year_y + 1
añosUni = añosUni.drop("year_y",1)
#Empezamos a calcular la media
dataS = data[data.SubState == 'AP']
#Creditos aprobados / cursados
credCursados = data.groupby(['id','codDegree']).credMateria.sum().to_frame()#creditos cursados
#Numero de creditos aprobados por carrera y estudiante
credAprob = dataS.groupby(['id','codDegree']).credMateria.sum().to_frame()#creditos aprobados
credAprob = credAprob[credAprob.credMateria != 0]
aprobCursados = credAprob / credCursados
#Nota media total a falta de dividir por el numero de creditos
notPond = dataS.groupby(['id','codDegree']).call.sum().to_frame()#Suma de las notas poderadas
notPond = notPond[notPond.call != 0]
#Dividimos media ponderada y creditos cursados
dataMedia = pd.merge(credAprob, notPond, how='outer', on=['id','codDegree'])
dataMedia.credMateria = dataMedia.call / dataMedia.credMateria
dataMedia = dataMedia.drop("call",1)
#Numero de años sin matricularse
ultMat = data.groupby(['id','codDegree']).year.max().to_frame()
ultMat = (ultMat/10).astype(int)
añoActual = int(time.strftime("%Y"))
ultMat.year = añoActual - 1 - ultMat.year.values
dataMedia = pd.merge(dataMedia, ultMat,how = 'outer', on = ['id','codDegree'])
namesTot = ["gradeMean","ultMatricula"]
dataMedia.columns = namesTot
dataMedia.to_csv("varHistCredMedia.csv")#Media de todos los estudiantes
#Numero de creditos aprobados
data2 = pd.merge(credAprob, añosUni, how='outer', on=['id','codDegree'])
data2 = pd.merge(data2, aprobCursados, how='outer', on=['id','codDegree'])
data2.fillna(0)
data2.to_csv("credPassYear.csv")#creditos totales aprobados
data = data.drop("Unnamed: 0",1)
names = ["CodSubject","SubState","gradeTot","year","codDegree","grade1","grade2","mejoramiento","notafinal","credits","credType","id","dropout"]
data.columns = names
data['id'] = (data['id']).astype(int)
data = pd.merge(data, numFail, how='outer', on=['id','SubState'])
data['Count'] = data['Count'].fillna(0)
data = data[data.SubState != 'RP']
if __name__ == "__main__":
main()
\ No newline at end of file
import psycopg2, psycopg2.extras
import pandas as pd
import numpy as np
conn = psycopg2.connect(database='lala_uc3m',user='lala_usr',password='0t3H@hG&', host='200.10.150.52')
cur = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
print("Bajando datos de estudiantes")
cur.execute("SELECT * FROM dim_estudiante ORDER BY id")
data =cur.fetchall();
df = pd.DataFrame(np.array(data), columns = data[0].keys())
df.to_csv('dim_estudiante.csv')
print("Bajando historiales de estudiantes")
cur.execute("SELECT * FROM dim_historial_estudiante ORDER BY id")
data =cur.fetchall();
df = pd.DataFrame(np.array(data), columns = data[0].keys())
df.to_csv('dim_historial_estudiante.csv')
\ No newline at end of file
import pandas as pd
def main():
file = 'varHistCredMedia.csv'
dataMedia = pd.read_csv(file)
fileE = 'cambioEstudiante.csv'
df = pd.read_csv(fileE)
dataEstudiante = df.drop("Unnamed: 0",1)
fileC = 'credPassYear.csv'
dataCredCurs = pd.read_csv(fileC)
data = pd.merge(dataEstudiante, dataMedia, how='outer', on=['id','codDegree'])
data = pd.merge(data, dataCredCurs, how='outer', on=['id','codDegree'])
names = ["civil","work","city","sex","degree","totCredits","stateStudent","id","media","aniosUltMat","credDone","years","ratePass"]
data.columns = names
data.totCredits = data.credDone/data.totCredits
data['totCredits'].fillna(0,inplace = True)
data['stateStudent'].replace("E",1,inplace = True)
data['stateStudent'].replace("G",1,inplace = True)
data['stateStudent'].replace("I",0,inplace = True)
data['stateStudent'].replace("P",0,inplace = True)
data['stateStudent'].replace("S",0,inplace = True)
data['stateStudent'].replace("R","",inplace = True)
#Ponemos el dropout de los 5 años sin acudir a clase
dropout = 'dropout5Years.csv'
dropout = pd.read_csv(dropout)
data = pd.merge(data, dropout, how='outer', on=['id'])
for i in range(len(data)):
if data.dropout.values[i] >= 1 :
data.stateStudent.values[i] = 0
data.drop("dropout",1,inplace=True)
#Porcentaje de suspensos de cada carrera
dataTot = data.groupby(('degree')).id.count()
dataTot = dataTot.to_frame()
dataFail = data[data.stateStudent == 0]
dataFail = dataFail.groupby(('degree')).id.count()
dataFail = dataFail.to_frame()
dataPass = data[data.stateStudent == 1]
dataPass = dataPass.groupby(('degree')).id.count()
dataPass = dataPass.to_frame()
dataRate = pd.merge(dataTot, dataPass, how='outer', on=['degree'])
dataRate = pd.merge(dataRate, dataFail, how='outer', on=['degree'])
dataRate.fillna(0,inplace = True)
dataRate.columns = ['tot','Pass','fail']
#No se tiene en cuenta el número de estudiantes que están cursando ahora para el total de los alumnos
suma = dataRate.fail/(dataRate.fail+dataRate.Pass)
suma = suma.to_frame()
suma.fillna(0,inplace = True)
suma = suma.reset_index()
suma.columns = ['degree','abandonmentRate']
data = pd.merge(data, suma, how='outer', on=['degree'])
data = data.drop_duplicates()
data = data[data["degree"]!=0]
data = data[["id","degree","civil","work","city","sex","totCredits","media","aniosUltMat","credDone","years","ratePass","abandonmentRate","stateStudent"]]
data.drop("credDone",1,inplace=True)
data.years = data.years/5
data = data.sort_values(by='id', ascending=True)
data.to_csv("Final.csv")
if __name__ == "__main__":
main()
\ No newline at end of file
import pandas as pd
def main():
file = 'dim_estudiante.csv'
df = pd.read_csv(file)
df.drop("id",1,inplace=True)
df['uuid'] = range(1,len(df)+1)
df = df.drop("paisnacimiento",1).drop("provincianacimiento",1).drop("ciudadnacimiento",1).drop("colegio",1).drop("paisresidencia",1).drop("provinciaresidencia",1).drop("idcarreraactual",1).drop("nombrecarreraactual",1).drop("promediopreuniversitario",1)
df = df.drop("Unnamed: 0",1).drop("facultadcarreraactual",1).drop("tipocolegio",1).drop("gms",1)
df['estadocivil'].replace("CASADO",int(1),inplace = True)
df['estadocivil'].replace("UNION LIBRE",int(1),inplace = True)
df['estadocivil'].replace("SOLTERO",int(0),inplace = True)
df['estadocivil'].replace("VIUDO/A",int(0),inplace = True)
for x in range(len(df)):
if df['codigocarreracarreraactual'].values[x]== "LINUT":
df['creditostotalcarreraactual'] = int(240)
df['trabaja'].replace("SI",int(1),inplace = True)
for x in range(len(df)):
if df['trabaja'].values[x] != 1:
df['trabaja'].values[x] = int(0)
df['ciudadresidencia'].replace("GUAYAQUIL",int(1),inplace = True)
df['ciudadresidencia'].replace("",int(1),inplace = True)
df['ciudadresidencia'].fillna(0)
for x in range(len(df)):
if df['ciudadresidencia'].values[x] != 1:
df['ciudadresidencia'].values[x] = int(0)
df['sexo'].replace("MASCULINO",int(1),inplace = True)
for x in range(len(df)):
if df['sexo'].values[x] != 1:
df['sexo'].values[x] = int(0)
names = ["civil","work","city","sex","codDegree","totCredits","stateStudent","id"]
df.columns = names
df.to_csv("cambioEstudiante.csv")
if __name__ == "__main__":
main()
\ No newline at end of file
import pandas as pd
def main():
file = 'dim_historial_estudiante.csv'
df = pd.read_csv(file)
df['codigomateriatomada'] = df['codigomateriatomada'].fillna(0)
df.drop("Unnamed: 0",1,inplace = True)
df.drop("id",1,inplace = True)
df['identificador'] = 0
ide = 1
for x in range(len(df)):
if df['codigomateriatomada'].values[x] != 0:
df['identificador'].values[x] = ide
else:
ide = ide + 1
df = df[df.codigomateriatomada != 0]
df = df.drop("nombremateriatomada",1).drop("paralelo",1).drop("tipoformacion",1)
df = df.fillna(0)
for x in range(len(df)):
if df['termino'].values[x] == "1S":
df['anio'].values[x] = int(df['anio'].values[x]*10+1)
else:
df['anio'].values[x]=int(df['anio'].values[x]*10+2)
df['veztomada'].replace(2,float(0.85),inplace = True)
df['veztomada'].replace(3,float(0.75),inplace = True)
df['veztomada'].replace(4,float(0.65),inplace = True)
df['veztomada'].replace(5,float(0.55),inplace = True)
df['veztomada'].replace(6,float(0.55),inplace = True)
df['veztomada'].replace(7,float(0.55),inplace = True)
names = ["CodSubject","SubState","call","year","semester","codDegree","grade1","grade2","mejoramiento","promedio","notafinal","credMateria","tipocredito","id"]
df.columns = names
df = df.drop("semester",1)
df.to_csv("cambioHistorial.csv")
if __name__ == "__main__":
main()
\ No newline at end of file
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn import preprocessing
from sklearn.model_selection import GridSearchCV
from sqlalchemy import create_engine
file = 'Final.csv'
data = pd.read_csv(file)
data.drop("Unnamed: 0",1,inplace=True)
data['stateStudent'] = data['stateStudent'].str.strip()
data['stateStudent'].fillna(2,inplace = True)
data['stateStudent'].replace("",2,inplace = True)
dataPred = data.fillna(0)
dataTrain = dataPred[dataPred.stateStudent != 2]
dataTrain.stateStudent = dataTrain.stateStudent.astype(int)
dataTrain1 = dataTrain.drop("degree",1)
dataTrain = dataTrain1.drop("id",1)
dataF = dataPred[dataPred.stateStudent == 2]
dataTest = dataPred[dataPred.stateStudent == 2]
dataTest['stateStudent'].replace(2,"",inplace = True)
dataTest = dataTest.drop("id",1).drop("degree",1)
x_train = dataTrain.values[:,[0,1,2,3,5,6,8,9]]
y_train = dataTrain.values[:,10]
x_test1 = dataTest.values[:,[0,1,2,3,5,6,8,9]]
y_test = dataTest.values[:,10]
robust_scaler = preprocessing.StandardScaler()
x_train = robust_scaler.fit_transform(x_train)
x_test = robust_scaler.fit_transform(x_test1)
cfr = RandomForestClassifier()
# Create the parameter grid based on the results of random search
param_grid = {
'max_depth': range(3,20,1),
'max_features': ['auto'],
'min_samples_leaf': range(1,20,1),
'min_samples_split': range(3,20,1),
'n_estimators': range(300,600,25)
}
# Instantiate the grid search model
grid_search = GridSearchCV(estimator = cfr, param_grid = param_grid,
cv = 10, n_jobs = -1, verbose = 2)
# Fit the grid search to the data
grid_search.fit(x_train, y_train)
print("\n")
print(grid_search.best_params_)
print("\n")
#cfr2 = RandomForestClassifier(bootstrap = True, max_depth = 14, max_features='auto',min_samples_leaf=2,min_samples_split=8,n_estimators=475)
#y_pred = cfr2.fit(x_train, y_train).predict_proba(x_test)
#y_pr2 = cfr2.fit(x_train, y_train).predict(x_test)
y_pred = grid_search.fit(x_train, y_train).predict_proba(x_test)
y_pr2 = grid_search.fit(x_train, y_train).predict(x_test)
x_pr1 = pd.DataFrame(x_test1)
y_pred2 = pd.DataFrame(y_pr2)
df = pd.DataFrame(y_pred[:,0])
dataF = dataF.reset_index(drop=True)
dataF.drop("stateStudent",1,inplace=True)
df = pd.concat([dataF.id,y_pred2, df], axis=1)
df.columns = ['ID','CLAS','stateStudent']
df = df.drop("CLAS",1)
dataFin = pd.DataFrame(dataTrain1.values[:,[0,11]])
dataFin.columns = ['ID','stateStudent']
finalData = pd.concat([dataFin, df],axis = 0)
finalData = finalData.sort_values(by='ID', ascending=True)
finalData = finalData.drop("ID",1)
#Subimos resultados a la base de datos
print("Subiendo probabilidad de abandono")
engine = create_engine('postgresql://lala_usr:0t3H@hG&@200.10.150.52:5432/lala_uc3m')
finalData.to_sql('dim_estudiante_dropout', engine,if_exists = 'replace', index=False)
import numpy as np
import csv
import pandas as pd
import string
from sklearn import model_selection
from sklearn.tree import DecisionTreeRegressor
from sklearn.tree import DecisionTreeClassifier
from sklearn import preprocessing
import matplotlib.pyplot as plt
from sklearn import metrics
def main():
file = 'Final.csv'
data = pd.read_csv(file)
dataPred = data.drop("id",1).drop("degree",1).drop("Unnamed: 0",1)
dataPred['stateStudent'] = dataPred['stateStudent'].str.strip()
dataPred['stateStudent'].fillna(2,inplace = True)
dataPred['stateStudent'].replace("",2,inplace = True)
dataPred = dataPred.fillna(0)
dataTrain = dataPred[dataPred.stateStudent != 2]
dataTrain.stateStudent = dataTrain.stateStudent.astype(int)
dataTest = dataPred[dataPred.stateStudent == 2]
dataTest['stateStudent'].replace(2,"",inplace = True)
x_train = dataTrain.values[:,[0,1,2,3,4,5,6,7,8,9]]
y_train = dataTrain.values[:,10]
x_test = dataTest.values[:,[0,1,2,3,4,5,6,7,8,9]]
y_test = dataTest.values[:,10]
robust_scaler = preprocessing.StandardScaler()
x_train = robust_scaler.fit_transform(x_train)
print("Starting cross-validation (" + str(len(x_train)) + ' learners)')
cfr2 = DecisionTreeClassifier()
kf = model_selection.KFold(n_splits=10)
cv = kf.split(x_train)
results = []
res_ce = []
A_A = 0
A_S = 0
S_A = 0
S_S = 0
y_pred_list = list()
y_true_list = list()
y_true2_list = list()
for traincv, testcv in cv:
y_pred = cfr2.fit(x_train[traincv], y_train[traincv]).predict_proba(x_train[testcv])
y_pr2 = cfr2.fit(x_train[traincv], y_train[traincv]).predict(x_train[testcv])
res_ce.append(np.mean(np.abs(y_pr2 - y_train[testcv])))
y_pr1 = pd.DataFrame(y_train[testcv])
x_pr1 = pd.DataFrame(x_train[testcv])
y_pred2 = pd.DataFrame(y_pr2)
df = pd.DataFrame(y_pred[:,1] )
df = pd.concat([y_pr1,y_pred2, df], axis=1,)
# Store results for AUC
for i, v in enumerate(y_pred[:,1]):
y_pred_list.append(v)
y_true_list.append(y_train[testcv][i])
y_true2_list.append(y_train[testcv][i])
# Certificate earners
for i, val in enumerate(y_pr2):
if y_pr2[i] == 1 and y_train[testcv][i] == 1:
A_A += 1
if y_pr2[i] == 0 and y_train[testcv][i] == 1:
A_S += 1
if y_pr2[i] == 1 and y_train[testcv][i] == 0:
S_A += 1
if y_pr2[i] == 0 and y_train[testcv][i] == 0:
S_S += 1
#print out the mean of the cross-validated results
#RMSE = np.array(results).mean()
#print("RMSE: " + str( RMSE))
accuracy = (A_A+S_S)/((A_A+A_S+S_A+S_S)*1.0)
print("Results CE: " + str(1-np.array(res_ce).mean()) + " / " + str(accuracy))
# Results about certificate earners
print(str(A_A) + "\t" + str(A_S))
print(str(S_A) + "\t" + str(S_S))
TP = A_A
FP = A_S
FN = S_A
TN = S_S
try:
recall = TP / ((TP+FN)*1.0);
except:
recall = 0
try:
precision = TP / ((TP+FP)*1.0);
except:
precision = 0
try:
specificity = TN / ((TN+FP)*1.0)
except:
specificicty = 0
try:
NPV = TN / ((FN+TN)*1.0);
except:
NPV = 0
try:
F_score = (2*TP)/((2*TP+FP+FN)*1.0)
except:
F_score = 0
print('Recall: ' + str(recall))
print('Precision: ' + str(precision))
print('Specificity: ' + str(specificity))
print('NVP:' + str(NPV))
print('F-score: ' + str(F_score))
# Compute AUC
y = np.array(y_true_list)
pred = np.array(y_pred_list)
y_true = np.array(y_true2_list)
fpr, tpr, thresholds = metrics.roc_curve(y, pred)
AUC = metrics.auc(fpr, tpr)
RMSEsk = np.sqrt(metrics.mean_squared_error(y_true, pred))
MAE = metrics.mean_absolute_error(y_true, pred)
print('AUC: ' + str(AUC))
plt.figure()
lw = 2
plt.plot(fpr, tpr, color='darkorange',
lw=lw, label='ROC curve (area = %0.2f)' % metrics.auc(fpr, tpr))
plt.plot([0, 1], [0, 1], color='navy', lw=lw, linestyle='--')
plt.xlim([0.0, 1.0])
plt.ylim([0.0, 1.05])
plt.xlabel('False Positive Rate')
plt.ylabel('True Positive Rate')
plt.title('Receiver operating characteristic example')
plt.legend(loc="lower right")
plt.show()
results = dict()
results['RMSE'] = RMSEsk
results['MAE'] = MAE
results['AUC'] = AUC
results['F1'] = F_score
results['recall'] = recall
results['precision'] = precision
results['accuracy'] = accuracy
print(results)
if __name__ == "__main__":
main()
\ No newline at end of file
import numpy as np
import csv
import pandas as pd
import string
from sklearn import model_selection
from sklearn.ensemble import GradientBoostingClassifier
from sklearn import preprocessing
import matplotlib.pyplot as plt
from sklearn import metrics
def main():
file = 'Final.csv'
data = pd.read_csv(file)
dataPred = data.drop("id",1).drop("degree",1).drop("Unnamed: 0",1)
dataPred['stateStudent'] = dataPred['stateStudent'].str.strip()
dataPred['stateStudent'].fillna(2,inplace = True)
dataPred['stateStudent'].replace("",2,inplace = True)
dataPred = dataPred.fillna(0)
dataTrain = dataPred[dataPred.stateStudent != 2]
dataTrain.stateStudent = dataTrain.stateStudent.astype(int)
dataTest = dataPred[dataPred.stateStudent == 2]
dataTest['stateStudent'].replace(2,"",inplace = True)
x_train = dataTrain.values[:,[0,1,2,3,4,5,6,7,8,9]]
y_train = dataTrain.values[:,10]
x_test = dataTest.values[:,[0,1,2,3,4,5,6,7,8,9]]
y_test = dataTest.values[:,10]
robust_scaler = preprocessing.StandardScaler()
x_train = robust_scaler.fit_transform(x_train)
print("Starting cross-validation (" + str(len(x_train)) + ' learners)')
cfr2 = GradientBoostingClassifier()
kf = model_selection.KFold(n_splits=10)
cv = kf.split(x_train)
results = []
res_ce = []
A_A = 0
A_S = 0
S_A = 0
S_S = 0
y_pred_list = list()
y_true_list = list()
y_true2_list = list()
for traincv, testcv in cv:
y_pred = cfr2.fit(x_train[traincv], y_train[traincv]).predict_proba(x_train[testcv])
y_pr2 = cfr2.fit(x_train[traincv], y_train[traincv]).predict(x_train[testcv])
res_ce.append(np.mean(np.abs(y_pr2 - y_train[testcv])))
y_pr1 = pd.DataFrame(y_train[testcv])
x_pr1 = pd.DataFrame(x_train[testcv])
y_pred2 = pd.DataFrame(y_pr2)
df = pd.DataFrame(y_pred[:,1] )
df = pd.concat([y_pr1,y_pred2, df], axis=1,)
# Store results for AUC
for i, v in enumerate(y_pred[:,1]):
y_pred_list.append(v)
y_true_list.append(y_train[testcv][i])
y_true2_list.append(y_train[testcv][i])
# Certificate earners
for i, val in enumerate(y_pr2):
if y_pr2[i] == 1 and y_train[testcv][i] == 1:
A_A += 1
if y_pr2[i] == 0 and y_train[testcv][i] == 1:
A_S += 1
if y_pr2[i] == 1 and y_train[testcv][i] == 0:
S_A += 1
if y_pr2[i] == 0 and y_train[testcv][i] == 0:
S_S += 1
#print out the mean of the cross-validated results
#RMSE = np.array(results).mean()
#print("RMSE: " + str( RMSE))
accuracy = (A_A+S_S)/((A_A+A_S+S_A+S_S)*1.0)
print("Results CE: " + str(1-np.array(res_ce).mean()) + " / " + str(accuracy))
# Results about certificate earners
print(str(A_A) + "\t" + str(A_S))
print(str(S_A) + "\t" + str(S_S))
TP = A_A
FP = A_S
FN = S_A
TN = S_S