MCPcopy Create free account
hub / github.com/HKUDS/DCCF / getLabel

Function getLabel

utility/batch_test.py:4–12  ·  view source on GitHub ↗
(test_data, pred_data)

Source from the content-addressed store, hash-verified

2import numpy as np
3
4def getLabel(test_data, pred_data):
5 r = []
6 for i in range(len(test_data)):
7 groundTrue = test_data[i]
8 predictTopK = pred_data[i]
9 pred = list(map(lambda x: x in groundTrue, predictTopK))
10 pred = np.array(pred).astype("float")
11 r.append(pred)
12 return np.array(r).astype('float')
13
14
15def Recall_ATk(test_data, r, k):

Callers 1

test_one_batchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected