MCPcopy Create free account
hub / github.com/Depth2World/VLADBench / weighted_row_sum

Function weighted_row_sum

evaluate_utils.py:8–18  ·  view source on GitHub ↗
(data, third_rows, weight_col=1, start_col=2)

Source from the content-addressed store, hash-verified

6
7
8def weighted_row_sum(data, third_rows, weight_col=1, start_col=2):
9
10 data = np.array(data)
11 m,n = data.shape
12 rows = slice(m-third_rows, m)
13 cols = slice(start_col, None)
14 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))
15 weighted_sum = ['Mean',np.sum(data[rows, weight_col].astype(float))] + weighted_sum.tolist()
16 temp = data.tolist()
17 temp.append(weighted_sum)
18 return temp
19
20
21

Callers 1

evaluate_vlm.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected