-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
52 lines (40 loc) · 1.17 KB
/
main.py
File metadata and controls
52 lines (40 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from helpers import lectura as rd
import algoritmos as alg
import test
import normalizacion as nm
# Primera Parte
datos = rd.leer_archivo("data/german_credit.csv")
datos_normalizados, min_max = nm.normalizacion_min_max(
datos=datos,
guardar=False)
datos_reales, datos_test = test.generar_test(
porcentaje=0.1,
datos=datos_normalizados,
guardar=False)
print("Nuevo Registro".center(50, "-"))
alg.k_nuevo_registro(
datos=datos_reales,
min_max=min_max,
k=1)
# Segunda Parte
conjunto = alg.generar_conjunto(
datos_test=datos_test,
datos_reales=datos_reales,
k=3
)
print("Matriz de confusion".center(50, "-"))
vp, vn, fp, fn = alg.clases(conjunto)
print("Verdaderos Positivos (VP): ", vp)
print("Verdaderos Negativos (VN): ", vn)
print("Falsos Positivos (FP): ", fp)
print("Falsos Negativos (FN): ", fn)
exactitud = alg.exactitud(vp, vn, fp, fn)
print("Exactitud:", exactitud,"")
precision = alg.precision(vp, fp)
print("Precision:", precision)
sensibilidad = alg.sensibilidad(vp, fn)
print("Sensibilidad:", sensibilidad)
tnr = alg.razon_verdaderos_negativos(vn, fp)
print("TNR:", tnr)
fpr = alg.razon_falsos_positivos(fp, vn)
print("FPR:", fpr)