Skip to main content
. 2025 Aug 19;18(8):1224. doi: 10.3390/ph18081224
Algorithm A2 Recommended Model Evaluation Algorithm
 1:  Begin
 2:  Initialize precision_list, recall_list, f1_list, hit_list as empty lists
 3:  tested ← 0
 4:  for each combination in combo_data do
 5:    if size of combination < 3 then
 6:      Skip the combination
 7:    end if
 8:    Randomly select 2 drugs from combination as known_drugs
 9:    true_drugs ← remaining drugs from combination
10:    recommended ← GreedyDrugRecommendation(known_drugs, combo_freq_dict, risk_dict, drug_gene_map, top_k)
11:   recommended_set ← set of recommended drugs
12:   true_positives ← recommended_set ∩ true_drugs
13:   precision ← |true_positives|/top_k
14: recall ← |true_positives|/|true_drugs|
15:   if precision + recall > 0 then
16:      f1 ← 2 × precision × recall/(precision + recall)
17:   else
18:      f1 ← 0
19:   end if
20:   hit ← 1 if true_positives not empty else 0
21:   Append precision, recall, f1, hit to respective lists
22:   tested ← tested + 1
23:   if tested ≥ sample_size then
24:      Break
25:   end if
26:  end for
27: Calculate mean(precision_list), mean(recall_list), mean(f1_list), mean(hit_list)
28: Output EvaluationMetrics as (mean precision, mean recall, mean f1, mean hit)
29: End