Score the forced-single-sample entropic-OT (Sinkhorn) negative control
Source:R/singlesample-sinkhorn-single-scorer.R
score_sinkhorn_single.RdScores each row of X independently with the frozen model from
fit_sinkhorn_single. For one specimen the abundances are mapped
to the per-sample robust CLR over its own positive support; its entropic-OT
(Sinkhorn) transport energy to the frozen case cloud and to the frozen control
cloud is computed in pure R on the present-feature subspace, and the frozen
orientation is applied to \((E_{\mathrm{control}} - E_{\mathrm{case}})\) so
larger = more case-like. No statistic of any other scored row enters, so the
score of a row depends only on that row and the frozen model and is exactly
invariant to per-specimen scaling.
The present feature set is intersect(model$feature_universe,
colnames(X)); features missing from a specimen contribute no transport cost.
If fewer than model$hp$min_features universe features are present, or a
reference cloud is empty, or a specimen has empty positive support, the neutral
score 0 is returned (for that row, or for every row in the
below-floor / empty-cloud cases).
Arguments
- model
A
sinkhorn_single_modelobject fromfit_sinkhorn_single.- X
Numeric matrix (samples \(\times\) features) of non-negative abundances with named feature columns.
- meta
Optional per-sample metadata. Accepted for interface uniformity and ignored by this method.
Examples
if (FALSE) { # \dontrun{
model <- fit_sinkhorn_single(X, y)
score_sinkhorn_single(model, X[1, , drop = FALSE])
} # }