(data, weight_col=1, start_col=2)
| 20 | |
| 21 | |
| 22 | def weighted_total(data, weight_col=1, start_col=2): |
| 23 | data = np.array(data) |
| 24 | m,n = data.shape |
| 25 | rows = slice(0, m) |
| 26 | cols = slice(start_col, None) |
| 27 | weighted_sum = np.sum(data[rows, cols].astype(float) * data[rows, weight_col].astype(float)[:, np.newaxis], axis=0) / np.sum(data[rows, weight_col].astype(float)) |
| 28 | weighted_sum = ['Total',np.sum(data[rows, weight_col].astype(float))] + weighted_sum.tolist() |
| 29 | return weighted_sum |
| 30 | |
| 31 | |
| 32 | def box_iou(boxA, boxB): |