In the evaluate_entity_level_using_knn method in the model/eval.py file, the calculation of True Positives (TP), True Negatives (TN), False Positives (FP), and False Negatives (FN) seems to be incorrect. The current code is as follows:
for i in range(len(y_test)):
if y_test[i] == 1.0 and score[i] >= best_thres:
tn += 1
if y_test[i] == 1.0 and score[i] < best_thres:
fn += 1
if y_test[i] == 0.0 and score[i] < best_thres:
tp += 1
if y_test[i] == 0.0 and score[i] >= best_thres:
fp += 1
In my understanding, the label y_test for malicious entities is 1, and score[i] should be greater than the set threshold. Therefore, the corrected code should be:
for i in range(len(y_test)):
if y_test[i] == 1.0 and score[i] >= best_thres:
tp += 1
if y_test[i] == 1.0 and score[i] < best_thres:
fn += 1
if y_test[i] == 0.0 and score[i] < best_thres:
tn += 1
if y_test[i] == 0.0 and score[i] >= best_thres:
fp += 1
Could you please confirm if my understanding is correct? Thank you.
In the
evaluate_entity_level_using_knn
method in themodel/eval.py
file, the calculation of True Positives (TP), True Negatives (TN), False Positives (FP), and False Negatives (FN) seems to be incorrect. The current code is as follows:In my understanding, the label y_test for malicious entities is 1, and score[i] should be greater than the set threshold. Therefore, the corrected code should be:
Could you please confirm if my understanding is correct? Thank you.