Spaces:
Runtime error
Runtime error
gorkaartola
commited on
Commit
•
fa334e3
1
Parent(s):
a325fea
Update metric_for_tp_fp_samples.py
Browse files
metric_for_tp_fp_samples.py
CHANGED
@@ -97,8 +97,7 @@ class metric_tp_fp_Datasets(evaluate.Metric):
|
|
97 |
elif prediction_strategy[0] == "threshold":
|
98 |
results = self.threshold(logits, prediction_strategy[1])
|
99 |
elif prediction_strategy[0] == "topk":
|
100 |
-
results = self.topk(logits, prediction_strategy[1])
|
101 |
-
print(results)
|
102 |
return results
|
103 |
#Prediction strategy functions______________________________________________
|
104 |
def argmax_max(self, logits):
|
@@ -218,6 +217,7 @@ class metric_tp_fp_Datasets(evaluate.Metric):
|
|
218 |
"coincidence count": samples,
|
219 |
})
|
220 |
for i, j in zip(predicted_labels, references):
|
|
|
221 |
if j[1] == 0:
|
222 |
TP_data.loc[TP_data["class"] == j[0], "number of samples"] += 1
|
223 |
if len(i) >> 0:
|
@@ -227,6 +227,7 @@ class metric_tp_fp_Datasets(evaluate.Metric):
|
|
227 |
else:
|
228 |
if FPifWrong:
|
229 |
for k in i:
|
|
|
230 |
FP_data.loc[FP_data["class"] == k, "coincidence count"] += 1
|
231 |
FP_data = FP_data.sort_values(by=["class"], ignore_index = True)
|
232 |
if j[1] == 2:
|
|
|
97 |
elif prediction_strategy[0] == "threshold":
|
98 |
results = self.threshold(logits, prediction_strategy[1])
|
99 |
elif prediction_strategy[0] == "topk":
|
100 |
+
results = self.topk(logits, prediction_strategy[1])
|
|
|
101 |
return results
|
102 |
#Prediction strategy functions______________________________________________
|
103 |
def argmax_max(self, logits):
|
|
|
217 |
"coincidence count": samples,
|
218 |
})
|
219 |
for i, j in zip(predicted_labels, references):
|
220 |
+
#print(i)
|
221 |
if j[1] == 0:
|
222 |
TP_data.loc[TP_data["class"] == j[0], "number of samples"] += 1
|
223 |
if len(i) >> 0:
|
|
|
227 |
else:
|
228 |
if FPifWrong:
|
229 |
for k in i:
|
230 |
+
print(k)
|
231 |
FP_data.loc[FP_data["class"] == k, "coincidence count"] += 1
|
232 |
FP_data = FP_data.sort_values(by=["class"], ignore_index = True)
|
233 |
if j[1] == 2:
|