5. API documentation¶
- torchimize.functions.lsq_gna(p: torch.Tensor, function: Callable, jac_function: Optional[Callable] = None, args: Union[Tuple, List] = (), ftol: float = 1e-08, ptol: float = 1e-08, gtol: float = 1e-08, l: float = 1.0, max_iter: int = 100) List[torch.Tensor] ¶
Gauss-Newton implementation for least-squares fitting of non-linear functions
- Parameters:
p – initial value(s)
function – user-provided function which takes p (and additional arguments) as input
jac_fun – user-provided Jacobian function which takes p (and additional arguments) as input
args – optional arguments passed to function
ftol – relative change in cost function as stop condition
ptol – relative change in independant variables as stop condition
gtol – maximum gradient tolerance as stop condition
l – step size damping parameter
max_iter – maximum number of iterations
- Returns:
list of results
- torchimize.functions.lsq_lma(p: torch.Tensor, function: Callable, jac_function: Optional[Callable] = None, args: Union[Tuple, List] = (), ftol: float = 1e-08, ptol: float = 1e-08, gtol: float = 1e-08, tau: float = 0.001, meth: str = 'lev', rho1: float = 0.25, rho2: float = 0.75, bet: float = 2, gam: float = 3, max_iter: int = 100) List[torch.Tensor] ¶
Levenberg-Marquardt implementation for least-squares fitting of non-linear functions
- Parameters:
p – initial value(s)
function – user-provided function which takes p (and additional arguments) as input
jac_fun – user-provided Jacobian function which takes p (and additional arguments) as input
args – optional arguments passed to function
ftol – relative change in cost function as stop condition
ptol – relative change in independant variables as stop condition
gtol – maximum gradient tolerance as stop condition
tau – factor to initialize damping parameter
meth – method which is default ‘lev’ for Levenberg and otherwise Marquardt
rho1 – first gain factor threshold for damping parameter adjustment for Marquardt
rho2 – second gain factor threshold for damping parameter adjustment for Marquardt
bet – multiplier for damping parameter adjustment for Marquardt
gam – divisor for damping parameter adjustment for Marquardt
max_iter – maximum number of iterations
- Returns:
list of results
- torchimize.functions.lsq_gna_parallel(p: torch.Tensor, function: Callable, jac_function: Optional[Callable] = None, args: Union[Tuple, List] = (), wvec: Optional[torch.Tensor] = None, ftol: float = 1e-08, ptol: float = 1e-08, gtol: float = 1e-08, l: float = 1.0, max_iter: int = 100) List[torch.Tensor] ¶
Gauss-Newton implementation for parallel least-squares fitting of non-linear functions with conditions.
- Parameters:
p – initial value(s)
function – user-provided function which takes p (and additional arguments) as input
jac_fun – user-provided Jacobian function which takes p (and additional arguments) as input
args – optional arguments passed to function
wvec – weights vector used in reduction of multiple costs
ftol – relative change in cost function as stop condition
ptol – relative change in independant variables as stop condition
gtol – maximum gradient tolerance as stop condition
l – step size damping parameter
max_iter – maximum number of iterations
- Returns:
list of results
- torchimize.functions.lsq_gna_parallel_plain(p: torch.Tensor, function: Callable, jac_function: Callable, wvec: torch.Tensor, l: float = 1.0, max_iter: int = 100) torch.Tensor ¶
Gauss-Newton implementation for parallel least-squares fitting of non-linear functions without conditions.
- Parameters:
p – initial value(s)
function – user-provided function which takes p (and additional arguments) as input
jac_fun – user-provided Jacobian function which takes p (and additional arguments) as input
wvec – weights vector used in reduction of multiple costs
l – step size damping parameter
max_iter – maximum number of iterations
- Returns:
result
- torchimize.functions.lsq_lma_parallel(p: torch.Tensor, function: Callable, jac_function: Optional[Callable] = None, args: Union[Tuple, List] = (), wvec: Optional[torch.Tensor] = None, ftol: float = 1e-08, ptol: float = 1e-08, gtol: float = 1e-08, tau: float = 0.001, meth: str = 'lev', rho1: float = 0.25, rho2: float = 0.75, beta: float = 2, gama: float = 3, max_iter: int = 100) List[torch.Tensor] ¶
Levenberg-Marquardt implementation for parallel least-squares fitting of non-linear functions
- Parameters:
p – initial value(s)
function – user-provided function which takes p (and additional arguments) as input
jac_fun – user-provided Jacobian function which takes p (and additional arguments) as input
args – optional arguments passed to function
wvec – weights vector used in reduction of multiple costs
ftol – relative change in cost function as stop condition
ptol – relative change in independant variables as stop condition
gtol – maximum gradient tolerance as stop condition
tau – factor to initialize damping parameter
meth – method which is default ‘lev’ for Levenberg and otherwise Marquardt
rho1 – first gain factor threshold for damping parameter adjustment for Marquardt
rho2 – second gain factor threshold for damping parameter adjustment for Marquardt
beta – multiplier for damping parameter adjustment for Marquardt
gama – divisor for damping parameter adjustment for Marquardt
max_iter – maximum number of iterations
- Returns:
list of results
- torchimize.functions.newton_step_parallel(p: torch.Tensor, function: Callable, jac_function: Callable, wvec: torch.Tensor) Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor] ¶
Newton second order step function for parallel least-squares fitting of non-linear functions
- Parameters:
p – current guess
function – user-provided function which takes p (and additional arguments) as input
jac_fun – user-provided Jacobian function which takes p (and additional arguments) as input
wvec – weights vector used in reduction of multiple costs
- Returns:
list of results
- torchimize.functions.test_fun_dims_parallel(p: torch.Tensor, function: Callable, jac_function: Optional[Callable] = None, args: Union[Tuple, List] = (), wvec: Optional[torch.Tensor] = None) bool ¶
Helper function that tests whether dimensionality of output tensors suits the herein provided optimization functions.
- Parameters:
p – initial value(s)
function – user-provided function which takes p (and additional arguments) as input
jac_fun – user-provided Jacobian function which takes p (and additional arguments) as input
args – optional arguments passed to function