jiehou commited on
Commit
224a0e1
·
1 Parent(s): adc2506

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -18,6 +18,25 @@ set_output1 = gr.outputs.Dataframe(type="pandas", label = 'Predicted Labels',max
18
  set_output2 = gr.outputs.Image(label="Confusion Matrix")
19
  set_output3 = gr.outputs.Image(label="ROC curve")
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  def visualize_ROC(set_threshold,set_input):
22
  prob = set_input[:,1]
23
  pred_label = (prob >= set_threshold).astype(int)
 
18
  set_output2 = gr.outputs.Image(label="Confusion Matrix")
19
  set_output3 = gr.outputs.Image(label="ROC curve")
20
 
21
+ def perf_measure(y_actual, y_hat):
22
+ TP = 0
23
+ FP = 0
24
+ TN = 0
25
+ FN = 0
26
+
27
+ for i in range(len(y_hat)):
28
+ if y_actual[i]==y_hat[i]==1:
29
+ TP += 1
30
+ if y_hat[i]==1 and y_actual[i]!=y_hat[i]:
31
+ FP += 1
32
+ if y_actual[i]==y_hat[i]==0:
33
+ TN += 1
34
+ if y_hat[i]==0 and y_actual[i]!=y_hat[i]:
35
+ FN += 1
36
+
37
+ return(TP, FP, TN, FN)
38
+
39
+
40
  def visualize_ROC(set_threshold,set_input):
41
  prob = set_input[:,1]
42
  pred_label = (prob >= set_threshold).astype(int)