Spaces:
Runtime error
Runtime error
Commit
•
ee7ea35
1
Parent(s):
609797f
Update metric_for_tp_fp_samples.py
Browse files
metric_for_tp_fp_samples.py
CHANGED
@@ -168,6 +168,10 @@ class metric_tp_fp_Datasets(evaluate.Metric):
|
|
168 |
r = label_true_positives/label_true_samples
|
169 |
p = label_true_positives/(label_true_positives+label_false_positives)
|
170 |
f1 = 2*r*p/(r+p)
|
|
|
|
|
|
|
|
|
171 |
acc = (label_true_positives+(label_false_samples-label_false_positives))/(label_true_samples+label_false_samples)
|
172 |
|
173 |
results.loc[results["class"] == label, "N# of True samples"] = label_true_samples
|
|
|
168 |
r = label_true_positives/label_true_samples
|
169 |
p = label_true_positives/(label_true_positives+label_false_positives)
|
170 |
f1 = 2*r*p/(r+p)
|
171 |
+
if label_false_samples >> 0:
|
172 |
+
label_true_negatives = label_false_samples-label_false_positives
|
173 |
+
else:
|
174 |
+
label_true_negatives = 0
|
175 |
acc = (label_true_positives+(label_false_samples-label_false_positives))/(label_true_samples+label_false_samples)
|
176 |
|
177 |
results.loc[results["class"] == label, "N# of True samples"] = label_true_samples
|