nnls(A, b, maxiter=None)
The FORTRAN code was published in the book below. The algorithm is an active set method. It solves the KKT (Karush-Kuhn-Tucker) conditions for the non-negative least squares problem.
Matrix A
as shown above.
Right-hand side vector.
Maximum number of iterations, optional. Default is 3 * A.shape[1]
.
Solve argmin_x || Ax - b ||_2
for x>=0
. This is a wrapper for a FORTRAN non-negative least squares solver.
lsq_linear
Linear least squares with bounds on the variables
>>> from scipy.optimize import nnls ...
>>> A = np.array([[1, 0], [1, 0], [0, 1]])
... b = np.array([2, 1, 1])
... nnls(A, b) (array([1.5, 1. ]), 0.7071067811865475)
>>> b = np.array([-1, -1, -1])See :
... nnls(A, b) (array([0., 0.]), 1.7320508075688772)
The following pages refer to to this document either explicitly or contain code examples using this.
scipy.optimize._nnls.nnls
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them