% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/diagnosticClassifier.R
\name{diagnosticClassifier}
\alias{diagnosticClassifier}
\title{Integrated Diagnostic Classifier with Multi-Omics Comparison}
\usage{
diagnosticClassifier(
  mae,
  outcome,
  biomarker_table = NULL,
  cv_folds = 5L,
  n_trees = 500L,
  seed = 42L,
  host_assay = "voom",
  mb_assay = "CLR"
)
}
\arguments{
\item{mae}{A \code{MultiAssayExperiment} from \code{\link{matchSamples}}.}

\item{outcome}{A \code{character} or \code{factor} vector of outcome
labels, one per sample. Must have exactly 2 levels.}

\item{biomarker_table}{An optional \code{DataFrame} from
\code{\link{biomarkerDiscovery}}. If provided, only the listed
features are used as classifier inputs. If \code{NULL}, all features
in the matched MAE are used. Default: \code{NULL}.}

\item{cv_folds}{An \code{integer(1)} number of cross-validation folds.
Default: \code{5}.}

\item{n_trees}{An \code{integer(1)} number of trees in each Random
Forest. Default: \code{500}.}

\item{seed}{An \code{integer(1)} random seed for reproducibility.
Default: \code{42}.}

\item{host_assay}{A \code{character(1)} assay in the host SE. Default:
\code{"voom"}.}

\item{mb_assay}{A \code{character(1)} assay in the microbiome SE.
Default: \code{"CLR"}.}
}
\value{
A named \code{list} with elements:
  \describe{
    \item{\code{host_only}}{List with \code{mean_auc}, \code{sd_auc},
      \code{fold_auc}, \code{roc_data} for the host-only classifier.}
    \item{\code{microbiome_only}}{Same structure for the
      microbiome-only classifier.}
    \item{\code{joint}}{Same structure for the joint classifier.}
    \item{\code{n_features}}{Named integer: \code{host},
      \code{microbiome}, \code{joint} feature counts.}
    \item{\code{cv_folds}}{Number of CV folds used.}
    \item{\code{outcome_levels}}{Outcome levels.}
  }
}
\description{
Trains and evaluates three Random Forest diagnostic classifiers using
cross-validation: a host-only model, a microbiome-only model, and a
joint multi-omics model. By comparing AUC-ROC across all three
configurations, \code{diagnosticClassifier} quantifies the added
diagnostic value of combining both data types.
}
\details{
Each classifier is trained using \code{ranger::ranger} (fast C++
Random Forest) with 500 trees and stratified k-fold cross-validation.
Features are drawn from the top biomarkers identified by
\code{\link{biomarkerDiscovery}} (or all available features if
\code{biomarker_table} is \code{NULL}).

The cross-validation procedure:
\enumerate{
  \item Split samples into \code{cv_folds} stratified folds (each
    fold preserves the outcome class ratio).
  \item For each fold, train on the remaining folds, predict on the
    held-out fold.
  \item Compute AUC-ROC on held-out predictions.
  \item Report mean +/- SD AUC across folds.
}
}
\examples{
set.seed(42)
host_counts <- matrix(rpois(500 * 20, 100), nrow = 500, ncol = 20,
    dimnames = list(paste0("Gene", 1:500), paste0("S", 1:20)))
host_counts[1:20, 11:20] <- host_counts[1:20, 11:20] * 5L
mb_counts <- matrix(rpois(60 * 20, 40), nrow = 60, ncol = 20,
    dimnames = list(paste0("Taxon", 1:60), paste0("S", 1:20)))

host_se <- loadHostData(host_counts)
mb_se   <- loadMicrobiomeData(mb_counts)
mae     <- matchSamples(host_se, mb_se)
outcome <- rep(c("ctrl", "treat"), each = 10)
dr_res  <- jointDimReduction(mae, outcome, n_components = 2,
                              n_features_host = 30, n_features_mb = 15)
bm      <- biomarkerDiscovery(mae, dr_res, n_biomarkers = 20)

clf_res <- diagnosticClassifier(mae, outcome,
                                 biomarker_table = bm, cv_folds = 3)
clf_res$host_only$mean_auc
clf_res$joint$mean_auc

}
\seealso{
\code{\link{biomarkerDiscovery}}, \code{\link{plotClassifierComparison}},
  \code{\link{MultiOmicsBridgeAnalysis}}
}
