Closed idf closed 9 years ago
Temporary fix
def evaluate(self, testIdX, predictions, y, threshold):
r = TFPN()
for cls in np.unique(y):
# binary classification
for j in testIdX:
prediction, info = predictions[j]
sims = info['similarities']
score = np.sum(sims)/float(sims.size)
if prediction==cls and score>threshold: # positive
if cls==y[j]:
r.TP += 1
else:
r.FP += 1
else: # negatives # TODO
if cls==y[j]:
r.FN += 1
else:
r.TN += 1
# TODO then take average
# r.rates /= len(np.unique(y))
return r
It is not possible to calculate the true_negatives and false_negatives with the way the predicitions are generated and data is prepared.