Skip to main content

Module nmf_hals

Module nmf_hals 

Source
Expand description

Implementation of NMF, dense and sparse paths. This version implements HALS with random or NNDSVD initialisation.

Modules§

consensus
Consensus NMF: turns the random restarts from super::stabilised_nmf into a stability score and a consensus factor, plus a driver loop over k so the rank can be chosen from the stability and error curves.
dense
Dense backend for NMF. Borrows V as a faer MatRef and routes both data products through utils::gemm::gemm.
nmf_preprocessing
Pre-processing methods for NMF on sparse and dense data.
refit
Fixed-factor NNLS refits. Solves for one factor while the other is frozen, which is what a consensus NMF needs once the consensus factor has been assembled from the clustered restarts.
sparse
Sparse backend for NMF. Holds the chosen layer of V as CSC and CSR with storage type S; widens to compute type F per element inside two hand-rolled spMM kernels.

Structs§

HalsOpts
HALS solver options.
NmfResult
Result of a single NMF run.
StabilisedNmfResult
Result of stabilised NMF across random restarts.

Enums§

NmfInit
Initialisation strategy for HALS.

Traits§

NmfInput
Backend-agnostic view of V for HALS NMF. Implementations write the two data-touching products into caller-owned buffers.

Functions§

compute_objective
Frobenius squared reconstruction error.
gram_h_ht
Gram matrix H H^T.
gram_wt_w
Gram matrix W^T W.
hals_sweep_cols
HALS column sweep for W.
hals_sweep_rows
HALS row sweep for H.
nmf_hals
Frobenius HALS NMF.
nndsvd_from_svd
Boutsidis-Gallopoulos NNDSVD from a top-k truncated SVD.
normalise_w_cols
Normalise columns of W to unit L2 norm.
parse_nmf_init
Parse the NMF initialisation
random_init
Random initialisation
stabilised_nmf
Stabilised NMF via random restarts.