Skip to contents

`ms_nmf()` builds an [MsNmf] spec for [ms_extract()]: non-negative matrix factorization on the Rust kernel (`engine::nmf`, U-M1s-02) with the hyper-parameters frozen at factory time. The returned object is the first-class `method` citizen (A14); the string `"nmf"` is sugar that resolves to the registered factory defaults via [match_ms_engine()].

Usage

ms_nmf(engine = "kl", max_iter = 500, seed = 1)

Arguments

engine

one of `"kl"` (generalized KL divergence, the D6 default: the multiplicative updates are the Poisson MLE of the multinomial catalog model) or `"eu"` (squared Frobenius). Stored on the spec's `variant` property.

max_iter

single positive whole number of multiplicative-update iterations (no early stopping: a run is a pure function of its inputs).

seed

single whole number in `[0, 2^31 - 1]` seeding the in-house PCG64 stream of the initializer.

Value

An [MsNmf] object (an [MsEngine] subclass).

Examples

ms_nmf()                       # D6 default: KL, 500 iterations, seed 1
#> <MsNmf> nmf [kl] | mode: extract | deterministic | max_iter: 500, seed: 1
ms_nmf(engine = "eu", seed = 42)
#> <MsNmf> nmf [eu] | mode: extract | deterministic | max_iter: 500, seed: 42