(l, idxes=None)
| 30 | |
| 31 | |
| 32 | def acc(l, idxes=None): |
| 33 | if idxes is None: |
| 34 | idxes = [_ for _ in range(len(l))] |
| 35 | c = 0 |
| 36 | for idx in idxes: |
| 37 | if l[idx]: |
| 38 | c += 1 |
| 39 | return float(c) / len(idxes) |
| 40 | |
| 41 | |
| 42 | # the input is a tuple of gold_dict, model prediction and whether to use cache |