According to this definition v[i] >= 0 for all i. It differs from the
definition in paper [5] (eq. (2.2)), where the absolute value of v is
used. Both definitions are equivalent down the line.
Derivatives of v with respect to x take value 1, -1 or 0 depending on a
case.
Returns:
v (ndarray with shape of x) – Scaling vector.
dv (ndarray with shape of x) – Derivatives of v[i] with respect to x[i], diagonal elements of v’s
Jacobian.
Find the intersection of a line with the boundary of a trust region.
This function solves the quadratic equation with respect to t
||(x + s*t)||**2 = Delta**2.
Returns:
t_neg, t_pos – Negative and positive roots.
Return type:
tuple of float
Raises:
ValueError – If s is zero or x is not within the trust region.
Shift a point to the interior of a feasible region.
Each element of the returned vector is at least at a relative distance
rstep from the closest bound. If rstep=0 then np.nextafter is used.
Compute reflective transformation and its gradient.
jaxfit.common_scipy.solve_lsq_trust_region(n, m, uf, s, V, Delta, initial_alpha=None, rtol=0.01, max_iter=10)[source]
Solve a trust-region problem arising in least-squares minimization.
This function implements a method described by J. J. More [12] and used
in MINPACK, but it relies on a single SVD of Jacobian instead of series
of Cholesky decompositions. Before running this function, compute:
U,s,VT=svd(J,full_matrices=False).
Parameters:
n (int) – Number of variables.
m (int) – Number of residuals.
uf (ndarray) – Computed as U.T.dot(f).
s (ndarray) – Singular values of J.
V (ndarray) – Transpose of VT.
Delta (float) – Radius of a trust region.
initial_alpha (float, optional) – Initial guess for alpha, which might be available from a previous
iteration. If None, determined automatically.
rtol (float, optional) – Stopping tolerance for the root-finding procedure. Namely, the
solution p will satisfy abs(norm(p)-Delta)<rtol*Delta.
max_iter (int, optional) – Maximum allowed number of iterations for the root-finding procedure.
Returns:
p (ndarray, shape (n,)) – Found solution of a trust-region problem.
alpha (float) – Positive value such that (J.T*J + alpha*I)*p = -J.T*f.
Sometimes called Levenberg-Marquardt parameter.
n_iter (int) – Number of iterations made by root-finding procedure. Zero means
that Gauss-Newton step was selected as the solution.
Solve a general trust-region problem in 2 dimensions.
The problem is reformulated as a 4th order algebraic equation,
the solution of which is found by numpy.roots.
Parameters:
B (ndarray, shape (2, 2)) – Symmetric matrix, defines a quadratic term of the function.
g (ndarray, shape (2,)) – Defines a linear term of the function.
Delta (float) – Radius of a trust region.
Returns:
p (ndarray, shape (2,)) – Found solution.
newton_step (bool) – Whether the returned solution is the Newton step which lies within
the trust region.