Loading Data
import pandas as pd
# Load and drop unwanted index column if present
def load_top100(path):
s = pd.read_csv(path, header=None)[0]
s = s[s != "0"] # ⬅ remove bogus index-row
return s.tolist()
lasso_auc_top100 = load_top100("../results/lasso_auc_top100.csv")
lasso_recall_top100 = load_top100("../results/lasso_recall_top100.csv")
en_auc_top100 = load_top100("../results/elasticnet_auc_top100.csv")
en_recall_top100 = load_top100("../results/elasticnet_recall_top100.csv")
rfe_auc_top100 = load_top100("../results/rfe_auc_top100.csv")
rfe_recall_top100 = load_top100("../results/rfe_recall_top100.csv")
rfecv_auc_top100 = load_top100("../results/rfecv_auc_top100.csv")
rfecv_recall_top100 = load_top100("../results/rfecv_recall_top100.csv")
Building the Master Method Dictionary
methods = {
"Lasso AUC": lasso_auc_top100,
"Lasso Recall": lasso_recall_top100,
"EN AUC": en_auc_top100,
"EN Recall": en_recall_top100,
"RFE AUC": rfe_auc_top100,
"RFE Recall": rfe_recall_top100,
"RCV AUC": rfecv_auc_top100,
"RCV Recall": rfecv_recall_top100,
}
Building the Unified Feature Set
all_feats = sorted(set().union(*methods.values()))
Constructing the Agreement Table
table = pd.DataFrame({"Feature": all_feats})
for m in methods:
table[m] = table["Feature"].apply(lambda f: 1 if f in methods[m] else 0)
Sum of how many methods selected each feature
table["SUM"] = table[list(methods.keys())].sum(axis=1)
Sort by agreement strength
table = table.sort_values("SUM", ascending=False)
Exporting the Table
table.to_csv("../results/feature_agreement_table.csv", index=False)
print("Agreement table saved → ../results/feature_agreement_table.csv")
Agreement table saved → ../results/feature_agreement_table.csv