View source: R/hypercube_embedding.R
| linf.hypercube.embedding | R Documentation |
Computes the zero-aware hypercube embedding associated with one reference component of a nonnegative compositional matrix. For rows with positive reference component, the function forms the ordinary homogeneous ratios against that reference and radially maps them into the unit cube. For rows whose reference component is zero, it uses the L-infinity boundary extension so that the embedding remains defined.
linf.hypercube.embedding(
X,
reference,
lambda = NULL,
sigma.quantile = 0.95,
sigma.target = 0.95,
feature.ids = NULL,
feature.labels = NULL,
tol = 0,
backend = c("auto", "dense", "sparse")
)
X |
Nonnegative numeric matrix with samples in rows and features in columns. |
reference |
Reference component. May be a column index, feature ID, or feature label. |
lambda |
Positive numeric scalar. If |
sigma.quantile |
Quantile of positive finite-reference |
sigma.target |
Target value of |
feature.ids |
Optional stable feature identifiers, length |
feature.labels |
Optional display labels, length |
tol |
Nonnegative tolerance. Reference entries |
backend |
Matrix backend: |
Let x = (x_1,\ldots,x_p) be a nonnegative row and let k be the
reference component. When x_k > 0, define
z = x_{-k}/x_k. The embedded row is
\sigma_\lambda(\|z\|_1)\frac{z}{\|z\|_\infty},
\qquad
\sigma_\lambda(t) = 1 - \exp(-\lambda t).
When x_k = 0, the embedded row is the L-infinity-normalized boundary
vector
x_{-k}/\|x_{-k}\|_\infty.
All-zero rows are mapped to all-zero embedded rows by convention.
If lambda is not supplied, it is chosen from the positive finite-reference
rows so that sigma.target is attained at the sigma.quantile quantile of
\|z\|_1. This is a numerical scaling convention for finite datasets; it
does not change the reference component or the boundary extension rule.
A numeric matrix with nrow(X) rows and ncol(X) - 1 columns. The
columns correspond to the non-reference components. Attributes record the
reference component, lambda choice, and finite/boundary row counts.
X <- rbind(
c(A = 2, B = 1, C = 1),
c(A = 0, B = 2, C = 1)
)
linf.hypercube.embedding(X, reference = "A", lambda = log(2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.