R/discriminative_features.R
select_discriminative_features.RdRanks features by a composite score that rewards within-cohort discrimination (outcome AUC) while penalising features that separate cohorts (batch confounding) or have inconsistent performance across cohorts (AUC variance).
select_discriminative_features(
x_list,
y_list,
n_features = 50L,
lambda_cohort = 1,
lambda_sd = 1,
min_auc = 0.6,
assay = NULL
)A matrix-like object, SummarizedExperiment, or list of such
objects. Rows represent samples and columns represent features.
A binary response aligned with x_list. Must be a factor with
levels c("No", "Yes"). Provide a list when x_list is a list.
Maximum number of features to return (default 50).
Penalty weight for cohort discrimination (default 1.0).
Higher values more aggressively penalise features that separate cohorts.
Penalty weight for cross-cohort AUC variability (default
1.0). Higher values favour features with consistent AUC across cohorts.
Minimum mean within-cohort AUC required (default 0.6).
Features below this threshold are excluded before ranking.
For SummarizedExperiment inputs, the assay name or index to
extract prior to analysis.
A list with components:
Character vector of selected feature names.
Data frame with per-feature scoring metadata: feature,
mean_auc, sd_auc, min_auc, cohort_disc, score.
Matrix of within-cohort AUC values (features x cohorts).
List of parameter values used.
The composite score for feature \(j\) is: $$score_j = \bar{AUC}_j - \lambda_1 \cdot cohort\_disc_j - \lambda_2 \cdot sd(AUC_j)$$
where \(\bar{AUC}_j\) is the mean within-cohort AUC, \(cohort\_disc_j\) measures how well feature \(j\) separates cohorts (irrespective of outcome), and \(sd(AUC_j)\) captures cross-cohort variability.