Skip to contents

Native point-exponential priors on both sides, with finite greedy Kmax. No cycling or NNLM initialization is advertised. Observed noisy values may be negative: the constraint concerns latent factors, not observations.

Usage

fit_nonnegative_ebmf(
  X,
  sample_side,
  max_factors = 50L,
  initialization = "native_greedy",
  seed = NULL,
  control = list(),
  ...
)

Arguments

X

Named numeric matrix or double sparse Matrix; NA is observed missingness. Only dimnames are kept; other attributes are dropped.

sample_side

"rows" or "columns": which side holds samples. Required.

max_factors

Upper bound on the number of greedily added factors (default 50). The fit can stop earlier.

initialization

Only native_greedy is supported.

seed

Optional integer; the caller's RNG state is restored afterwards.

control

Optional named list of advanced native settings: S_dim, greedy, backfit, nullcheck lists.

...

Other explicit fit_ebmf arguments, excluding ebnm_fn.

Value

Native flash fit; attained rank may be lower than max_factors.

Details

Origin: ADAPTED / call_only. Credits flashier_nmf workflow; bounded native recipe; use factor_provenance("fit_nonnegative_ebmf") for audited sources and runtime versions. Input units and basis are retained; display/conditional results do not establish biological replication.

Author

Peter Carbonetto; Matthew Stephens. Full source and dependency credits: https://github.com/mdmanurung/flashier-utils/blob/main/CREDITS.md.

Examples

if (FALSE) {
set.seed(3)
X <- tcrossprod(matrix(rnorm(48), 24, 2), matrix(rnorm(32), 16, 2)) +
  matrix(rnorm(384, sd = 0.2), 24, 16)
dimnames(X) <- list(paste0("s", 1:24), paste0("g", 1:16))
fit <- fit_ebmf(X, "rows",
  max_factors = 2, seed = 4, verbose = 0,
  ebnm_fn = list(ebnm::ebnm_normal, ebnm::ebnm_point_laplace),
  nullcheck = FALSE, backfit = TRUE, feature_scale = "simulated_centered_intensity"
)
view <- standardize_factors(fit)
nonnegative <- fit_nonnegative_ebmf(abs(X), "rows", max_factors = 2, seed = 4, verbose = 0)
factor_activity(nonnegative)
}