Skip to main content

Module nnls

Module nnls 

Source
Expand description

Lawson-Hanson active-set NNLS (scipy.optimize.nnls’s algorithm): solves min ||Ax - b||^2 subject to x >= 0. Self-contained (no external linear-algebra crate) — columns are few (n_estimators <= 32), so dense Gaussian elimination on the small passive-set normal-equations system is more than adequate.

Functions§

finalize_weights
The wrapper’s ensemble-weight post-processing: normalize NNLS weights to sum to 1 (fallback to uniform if the sum is 0), then blend with uniform via nnls_beta.
nnls
a is column-major: a[j] is the j-th column (length m, matching b’s length). Returns the n = a.len()-length non-negative solution.